Java 类net.sf.jasperreports.engine.type.IncrementTypeEnum 实例源码

项目:jasperreports    文件:JRXmlWriter.java   
/**
 *
 */
private void writeVariable(JRVariable variable) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_variable);
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, variable.getName());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_class, variable.getValueClassName());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_resetType, variable.getResetTypeValue(), ResetTypeEnum.REPORT);
    if (variable.getResetGroup() != null)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_resetGroup, variable.getResetGroup().getName());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_incrementType, variable.getIncrementTypeValue(), IncrementTypeEnum.NONE);
    if (variable.getIncrementGroup() != null)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_incrementGroup, variable.getIncrementGroup().getName());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_calculation, variable.getCalculationValue(), CalculationEnum.NOTHING);
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_incrementerFactoryClass, variable.getIncrementerFactoryClassName());

    writeExpression(JRXmlConstants.ELEMENT_variableExpression, variable.getExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_initialValueExpression, variable.getInitialValueExpression(), false);

    writer.closeElement();
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 *
 */
private void writeVariable( JRVariable variable, String variableName)
{
    if(variable != null)
    {
        String resetGroupName = getGroupName( variable.getResetGroup());
        String incrementGroupName = getGroupName( variable.getIncrementGroup());

        write( "JRDesignVariable " + variableName + " = new JRDesignVariable();\n");
        write( variableName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(variable.getName()));
        write( variableName + ".setValueClassName(\"{0}\");\n", variable.getValueClassName());
        write( variableName + ".setResetType({0});\n", variable.getResetTypeValue(), ResetTypeEnum.REPORT);
        write( variableName + ".setResetGroup({0});\n", resetGroupName);
        write( variableName + ".setIncrementType({0});\n", variable.getIncrementTypeValue(), IncrementTypeEnum.NONE);
        write( variableName + ".setIncrementGroup({0});\n", incrementGroupName);

        write( variableName + ".setCalculation({0});\n", variable.getCalculationValue(), CalculationEnum.NOTHING);
        write( variableName + ".setIncrementerFactoryClass({0}.class);\n", JRStringUtil.escapeJavaStringLiteral(variable.getIncrementerFactoryClassName()));
        writeExpression( variable.getExpression(), variableName, "Expression");
        writeExpression( variable.getInitialValueExpression(), variableName, "InitialValueExpression");
        flush();
    }
}
项目:jasperreports    文件:JRVerifier.java   
public void verifyElementDataset(JRElementDataset dataset)
    {
        JRDatasetRun datasetRun = dataset.getDatasetRun();

        if (datasetRun != null)
        {
            IncrementTypeEnum incrementType = dataset.getIncrementTypeValue();
            if (incrementType == IncrementTypeEnum.PAGE || incrementType == IncrementTypeEnum.COLUMN)
            {
                addBrokenRule("Chart datasets with dataset run cannont have Column or Page increment type.", dataset);
            }

            ResetTypeEnum resetType = dataset.getResetTypeValue();
            if (resetType == ResetTypeEnum.PAGE || resetType == ResetTypeEnum.COLUMN)
            {
                addBrokenRule("Chart datasets with dataset run cannont have Column or Page reset type.", dataset);
            }
//          else if (resetType != ResetTypeEnum.REPORT)
//          {
//              //doesn't make sense, but let it go
//          }

            verifyDatasetRun(datasetRun);
        }
    }
