Java 类net.sf.jasperreports.engine.design.JRDesignSubreportReturnValue 实例源码

项目:PDFReporter-Studio    文件:RVPropertyPage.java   
public boolean validate() {
    // validate toVariable is unique
    List<String> lto = new ArrayList<String>();
    List<JRDesignSubreportReturnValue> input = (List<JRDesignSubreportReturnValue>) tableViewer.getInput();
    for (JRDesignSubreportReturnValue d : input)
        lto.add(d.getToVariable());
    int size = lto.size();
    int setSize = new HashSet<String>(lto).size();
    if (size != setSize) {
        setErrorMessage(Messages.RVPropertyPage_error_message_return_variables_contain_duplicate_tovariable_values);
        setPageComplete(false);
        return false;
    } else {
        setErrorMessage(null);
        setPageComplete(true);
    }
    return true;
}
项目:ireport-fork    文件:SubreportReturnValuesPanel.java   
/**
  * This method will duplicate the map. The panel will work on a copy of the map.
  **/
 @SuppressWarnings("unchecked")
 public void setReturnValues(List oldReturnVariables) {

     this.returnValues.clear();
     DefaultTableModel model = (DefaultTableModel)jTable.getModel();
     // Create a copy of the map content...
     Iterator iterator = oldReturnVariables.iterator();
     while (iterator.hasNext())
     {
         JRDesignSubreportReturnValue oldReturnValue = (JRDesignSubreportReturnValue)iterator.next();
         JRDesignSubreportReturnValue returnValue = new JRDesignSubreportReturnValue();
         returnValue.setSubreportVariable(oldReturnValue.getSubreportVariable() );
         returnValue.setCalculation(oldReturnValue.getCalculationValue() );
         returnValue.setIncrementerFactoryClassName(oldReturnValue.getIncrementerFactoryClassName() );
         returnValue.setToVariable(oldReturnValue.getToVariable() );
         returnValues.add(returnValue);
         model.addRow(new Object[]{returnValue, returnValue.getToVariable() });
     }
}
项目:ireport-fork    文件:JRSubreportReturnValueDialog.java   
/**
 * Setter for property tmpParameter.
 * 
 * @param tmpVariable New value of property tmpParameter.
 */
public void setSubreportReturnValue(JRDesignSubreportReturnValue tmpSubreportReturnValue)
{
    this.jComboBoxSubreportVariable.setSelectedItem(new String(tmpSubreportReturnValue.getSubreportVariable() ));
    for (int i=0; i<jComboBoxVariable.getItemCount(); ++i)
    {

        Object var = jComboBoxVariable.getItemAt(i);
        if ((var+"").equals( tmpSubreportReturnValue.getToVariable() ))
        {
            jComboBoxVariable.setSelectedIndex(i);
            break;
        }
    }

    Misc.setComboboxSelectedTagValue( jComboBoxCalculationType, tmpSubreportReturnValue.getCalculationValue() );
    this.jTextFieldNameIncrementerFactoryClass.setText(tmpSubreportReturnValue.getIncrementerFactoryClassName());
}
项目:jasperreports    文件:JRSubreportReturnValueFactory.java   
/**
 * Creates an object from a subreport copied value XML element.
 * 
 * @param atts the element attributes
 * @return a {@link JRDesignSubreportReturnValue JRDesignSubreportReturnValue} object
 */
