private void jButtonAddLinkParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddLinkParameterActionPerformed if (this.isInit()) return; JRLinkParameterDialog jrpd = new JRLinkParameterDialog((javax.swing.JDialog)SwingUtilities.getWindowAncestor(this), true); jrpd.setExpressionContext(getExpressionContext()); jrpd.setVisible(true); if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) { JRDesignHyperlinkParameter parameter = jrpd.getParameter(); getParametersList().add( parameter ); javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel)jTableLinkParameters.getModel(); dtm.addRow(new Object[]{parameter, Misc.getExpressionText( parameter.getValueExpression())}); IReportManager.getInstance().notifyReportChange(); } fireHyperlinkChanged(); }
@Override public Object createObject(Attributes atts) { JRDesignHyperlinkParameter parameter = new JRDesignHyperlinkParameter(); parameter.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name)); return parameter; }
private void addNewParameter() { ElementWithValueExpressionDialog dialog=new ElementWithValueExpressionDialog(Messages.WHyperlink_AddParameterDialogTitle, Messages.WHyperlink_AddParameterDialogLbl1, Messages.WHyperlink_AddParameterDialogLbl2, null, null, getShell()); dialog.setExpressionContext(expContext); if(dialog.open()==Window.OK){ JRDesignHyperlinkParameter linkParam=new JRDesignHyperlinkParameter(); linkParam.setName(dialog.getElementName()); linkParam.setValueExpression(dialog.getElementValueExpression()); hyperlink.addHyperlinkParameter(linkParam); tableViewerHyperlinkParameters.setInput(hyperlink.getHyperlinkParametersList()); } }
private void modifySelectedParameter() { Object selObject=((IStructuredSelection)tableViewerHyperlinkParameters.getSelection()).getFirstElement(); if(selObject!=null && selObject instanceof JRDesignHyperlinkParameter){ JRDesignHyperlinkParameter selectedParam=(JRDesignHyperlinkParameter)selObject; ElementWithValueExpressionDialog dialog=new ElementWithValueExpressionDialog(Messages.WHyperlink_ModifyParameterDialogTitle, Messages.WHyperlink_ModifyParameterDialogLbl1, Messages.WHyperlink_ModifyParameterDialogLbl2, selectedParam.getName(), (JRDesignExpression)selectedParam.getValueExpression(), getShell()); dialog.setExpressionContext(expContext); if(dialog.open()==Window.OK){ selectedParam.setName(dialog.getElementName()); selectedParam.setValueExpression(dialog.getElementValueExpression()); tableViewerHyperlinkParameters.setInput(hyperlink.getHyperlinkParametersList()); } } }
private void removeSelectedParameter() { Object selObject=((IStructuredSelection)tableViewerHyperlinkParameters.getSelection()).getFirstElement(); if(selObject!=null && selObject instanceof JRDesignHyperlinkParameter){ hyperlink.removeHyperlinkParameter((JRDesignHyperlinkParameter)selObject); tableViewerHyperlinkParameters.setInput(hyperlink.getHyperlinkParametersList()); } }
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed Object itemType = jComboBox1.getSelectedItem(); String expClassName = "java.lang.String"; if (itemType != null && itemType instanceof Tag) { expClassName = ((Tag)itemType).getValue()+""; } else if (itemType != null) { expClassName = expClassName+""; } if (expClassName.length() <= 0) { javax.swing.JOptionPane.showMessageDialog(this, I18n.getString("JRLinkParameterDialog.Message.Warning"), I18n.getString("JRLinkParameterDialog.Message.Error"), javax.swing.JOptionPane.WARNING_MESSAGE ); return; } if (this.jTextFieldName.getText().trim().length() <= 0) { javax.swing.JOptionPane.showMessageDialog(this, I18n.getString("JRLinkParameterDialog.Message.Warning"), I18n.getString("JRLinkParameterDialog.Message.Error"), javax.swing.JOptionPane.WARNING_MESSAGE ); return; } tmpParameter = new JRDesignHyperlinkParameter(); tmpParameter.setName(this.jTextFieldName.getText()); tmpParameter.setValueExpression( Misc.createExpression(expClassName, this.jRTextExpressionAreaDefaultExpression.getText())); setVisible(false); this.setDialogResult( javax.swing.JOptionPane.OK_OPTION); dispose(); }
/** Setter for property tmpParameter. * @param tmpParameter New value of property tmpParameter. * */ public void setParameter(JRDesignHyperlinkParameter tmpParameter) { this.jTextFieldName.setText( new String(tmpParameter.getName())); if (tmpParameter.getValueExpression() != null && tmpParameter.getValueExpression().getValueClassName() != null) { this.jComboBox1.setSelectedItem(tmpParameter.getValueExpression().getValueClassName()); } this.jRTextExpressionAreaDefaultExpression.setText( Misc.getExpressionText( tmpParameter.getValueExpression())); }
private void jButtonModLinkParameterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModLinkParameterActionPerformed if (this.isInit()) return; if (jTableLinkParameters.getSelectedRowCount() <= 0) return; JRDesignHyperlinkParameter parameter = (JRDesignHyperlinkParameter)jTableLinkParameters.getValueAt( jTableLinkParameters.getSelectedRow(), 0); JRLinkParameterDialog jrpd = new JRLinkParameterDialog((javax.swing.JDialog)SwingUtilities.getWindowAncestor(this), true); jrpd.setExpressionContext( this.getExpressionContext()); jrpd.setParameter( parameter ); if (evt != null && evt.getID() > 0) { jrpd.setFocusedExpression(evt.getID()); } jrpd.setVisible(true); if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) { parameter.setName( jrpd.getParameter().getName() ); parameter.setValueExpression( jrpd.getParameter().getValueExpression()); javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel)jTableLinkParameters.getModel(); dtm.setValueAt(parameter,jTableLinkParameters.getSelectedRow(),0); dtm.setValueAt(Misc.getExpressionText( parameter.getValueExpression()),jTableLinkParameters.getSelectedRow(),1); jTableLinkParameters.updateUI(); IReportManager.getInstance().notifyReportChange(); } fireHyperlinkChanged(); }
/** * Generate a designhyperling parameter form the name of the parameter and the expression value treated * as a string * * @param name name of the parameter * @param expressionValue the string value to insert into the parameter, sicne it is a textual value quotes are * automatically added * @return a designhyperling parameter */ private static JRDesignHyperlinkParameter generateParameter(String name, String expressionValue){ JRDesignHyperlinkParameter newParam = new JRDesignHyperlinkParameter(); newParam.setName(name); newParam.setValueExpression(new JRDesignExpression("\""+expressionValue+"\"")); return newParam; }
/** Getter for property tmpParameter. * @return Value of property tmpParameter. * */ public JRDesignHyperlinkParameter getParameter() { return tmpParameter; }