项目:jasperreports    文件:JRFillDataset.java   
private JRVariable createDistinctCountHelperVariable(JRVariable variable)
{
    JRDesignVariable helper = new JRDesignVariable();
    helper.setName(variable.getName() + "_DISTINCT_COUNT");
    helper.setValueClassName(variable.getValueClassName());
    helper.setIncrementerFactoryClassName(JRDistinctCountIncrementerFactory.class.getName());
    helper.setResetType(ResetTypeEnum.REPORT);

    if (variable.getIncrementTypeValue() != IncrementTypeEnum.NONE)
    {
        helper.setResetType(ResetTypeEnum.getByValue(variable.getIncrementTypeValue().getValue()));
    }
    helper.setResetGroup(variable.getIncrementGroup());
    helper.setCalculation(CalculationEnum.NOTHING);
    helper.setSystemDefined(true);
    helper.setExpression(variable.getExpression());

    return helper;
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillReportStart() throws JRException
{
    scriptlet.callBeforeReportInit();
    calculator.initializeVariables(ResetTypeEnum.REPORT, IncrementTypeEnum.REPORT);
    scriptlet.callAfterReportInit();

    printPage = newPage();
    addPage(printPage);
    setFirstColumn();
    offsetY = topMargin;
    isFirstPageBand = true;
    isFirstColumnBand = true;

    fillBackground();

    fillTitle();

    fillPageHeader(JRExpression.EVALUATION_DEFAULT);

    fillColumnHeaders(JRExpression.EVALUATION_DEFAULT);

    fillGroupHeaders(true);

    fillDetail();
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillReportContent() throws JRException
{
    calculator.estimateGroupRuptures();

    fillGroupFooters(false);

    resolveGroupBoundElements(JRExpression.EVALUATION_OLD, false);
    scriptlet.callBeforeGroupInit();
    calculator.initializeVariables(ResetTypeEnum.GROUP, IncrementTypeEnum.GROUP);
    scriptlet.callAfterGroupInit();

    fillGroupHeaders(false);

    fillDetail();
}
项目:jasperreports    文件:JRCalculator.java   
/**
 *
 */
public void initializeVariables(ResetTypeEnum resetType, IncrementTypeEnum incrementType) throws JRException
{
    if (variables != null && variables.length > 0)
    {
        for(int i = 0; i < variables.length; i++)
        {
            incrementVariable(variables[i], incrementType);
            initializeVariable(variables[i], resetType);
        }
    }

    if (datasets != null && datasets.length > 0)
    {
        for(int i = 0; i < datasets.length; i++)
        {
            incrementDataset(datasets[i], incrementType);
            initializeDataset(datasets[i], resetType);
        }
    }
}
项目:jasperreports    文件:JRVerticalFiller.java   
/**
 *
 */
private void fillReportContent() throws JRException
{
    calculator.estimateGroupRuptures();

    fillGroupFooters(false);

    resolveGroupBoundElements(JRExpression.EVALUATION_OLD, false);
    scriptlet.callBeforeGroupInit();
    calculator.initializeVariables(ResetTypeEnum.GROUP, IncrementTypeEnum.GROUP);
    scriptlet.callAfterGroupInit();

    fillGroupHeaders(false);

    fillDetail();
}
项目:eMonocot    文件:JRVerticalReportWriter.java   
/**
 *
 */
private void fillReportStart() throws JRException
{
    scriptlet.callBeforeReportInit();
    calculator.initializeVariables(ResetTypeEnum.REPORT, IncrementTypeEnum.REPORT);
    scriptlet.callAfterReportInit();

    printPage = newPage();
    addPage(printPage);
    setFirstColumn();
    offsetY = topMargin;

    fillBackground();

    fillTitle();

    fillPageHeader(JRExpression.EVALUATION_DEFAULT);

    fillColumnHeader(JRExpression.EVALUATION_DEFAULT);

    fillGroupHeaders(true);

    fillDetail();
}
项目:eMonocot    文件:JRVerticalReportWriter.java   
/**
 *
 */
private void fillReportContent() throws JRException
{
    calculator.estimateGroupRuptures();

    fillGroupFooters(false);

    resolveGroupBoundElements(JRExpression.EVALUATION_OLD, false);
    scriptlet.callBeforeGroupInit();
    calculator.initializeVariables(ResetTypeEnum.GROUP, IncrementTypeEnum.GROUP);
    scriptlet.callAfterGroupInit();

    fillGroupHeaders(false);

    fillDetail();
}
项目:PDFReporter-Studio    文件:EditableDatasetBaseComposite.java   
private void updateIncrementTypeInformation(int selIndex) {     
    IncrementTypeEnum selectedIncrType=IncrementTypeEnum.getByName(comboIncrementType.getText());
    if (selectedIncrType==IncrementTypeEnum.GROUP){
        if(fillGroupCombo(comboIncrementGroup)){
            // force the selection of the first group
            comboIncrementGroup.select(0);
            updateIncrementGroupInformation(0);
        }
    }
    else {
        datasetInstance.setResetGroup(null);
        this.comboIncrementGroup.setEnabled(false);
        this.comboIncrementGroup.setItems(new String[0]);
    }
    datasetInstance.setIncrementType(selectedIncrType);
}
项目:ireport-fork    文件:VariableNode.java   
@Override
@SuppressWarnings("unchecked")
public PropertyEditor getPropertyEditor() {

    if (editor == null)
    {
        java.util.ArrayList l = new java.util.ArrayList();

        l.add(new Tag(IncrementTypeEnum.REPORT, I18n.getString("VariableNode.Property.Report")));
        l.add(new Tag(IncrementTypeEnum.COLUMN, I18n.getString("VariableNode.Property.Column")));
        l.add(new Tag(IncrementTypeEnum.GROUP, I18n.getString("VariableNode.Property.Group")));
        l.add(new Tag(IncrementTypeEnum.NONE, I18n.getString("VariableNode.Property.None")));
        l.add(new Tag(IncrementTypeEnum.PAGE, I18n.getString("VariableNode.Property.Page")));

        editor = new ComboBoxPropertyEditor(false, l);
    }
    return editor;
}
项目:jasperreports    文件:JRBaseElementDataset.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        resetTypeValue = ResetTypeEnum.getByValue(resetType);
        incrementTypeValue = IncrementTypeEnum.getByValue(incrementType);
    }

}
项目:jasperreports    文件:JRBaseVariable.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        resetTypeValue = ResetTypeEnum.getByValue(resetType);
        incrementTypeValue = IncrementTypeEnum.getByValue(incrementType);
        calculationValue = CalculationEnum.getByValue(calculation);
    }

}
项目:jasperreports    文件:JRXmlWriter.java   
/**
 * Writes the JRXML representation of an {@link JRElementDataset element dataset}.
 * 
 * <p>
 * The method produces a <code>&lt;dataset&gt;</code> XML element.
 * 
 * @param dataset the element dataset
 * @param defaultResetType the default dataset reset type
 * @param skipIfEmpty if set, no output will be produced if the element dataset
 * only has default attribute values
 * @throws IOException any I/O exception that occurred while writing the
 * XML output
 */