@Override
public Object createObject(Attributes atts)
{
    JRXmlLoader xmlLoader = (JRXmlLoader) digester.peek(digester.getCount() - 1);
    JasperDesign design = (JasperDesign) digester.peek(digester.getCount() - 2);

    JRDesignSubreportReturnValue returnValue = new JRDesignSubreportReturnValue();

    String variableName = atts.getValue(JRXmlConstants.ATTRIBUTE_toVariable);
    JRVariable variable = design.getVariablesMap().get(variableName);
    if (variable == null)
    {
        xmlLoader.addError(new JRValidationException("Unknown variable " + variableName, returnValue));
    }

    returnValue.setSubreportVariable(atts.getValue(JRXmlConstants.ATTRIBUTE_subreportVariable));
    returnValue.setToVariable(variableName);

    CalculationEnum calculation = CalculationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_calculation));
    if (calculation != null)
    {
        returnValue.setCalculation(calculation);
    }

    String incrementerFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_incrementerFactoryClass);
    if (incrementerFactoryClass != null)
    {
        returnValue.setIncrementerFactoryClassName(incrementerFactoryClass);
    }

    return returnValue;
}
项目:jasperreports    文件:JRFillVariableReturnValue.java   
@Override
protected CommonReturnValue createHelperReturnValue(CommonReturnValue returnValue, String nameSuffix, CalculationEnum calculation)
{
    JRDesignSubreportReturnValue helper = new JRDesignSubreportReturnValue();
    helper.setToVariable(returnValue.getToVariable() + nameSuffix);
    helper.setSubreportVariable(((VariableReturnValue)returnValue).getFromVariable());
    helper.setCalculation(calculation);
    helper.setIncrementerFactoryClassName(helper.getIncrementerFactoryClassName());//FIXMERETURN shouldn't it be returnValue?

    return helper;
}
项目:jasperreports    文件:JRFillVariableReturnValue.java   
@Override
protected CommonReturnValue createDistinctCountHelperReturnValue(CommonReturnValue returnValue)
{
    JRDesignSubreportReturnValue helper = new JRDesignSubreportReturnValue();
    helper.setToVariable(returnValue.getToVariable() + "_DISTINCT_COUNT");
    helper.setSubreportVariable(((VariableReturnValue)returnValue).getFromVariable());
    helper.setCalculation(CalculationEnum.NOTHING);
    helper.setIncrementerFactoryClassName(JRDistinctCountIncrementerFactory.class.getName());

    return helper;
}
项目:PDFReporter-Studio    文件:RVPropertyPage.java   
public String getColumnText(Object element, int columnIndex) {
    JRDesignSubreportReturnValue val = (JRDesignSubreportReturnValue) element;
    switch (columnIndex) {
    case 0:
        return val.getSubreportVariable();
    case 1:
        return val.getToVariable();
    case 2:
        return val.getCalculationValue().getName();
    case 3:
        return Misc.nvl(val.getIncrementerFactoryClassName());
    }
    return ""; //$NON-NLS-1$
}
项目:ireport-fork    文件:SubreportReturnValuesPanel.java   
@SuppressWarnings("unchecked")
private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddActionPerformed

    // Check if there is at least a local not system defined variable...
    List localVariables = IReportManager.getInstance().getActiveReport().getVariablesList();
    int count = 0;
    for (int i=0; count == 0 && i<localVariables.size(); ++i)
    {
        JRDesignVariable var = (JRDesignVariable)localVariables.get(i);
        if (!var.isSystemDefined()) count++;
    }

    if (count == 0)
    {
        javax.swing.JOptionPane.showMessageDialog(this, 
                I18n.getString("SubreportReturnValuesPanel.Message.Warning"),
                I18n.getString("SubreportReturnValuesPanel.Message.Error"),
                javax.swing.JOptionPane.WARNING_MESSAGE);
        return;
    }

    Object pWin = SwingUtilities.getWindowAncestor(this);
    JRSubreportReturnValueDialog jrpd = null;
    if (pWin instanceof Dialog) jrpd = new JRSubreportReturnValueDialog((Dialog)pWin);
    else jrpd = new JRSubreportReturnValueDialog((Frame)pWin);

    jrpd.updateVariables();
    jrpd.setVisible(true);

    if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {

        JRDesignSubreportReturnValue returnValue = jrpd.getSubreportReturnValue();
        returnValues.add(returnValue);

        DefaultTableModel model = (DefaultTableModel)jTable.getModel();
        model.addRow(new Object[]{returnValue, returnValue.getToVariable() });
    }

}
项目:ireport-fork    文件:SubreportReturnValuesPanel.java   
@SuppressWarnings("unchecked")
private void jButtonModifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyActionPerformed

    DefaultTableModel model = (DefaultTableModel)jTable.getModel();

    int row = jTable.getSelectedRow();
    if (row < 0) return;
    row = ((JXTable)jTable).convertRowIndexToModel(row);

    JRDesignSubreportReturnValue oldReturnValue = (JRDesignSubreportReturnValue)model.getValueAt(row,0);

    Window pWin = SwingUtilities.windowForComponent(this);

    JRSubreportReturnValueDialog jrpd = null;
    if (pWin instanceof Dialog) jrpd = new JRSubreportReturnValueDialog((Dialog)pWin);
    else if (pWin instanceof Frame) jrpd = new JRSubreportReturnValueDialog((Frame)pWin);
    else jrpd = new JRSubreportReturnValueDialog((Dialog)null);


    //JRSubreportReturnValueDialog jrpd = new JRSubreportReturnValueDialog(SwingUtilities.getWindowAncestor(this));
    jrpd.setSubreportReturnValue(oldReturnValue);
    jrpd.setVisible(true);

    if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
        JRDesignSubreportReturnValue newReturnValue = jrpd.getSubreportReturnValue();
        returnValues.set(row, newReturnValue);
        model.setValueAt(newReturnValue, row, 0);
        model.setValueAt(newReturnValue.getToVariable() , row, 1);

        jTable.updateUI();
    }
}
项目:ireport-fork    文件:SubreportReturnValueCellRenderer.java   
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

    JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (value instanceof JRDesignSubreportReturnValue)
    {
        label.setText( ((JRDesignSubreportReturnValue)value).getSubreportVariable() );
    }

    return label;
}
项目:ireport-fork    文件:JRSubreportReturnValueDialog.java   
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonOKActionPerformed
{

    if ((this.jComboBoxSubreportVariable.getSelectedItem()+"").trim().length() <= 0)
    {
        javax.swing.JOptionPane.showMessageDialog(this, 
                I18n.getString("JRSubreportReturnValueDialog.Message.Warning"),
                I18n.getString("JRSubreportReturnValueDialog.Message.Error"),
                javax.swing.JOptionPane.WARNING_MESSAGE);

        return;
    }

    subreportReturnValue = new JRDesignSubreportReturnValue();

    subreportReturnValue.setSubreportVariable( this.jComboBoxSubreportVariable.getSelectedItem()+"" );

    if (this.jComboBoxVariable.getSelectedItem() == null)
    {
        javax.swing.JOptionPane.showMessageDialog(this, 
                I18n.getString("JRSubreportReturnValueDialog.Message.Warning2"),
                I18n.getString("JRSubreportReturnValueDialog.Message.Error2"),
                javax.swing.JOptionPane.WARNING_MESSAGE);

        return;
    }
    subreportReturnValue.setToVariable( jComboBoxVariable.getSelectedItem()+"");

    Object t = this.jComboBoxCalculationType.getSelectedItem();
    if (t != null && t instanceof Tag) subreportReturnValue.setCalculation(  (CalculationEnum)((Tag)t).getValue() );

    if (this.jTextFieldNameIncrementerFactoryClass.getText().length() == 0)
    {
        subreportReturnValue.setIncrementerFactoryClassName(null);
    }
    else
    {
        subreportReturnValue.setIncrementerFactoryClassName( this.jTextFieldNameIncrementerFactoryClass.getText());
    }
    setVisible(false);
    this.setDialogResult(javax.swing.JOptionPane.OK_OPTION);
    dispose();
}
项目:ireport-fork    文件:JRSubreportReturnValueDialog.java   
/**
 * Getter for property tmpParameter.
 * 
 * @return Value of property tmpParameter.
 */
public JRDesignSubreportReturnValue getSubreportReturnValue()
{

    return subreportReturnValue;
}