public void writeElementDataset(JRElementDataset dataset, ResetTypeEnum defaultResetType, 
        boolean skipIfEmpty) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_dataset, getNamespace());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_resetType, dataset.getResetTypeValue(), defaultResetType);

    if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_resetGroup, dataset.getResetGroup().getName());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_incrementType, dataset.getIncrementTypeValue(), IncrementTypeEnum.NONE);

    if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP)
    {
        writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_incrementGroup, dataset.getIncrementGroup().getName());
    }

    writeExpression(JRXmlConstants.ELEMENT_incrementWhenExpression, dataset.getIncrementWhenExpression(), false);

    JRDatasetRun datasetRun = dataset.getDatasetRun();
    if (datasetRun != null)
    {
        writeDatasetRun(datasetRun);
    }

    writer.closeElement(skipIfEmpty);
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 * Writes the JRXML representation of an {@link JRElementDataset element dataset}.
 * 
 * <p>
 * The method produces a <code>&lt;dataset&gt;</code> XML element.
 * 
 * @param dataset the element dataset
 * @param skipIfEmpty if set, no output will be produced if the element dataset
 * only has default attribute values
 */
public void writeElementDataset( JRElementDataset dataset, boolean skipIfEmpty, String datasetName)
{
    if(dataset != null)
    {
        write( datasetName + ".setResetType({0});\n", dataset.getResetTypeValue(), ResetTypeEnum.REPORT);

        if (dataset.getResetTypeValue() == ResetTypeEnum.GROUP)
        {
            String resetGroupName = getGroupName(  dataset.getResetGroup());
            write( datasetName + ".setResetGroup(" + resetGroupName + ");\n");
        }

        write( datasetName + ".setIncrementType({0});\n", dataset.getIncrementTypeValue(), IncrementTypeEnum.NONE);

        if (dataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP)
        {
            String incrementGroupName = getGroupName(  dataset.getIncrementGroup());
            write( datasetName + ".setIncrementGroup(" + incrementGroupName + ");\n");
        }

        writeExpression( dataset.getIncrementWhenExpression(), datasetName, "IncrementWhenExpression");

        JRDatasetRun datasetRun = dataset.getDatasetRun();
        if (datasetRun != null)
        {
            writeDatasetRun( datasetRun, datasetName);
        }
        flush();
    }
}
项目:jasperreports    文件:JRDesignVariable.java   
/**
 *
 */
public void setIncrementType(IncrementTypeEnum incrementTypeValue)
{
    Object old = this.incrementTypeValue;
    this.incrementTypeValue = incrementTypeValue;
    getEventSupport().firePropertyChange(PROPERTY_INCREMENT_TYPE, old, this.incrementTypeValue);
}
项目:jasperreports    文件:JRDesignElementDataset.java   
/**
 *
 */
public void setIncrementType(IncrementTypeEnum incrementTypeValue)
{
    Object old = this.incrementTypeValue;
    this.incrementTypeValue = incrementTypeValue;
    getEventSupport().firePropertyChange(PROPERTY_INCREMENT_TYPE, old, this.incrementTypeValue);
}
项目:jasperreports    文件:JRCalculator.java   
/**
 *
 */
public void calculateVariables(boolean incrementDatasets) throws JRException
{
    if (variables != null && variables.length > 0)
    {
        for (int i = 0; i < variables.length; i++)
        {
            JRFillVariable variable = variables[i];
            Object expressionValue = evaluate(variable.getExpression());
            Object newValue = variable.getIncrementer().increment(variable, expressionValue, AbstractValueProvider.getCurrentValueProvider());
            variable.setValue(newValue);
            variable.setInitialized(false);
            variable.setPreviousIncrementedValue(variable.getIncrementedValue());

            if (variable.getIncrementTypeValue() == IncrementTypeEnum.NONE)
            {
                variable.setIncrementedValue(variable.getValue());
            }
        }
    }

    if (incrementDatasets && datasets != null && datasets.length > 0)
    {
        for (int i = 0; i < datasets.length; i++)
        {
            JRFillElementDataset elementDataset = datasets[i];
            elementDataset.evaluate(this);

            if (elementDataset.getIncrementTypeValue() == IncrementTypeEnum.NONE)
            {
                elementDataset.increment();
            }
        }
    }
}
项目:jasperreports    文件:JRFillDatasetRun.java   
protected void group() throws JRException, JRScriptletException
{
    dataset.calculator.estimateGroupRuptures();

    dataset.delegateScriptlet.callBeforeGroupInit();
    dataset.calculator.initializeVariables(ResetTypeEnum.GROUP, IncrementTypeEnum.GROUP);
    dataset.delegateScriptlet.callAfterGroupInit();
}
项目:jasperreports    文件:JRVerticalFiller.java   
/**
 *
 */
private void fillReportStart() throws JRException
{
    scriptlet.callBeforeReportInit();
    calculator.initializeVariables(ResetTypeEnum.REPORT, IncrementTypeEnum.REPORT);
    scriptlet.callAfterReportInit();

    printPage = newPage();
    addPage(printPage);
    setFirstColumn();
    offsetY = topMargin;
    isFirstPageBand = true;
    isFirstColumnBand = true;
    isCrtRecordOnPage = false;
    isCrtRecordOnColumn = false;

    fillBackground();

    fillTitle();

    fillPageHeader(JRExpression.EVALUATION_DEFAULT);

    fillColumnHeader(JRExpression.EVALUATION_DEFAULT);

    fillGroupHeaders(true);

    fillDetail();
}
项目:PDFReporter-Studio    文件:ElementDatasetWidget.java   
private void fillIncrement() {
    List<String> lsIncs = new ArrayList<String>();
    lsIncs.add(IncrementTypeEnum.REPORT.getName());
    lsIncs.add(IncrementTypeEnum.PAGE.getName());
    lsIncs.add(IncrementTypeEnum.COLUMN.getName());
    JRDataset jrds = getJRdataset(eDataset);
    for (JRGroup gr : jrds.getGroups())
        lsIncs.add(GROUPPREFIX + gr.getName());
    lsIncs.add(IncrementTypeEnum.NONE.getName());

    cbIncrement.setItems(lsIncs.toArray(new String[lsIncs.size()]));

    IncrementTypeEnum rst = eDataset.getIncrementTypeValue();
    String grname = eDataset.getIncrementGroup() != null ? eDataset
            .getIncrementGroup().getName() : null;
    for (int i = 0; i < lsIncs.size(); i++) {
        String rsttype = lsIncs.get(i);
        if (rst.equals(IncrementTypeEnum.GROUP)) {
            if (rsttype.startsWith(GROUPPREFIX)
                    && grname
                            .equals(rsttype.substring(GROUPPREFIX.length()))) {
                cbIncrement.select(i);
                break;
            }
        } else if (rsttype.equals(rst.getName())) {
            cbIncrement.select(i);
            break;
        }
    }
}
项目:PDFReporter-Studio    文件:MElementDataset.java   
@Override
public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) {
    resetTypeD = new JSSEnumPropertyDescriptor(JRDesignElementDataset.PROPERTY_RESET_TYPE, Messages.common_reset_type,
            ResetTypeEnum.class, NullEnum.NOTNULL);
    resetTypeD.setDescription(Messages.MElementDataset_reset_type_description);
    desc.add(resetTypeD);

    inctypeD = new JSSEnumPropertyDescriptor(JRDesignElementDataset.PROPERTY_INCREMENT_TYPE,
            Messages.common_increment_type, IncrementTypeEnum.class, NullEnum.NOTNULL);
    inctypeD.setDescription(Messages.MElementDataset_increment_type_description);
    desc.add(inctypeD);

    JRExpressionPropertyDescriptor incWhenExprD = new JRExpressionPropertyDescriptor(
            JRDesignElementDataset.PROPERTY_INCREMENT_WHEN_EXPRESSION, Messages.MElementDataset_increment_when_expression);
    incWhenExprD.setDescription(Messages.MElementDataset_increment_when_expression_description);
    desc.add(incWhenExprD);
    incWhenExprD.setHelpRefBuilder(new HelpReferenceBuilder(
            "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#incrementWhenExpression"));

    resetGroupD = new RComboBoxPropertyDescriptor(JRDesignElementDataset.PROPERTY_RESET_GROUP,
            Messages.common_reset_group, new String[] { "" }); //$NON-NLS-1$
    resetGroupD.setDescription(Messages.MElementDataset_reset_group_description);
    desc.add(resetGroupD);

    incGroupD = new RComboBoxPropertyDescriptor(JRDesignElementDataset.PROPERTY_INCREMENT_GROUP,
            Messages.common_increment_group, new String[] { "" }); //$NON-NLS-1$
    incGroupD.setDescription(Messages.MElementDataset_increment_group_description);
    desc.add(incGroupD);

    DatasetRunPropertyDescriptor datasetRunD = new DatasetRunPropertyDescriptor(
            JRDesignElementDataset.PROPERTY_DATASET_RUN, Messages.MElementDataset_dataset_run);
    datasetRunD.setDescription(Messages.MElementDataset_dataset_run_description);
    desc.add(datasetRunD);
    datasetRunD.setHelpRefBuilder(new HelpReferenceBuilder(
            "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#datasetRun"));

    setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#dataset");
}
项目:PDFReporter-Studio    文件:MVariable.java   
@Override
public Object getPropertyValue(Object id) {
    JRDesignVariable jrVariable = (JRDesignVariable) getValue();
    Object s = super.getPropertyValue(id);
    if (s != null)
        return s;
    if (id.equals(JRDesignVariable.PROPERTY_RESET_GROUP)) {
        if (jrVariable.getResetTypeValue().equals(ResetTypeEnum.GROUP) && resetGroupD != null) {
                if (jrVariable.getResetGroup() != null){
                    return jrVariable.getResetGroup().getName();
                }
        }
        return ""; //$NON-NLS-1$
    }
    if (id.equals(JRDesignVariable.PROPERTY_INCREMENT_GROUP)) {
        if (jrVariable.getIncrementTypeValue().equals(IncrementTypeEnum.GROUP) && incrementGroupD != null) {
                if (jrVariable.getIncrementGroup() != null){
                    return jrVariable.getIncrementGroup().getName();
                }
        }
        return ""; //$NON-NLS-1$
    }
    if (id.equals(JRDesignVariable.PROPERTY_CALCULATION))
        return calculationD.getEnumValue(jrVariable.getCalculationValue());
    if (id.equals(JRDesignVariable.PROPERTY_RESET_TYPE))
        return resetTypeD.getEnumValue(jrVariable.getResetTypeValue());
    if (id.equals(JRDesignVariable.PROPERTY_INCREMENT_TYPE))
        return incrementTypeD.getEnumValue(jrVariable.getIncrementTypeValue());
    if (id.equals(JRDesignVariable.PROPERTY_INCREMENTER_FACTORY_CLASS_NAME))
        return jrVariable.getIncrementerFactoryClassName();
    if (id.equals(JRDesignVariable.PROPERTY_EXPRESSION)) {
        return ExprUtil.getExpression(jrVariable.getExpression());
    }
    if (id.equals(JRDesignVariable.PROPERTY_INITIAL_VALUE_EXPRESSION)) {
        return ExprUtil.getExpression(jrVariable.getInitialValueExpression());
    }
    return null;
}
项目:ireport-fork    文件:MapMarkersPanel.java   
private void jComboBoxIncrementTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxIncrementTypeActionPerformed


        if (isInit() || getCurrentSelectedComponent() == null) return;

        IncrementTypeEnum val = (IncrementTypeEnum)((Tag)jComboBoxIncrementType.getSelectedItem()).getValue();

        if (val == IncrementTypeEnum.GROUP) {
            // Currently selected dataset...
            List groups = getComponentDataset().getGroupsList();


            if (groups.size() == 0) {
                setInit(true);
                Misc.setComboboxSelectedTagValue(jComboBoxIncrementType,getDesignDataset().getIncrementTypeValue());
                SwingUtilities.invokeLater(new Runnable(){
                    public void run() {
                        JOptionPane.showMessageDialog(jComboBoxIncrementGroup, I18n.getString("ChartPropertiesDialog.MessageDialog.NoGroupsAvail"));
                    }
                });
                setInit(false);
                return;
            } else {
                getDesignDataset().setIncrementType(val);
                jComboBoxIncrementGroup.setEnabled(true);
                jComboBoxIncrementGroup.setSelectedIndex(0);
            }
        } else {
            getDesignDataset().setIncrementType(val);
            getDesignDataset().setIncrementGroup(null);
            jComboBoxIncrementGroup.setEnabled(false);
            jComboBoxIncrementGroup.setSelectedItem(null);
        }
    }
项目:ireport-fork    文件:SpiderChartPanel.java   
private void jComboBoxIncrementTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxIncrementTypeActionPerformed


        if (isInit() || getCurrentSelectedChartComponent() == null) return;

        IncrementTypeEnum val = (IncrementTypeEnum)((Tag)jComboBoxIncrementType.getSelectedItem()).getValue();

        if (val == IncrementTypeEnum.GROUP) {
            // Currently selected dataset...
            List groups = getComponentDataset().getGroupsList();


            if (groups.size() == 0) {
                setInit(true);
                Misc.setComboboxSelectedTagValue(jComboBoxIncrementType,getCurrentSelectedChartComponent().getDataset().getIncrementTypeValue());
                SwingUtilities.invokeLater(new Runnable(){
                    public void run() {
                        JOptionPane.showMessageDialog(jComboBoxIncrementGroup, I18n.getString("ChartPropertiesDialog.MessageDialog.NoGroupsAvail"));
                    }
                });
                setInit(false);
                return;
            } else {
                ((StandardSpiderDataset)getCurrentSelectedChartComponent().getDataset()).setIncrementType(val);
                jComboBoxIncrementGroup.setEnabled(true);
                jComboBoxIncrementGroup.setSelectedIndex(0);
            }
        } else {
            ((StandardSpiderDataset)getCurrentSelectedChartComponent().getDataset()).setIncrementType(val);
            ((StandardSpiderDataset)getCurrentSelectedChartComponent().getDataset()).setIncrementGroup(null);
            jComboBoxIncrementGroup.setEnabled(false);
            jComboBoxIncrementGroup.setSelectedItem(null);
        }
    }
项目:ireport-fork    文件:VariableNode.java   
@SuppressWarnings("unchecked")
public IncrementTypeProperty(JRDesignVariable variable, JRDesignDataset dataset)
{
    // TODO: Replace WhenNoDataType with the right constant
    super( JRDesignVariable.PROPERTY_INCREMENT_TYPE,IncrementTypeEnum.class, I18n.getString("VariableNode.Property.Incrementtype"), I18n.getString("VariableNode.Property.Incrementtypedetail"), true, true);
    this.variable = variable;
    this.dataset = dataset;
    setValue("suppressCustomEditor", Boolean.TRUE);
}
项目:ireport-fork    文件:CrosstabDataDialog.java   
private void jComboBoxIncrementTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxIncrementTypeActionPerformed


    if (isInit() || currentSelectedCrosstabElement == null) return;

    IncrementTypeEnum val = (IncrementTypeEnum)((Tag)jComboBoxIncrementType.getSelectedItem()).getValue();

    if (val == IncrementTypeEnum.GROUP)
    {
        if (getCrosstabDataset().getGroupsList().size() == 0)
        {
            setInit(true);
            Misc.setComboboxSelectedTagValue(jComboBoxIncrementType, currentSelectedCrosstabElement.getDataset().getIncrementTypeValue());
            SwingUtilities.invokeLater(new Runnable(){
                public void run()
                {
                    JOptionPane.showMessageDialog(jComboBoxIncrementGroup, I18n.getString("CrosstabDataDialog.Message.NoGroupsAvailable"));
                }
            });
            setInit(false);
            return;
        }
        else
        {
            ((JRDesignCrosstabDataset)currentSelectedCrosstabElement.getDataset()).setIncrementType(val);
            jComboBoxIncrementGroup.setEnabled(true);
            jComboBoxIncrementGroup.setSelectedIndex(0);
        }
    }
    else
    {
       ((JRDesignCrosstabDataset)currentSelectedCrosstabElement.getDataset()).setIncrementType(val);
       ((JRDesignCrosstabDataset)currentSelectedCrosstabElement.getDataset()).setIncrementGroup(null);
       jComboBoxIncrementGroup.setEnabled(false);
       jComboBoxIncrementGroup.setSelectedItem(null);
    }

}
项目:jasperreports    文件:JRBaseElementDataset.java   
@Override
public IncrementTypeEnum getIncrementTypeValue()
{
    return this.incrementTypeValue;
}
项目:jasperreports    文件:JRBaseVariable.java   
@Override
public IncrementTypeEnum getIncrementTypeValue()
{
    return this.incrementTypeValue;
}
项目:jasperreports    文件:JRFillVariable.java   
@Override
public IncrementTypeEnum getIncrementTypeValue()
{
    return parent.getIncrementTypeValue();
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillPageHeader(byte evaluation) throws JRException
{
    if (log.isDebugEnabled() && !pageHeader.isEmpty())
    {
        log.debug("Fill " + fillerId + ": page header at " + offsetY);
    }

    setNewPageColumnInBands();

    pageHeader.evaluatePrintWhenExpression(JRExpression.EVALUATION_DEFAULT);

    if (pageHeader.isToPrint())
    {
        int reattempts = getMasterColumnCount();
        if (isCreatingNewPage)
        {
            --reattempts;
        }

        boolean filled = fillBandNoOverflow(pageHeader, evaluation);

        for (int i = 0; !filled && i < reattempts; ++i)
        {
            resolveGroupBoundElements(evaluation, false);
            resolveColumnBoundElements(evaluation);
            resolvePageBoundElements(evaluation);
            scriptlet.callBeforePageInit();
            calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
            scriptlet.callAfterPageInit();

            addPage(false);

            filled = fillBandNoOverflow(pageHeader, evaluation);
        }

        if (!filled)
        {
            throw 
                new JRRuntimeException(
                    EXCEPTION_MESSAGE_KEY_PAGE_HEADER_OVERFLOW_INFINITE_LOOP,
                    (Object[])null);
        }
    }

    columnHeaderOffsetY = offsetY;

    isNewPage = true;
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillColumnHeaders(byte evaluation) throws JRException
{
    if (log.isDebugEnabled() && !columnHeader.isEmpty())
    {
        log.debug("Fill " + fillerId + ": column headers at " + offsetY);
    }

    setNewPageColumnInBands();
    isFirstColumnBand = true;

    for(columnIndex = 0; columnIndex < columnCount; columnIndex++)
    {
        setColumnNumberVariable();

        columnHeader.evaluatePrintWhenExpression(evaluation);

        if (columnHeader.isToPrint())
        {
            int reattempts = getMasterColumnCount();
            if (isCreatingNewPage)
            {
                --reattempts;
            }

            boolean fits = columnHeader.getHeight() <= columnFooterOffsetY - offsetY;
            for (int i = 0; !fits && i < reattempts; ++i)
            {
                fillPageFooter(evaluation);

                resolveGroupBoundElements(evaluation, false);
                resolveColumnBoundElements(evaluation);
                resolvePageBoundElements(evaluation);
                scriptlet.callBeforePageInit();
                calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
                scriptlet.callAfterPageInit();

                addPage(false);

                fillPageHeader(evaluation);

                fits = columnHeader.getHeight() <= columnFooterOffsetY - offsetY;
            }

            if (!fits)
            {
                throw 
                    new JRRuntimeException(
                        EXCEPTION_MESSAGE_KEY_COLUMN_HEADER_OVERFLOW_INFINITE_LOOP,
                        (Object[])null);
            }

            setOffsetX();
            offsetY = columnHeaderOffsetY;

            fillFixedBand(columnHeader, evaluation, false);
        }
    }

    setFirstColumn();

    isNewColumn = true;
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillSummaryNoLastFooterNewPage() throws JRException
{
    // do nothing about groupFooterPositionElementRange because the following fillColumnFooter will do

    fillColumnFooters(JRExpression.EVALUATION_DEFAULT);

    fillPageFooter(JRExpression.EVALUATION_DEFAULT);

    summary.evaluatePrintWhenExpression(JRExpression.EVALUATION_DEFAULT);

    if (summary.isToPrint())
    {
        resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, true);
        resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
        resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
        scriptlet.callBeforePageInit();
        calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
        scriptlet.callAfterPageInit();

        addPage(false);

        if (isSummaryWithPageHeaderAndFooter)
        {
            fillPageHeader(JRExpression.EVALUATION_DEFAULT);
        }

        summary.evaluate(JRExpression.EVALUATION_DEFAULT);

        JRPrintBand printBand = summary.fill(pageHeight - bottomMargin - offsetY - (isSummaryWithPageHeaderAndFooter?pageFooter.getHeight():0));

        if (summary.willOverflow() && summary.isSplitPrevented() && !summary.isSplitTypePreventInhibited())
        {
            if (isSummaryWithPageHeaderAndFooter)
            {
                fillPageFooter(JRExpression.EVALUATION_DEFAULT);
            }

            resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, true);
            resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
            resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
            scriptlet.callBeforePageInit();
            calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
            scriptlet.callAfterPageInit();

            addPage(false);

            if (isSummaryWithPageHeaderAndFooter)
            {
                fillPageHeader(JRExpression.EVALUATION_DEFAULT);
            }

            printBand = 
                summary.refill(
                    JRExpression.EVALUATION_DEFAULT,
                    pageHeight - bottomMargin - offsetY - (isSummaryWithPageHeaderAndFooter?pageFooter.getHeight():0)
                    );
        }

        fillBand(printBand);
        offsetY += printBand.getHeight();
        isCrtRecordOnPage = true;
        isCrtRecordOnColumn = true;

        /*   */
        fillSummaryOverflow();
    }

    //DONE
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillSummaryOverflow() throws JRException
{
    while (summary.willOverflow())
    {
        if (isSummaryWithPageHeaderAndFooter)
        {
            fillPageFooter(JRExpression.EVALUATION_DEFAULT);
        }

        resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, true);
        resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
        resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
        scriptlet.callBeforePageInit();
        calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
        scriptlet.callAfterPageInit();

        addPage(false);

        if (isSummaryWithPageHeaderAndFooter)
        {
            fillPageHeader(JRExpression.EVALUATION_DEFAULT);
        }

        JRPrintBand printBand = summary.fill(pageHeight - bottomMargin - offsetY - (isSummaryWithPageHeaderAndFooter?pageFooter.getHeight():0));

        fillBand(printBand);
        offsetY += printBand.getHeight();
        isCrtRecordOnPage = true;
        isCrtRecordOnColumn = true;
    }

    resolveBandBoundElements(summary, JRExpression.EVALUATION_DEFAULT);

    if (isSummaryWithPageHeaderAndFooter)
    {
        if (offsetY > pageHeight - bottomMargin - lastPageFooter.getHeight())
        {
            fillPageFooter(JRExpression.EVALUATION_DEFAULT);

            resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, true);
            resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
            resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
            scriptlet.callBeforePageInit();
            calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
            scriptlet.callAfterPageInit();

            addPage(false);

            fillPageHeader(JRExpression.EVALUATION_DEFAULT);
        }

        if (lastPageFooter != missingFillBand)
        {
            setLastPageFooter(true);
        }

        fillPageFooter(JRExpression.EVALUATION_DEFAULT);
    }
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void fillNoData() throws JRException
{
    if (log.isDebugEnabled() && !noData.isEmpty())
    {
        log.debug("Fill " + fillerId + ": noData at " + offsetY);
    }

    noData.evaluatePrintWhenExpression(JRExpression.EVALUATION_DEFAULT);

    if (noData.isToPrint())
    {
        while (noData.getBreakHeight() > pageHeight - bottomMargin - offsetY)
        {
            addPage(false);
        }

        noData.evaluate(JRExpression.EVALUATION_DEFAULT);

        JRPrintBand printBand = noData.fill(pageHeight - bottomMargin - offsetY);

        if (noData.willOverflow() && noData.isSplitPrevented() && !noData.isSplitTypePreventInhibited())
        {
            resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, false);
            resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
            resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
            scriptlet.callBeforePageInit();
            calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
            scriptlet.callAfterPageInit();

            addPage(false);

            printBand = 
                noData.refill(
                    JRExpression.EVALUATION_DEFAULT,
                    pageHeight - bottomMargin - offsetY
                    );
        }

        fillBand(printBand);
        offsetY += printBand.getHeight();
        isCrtRecordOnPage = true;
        isCrtRecordOnColumn = true;

        while (noData.willOverflow())
        {
            resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, false);
            resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
            resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
            scriptlet.callBeforePageInit();
            calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
            scriptlet.callAfterPageInit();

            addPage(false);

            printBand = noData.fill(pageHeight - bottomMargin - offsetY);

            fillBand(printBand);
            offsetY += printBand.getHeight();
            isCrtRecordOnPage = true;
            isCrtRecordOnColumn = true;
        }
        resolveBandBoundElements(noData, JRExpression.EVALUATION_DEFAULT);
    }
}
项目:jasperreports    文件:JRCalculator.java   
/**
     *
     */
    private void incrementVariable(JRFillVariable variable, IncrementTypeEnum incrementType)
    {
        if (variable.getIncrementTypeValue() != IncrementTypeEnum.NONE)
        {
            boolean toIncrement = false;
            boolean toSetPreviousValue = false;
            switch (incrementType)
            {
                case REPORT :
                {
                    toIncrement = true;
                    break;
                }
                case PAGE :
                {
                    toIncrement = 
                        (
                        variable.getIncrementTypeValue() == IncrementTypeEnum.PAGE || 
                        variable.getIncrementTypeValue() == IncrementTypeEnum.COLUMN
                        );
                    toSetPreviousValue = toIncrement;
                    break;
                }
                case COLUMN :
                {
                    toIncrement = (variable.getIncrementTypeValue() == IncrementTypeEnum.COLUMN);
                    toSetPreviousValue = toIncrement;
                    break;
                }
                case GROUP :
                {
                    if (variable.getIncrementTypeValue() == IncrementTypeEnum.GROUP)
                    {
                        JRFillGroup group = (JRFillGroup)variable.getIncrementGroup();
                        toIncrement = group.hasChanged();
                    }
                    break;
                }
                case NONE :
                default :
                {
                }
            }

            if (toIncrement)
            {
                variable.setIncrementedValue(variable.getValue());
                if (toSetPreviousValue && !legacyBandEvaluationEnabled)
                {
                    variable.setPreviousIncrementedValue(variable.getValue());
                }
//              variable.setValue(
//                  evaluate(variable.getInitialValueExpression())
//                  );
//              variable.setInitialized(true);
            }
        }
        else
        {
            variable.setIncrementedValue(variable.getValue());
//          variable.setValue(
//              evaluate(variable.getExpression())
//              );
        }
    }
项目:jasperreports    文件:JRCalculator.java   
/**
 *
 */
private void incrementDataset(JRFillElementDataset elementDataset, IncrementTypeEnum incrementType)
{
    if (elementDataset.getIncrementTypeValue() != IncrementTypeEnum.NONE)
    {
        boolean toIncrement = false;
        switch (incrementType)
        {
            case REPORT :
            {
                toIncrement = true;
                break;
            }
            case PAGE :
            {
                toIncrement = 
                    (
                    elementDataset.getIncrementTypeValue() == IncrementTypeEnum.PAGE || 
                    elementDataset.getIncrementTypeValue() == IncrementTypeEnum.COLUMN
                    );
                break;
            }
            case COLUMN :
            {
                toIncrement = (elementDataset.getIncrementTypeValue() == IncrementTypeEnum.COLUMN);
                break;
            }
            case GROUP :
            {
                if (elementDataset.getIncrementTypeValue() == IncrementTypeEnum.GROUP)
                {
                    JRFillGroup group = (JRFillGroup)elementDataset.getIncrementGroup();
                    toIncrement = group.hasChanged();
                }
                break;
            }
            case NONE :
            default :
            {
            }
        }

        if (toIncrement)
        {
            elementDataset.increment();
        }
    }
}
项目:jasperreports    文件:JRFillDatasetRun.java   
protected void startData() throws JRScriptletException, JRException
{
    dataset.delegateScriptlet.callBeforeReportInit();
    dataset.calculator.initializeVariables(ResetTypeEnum.REPORT, IncrementTypeEnum.REPORT);
    dataset.delegateScriptlet.callAfterReportInit();
}
项目:jasperreports    文件:PartReportFiller.java   
protected void startReport() throws JRScriptletException, JRException
{
    scriptlet.callBeforeReportInit();
    calculator.initializeVariables(ResetTypeEnum.REPORT, IncrementTypeEnum.REPORT);
    scriptlet.callAfterReportInit();
}