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

项目: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    文件:JRDesignDataset.java   
private static JRDesignVariable createPageCountVariable()
{
    JRDesignExpression expression;
    JRDesignVariable variable;
    variable = new JRDesignVariable();
    variable.setName(JRVariable.PAGE_COUNT);
    variable.setValueClass(Integer.class);
    variable.setResetType(ResetTypeEnum.PAGE);
    variable.setCalculation(CalculationEnum.COUNT);
    variable.setSystemDefined(true);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(1)");
    variable.setExpression(expression);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(0)");
    variable.setInitialValueExpression(expression);
    return variable;
}
项目:jasperreports    文件:JRDesignDataset.java   
private static JRDesignVariable createColumnNumberVariable()
{
    JRDesignExpression expression;
    JRDesignVariable variable;
    variable = new JRDesignVariable();
    variable.setName(JRVariable.COLUMN_NUMBER);
    variable.setValueClass(Integer.class);
    //variable.setResetType(JRVariable.RESET_TYPE_COLUMN);
    variable.setResetType(ResetTypeEnum.PAGE);
    variable.setCalculation(CalculationEnum.SYSTEM);
    variable.setSystemDefined(true);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    //expression.setText("($V{COLUMN_NUMBER} != null)?(Integer.valueOf($V{COLUMN_NUMBER}.intValue() + 1)):(Integer.valueOf(1))");
    expression.setText("new java.lang.Integer(1)");
    variable.setInitialValueExpression(expression);
    return variable;
}
项目:jasperreports    文件:JRDesignDataset.java   
private static JRDesignVariable createPageNumberVariable()
{
    JRDesignVariable variable = new JRDesignVariable();
    variable.setName(JRVariable.PAGE_NUMBER);
    variable.setValueClass(Integer.class);
    //variable.setResetType(JRVariable.RESET_TYPE_PAGE);
    variable.setResetType(ResetTypeEnum.REPORT);
    variable.setCalculation(CalculationEnum.SYSTEM);
    variable.setSystemDefined(true);
    JRDesignExpression expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    //expression.setText("($V{PAGE_NUMBER} != null)?(Integer.valueOf($V{PAGE_NUMBER}.intValue() + 1)):(Integer.valueOf(1))");
    expression.setText("new java.lang.Integer(1)");
    variable.setInitialValueExpression(expression);
    return variable;
}
项目:jasperreports    文件:JRDesignDataset.java   
private static JRDesignVariable createColumnCountVariable()
{
    JRDesignVariable variable;
    JRDesignExpression expression;
    variable = new JRDesignVariable();
    variable.setName(JRVariable.COLUMN_COUNT);
    variable.setValueClass(Integer.class);
    variable.setResetType(ResetTypeEnum.COLUMN);
    variable.setCalculation(CalculationEnum.COUNT);
    variable.setSystemDefined(true);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(1)");
    variable.setExpression(expression);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(0)");
    variable.setInitialValueExpression(expression);
    return variable;
}
项目:jasperreports    文件:JRDesignDataset.java   
private static JRDesignVariable createReportCountVariable()
{
    JRDesignVariable variable = new JRDesignVariable();
    variable.setName(JRVariable.REPORT_COUNT);
    variable.setValueClass(Integer.class);
    variable.setResetType(ResetTypeEnum.REPORT);
    variable.setCalculation(CalculationEnum.COUNT);
    variable.setSystemDefined(true);
    JRDesignExpression expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(1)");
    variable.setExpression(expression);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(0)");
    variable.setInitialValueExpression(expression);
    return variable;
}
项目: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    文件:JRDistinctCountIncrementerFactory.java   
@Override
public Object increment(
    JRFillVariable variable, 
    Object expressionValue,
    AbstractValueProvider valueProvider
    )
{
    DistinctCountHolder holder  = (DistinctCountHolder)variable.getIncrementedValue();

    if (holder == null)
    {
        holder = lastHolder;
    }
    else
    {
        lastHolder = holder;
    }

    if (variable.getResetTypeValue() == ResetTypeEnum.REPORT || variable.isInitialized())
    {
        holder.addLastValue();
    }

    return new DistinctCountHolder(holder, expressionValue);
}
项目: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 updateResetTypeInformation(int selIndex) {     
    ResetTypeEnum selectedResType=ResetTypeEnum.getByName(comboResetType.getText());
    if (selectedResType==ResetTypeEnum.GROUP){
        if(fillGroupCombo(comboResetGroup)){
            // force the selection of the first group
            comboResetGroup.select(0);
            updateResetGroupInformation(0);
        }
    }
    else {
        datasetInstance.setResetGroup(null);
        this.comboResetGroup.setEnabled(false);
        this.comboResetGroup.setItems(new String[0]);
    }
    datasetInstance.setResetType(selectedResType);
}
项目:PDFReporter-Studio    文件:CreatePercentageCommand.java   
private JRDesignVariable createVariable(String name, String clazz, ResetTypeEnum rtype, JRGroup group)
        throws Exception {
    jrVariable = new JRDesignVariable();
    jrVariable.setCalculation(CalculationEnum.SUM);

    String vname = name + "_SUM";
    int i=0;
    while (jasperDesign.getVariablesMap().containsKey(vname))
    {
        i++;
        vname = name + "_" + i + "_SUM";
    }

    jrVariable.setName(vname);
    jrVariable.setResetType(rtype);
    if (rtype.equals(ResetTypeEnum.GROUP))
        jrVariable.setResetGroup(group);

    jrVariable.setValueClassName(clazz);

    JRDesignExpression jre = new JRDesignExpression();
    jre.setText("$F{" + name + "}");
    jrVariable.setExpression(jre);

    return jrVariable;
}
项目:PDFReporter-Studio    文件:PercentagePage.java   
@Override
public void dispose() {
    int sel = rtypeList.getSelectionIndex();
    switch (sel) {
    case 0:
        rtype = ResetTypeEnum.REPORT;
        break;
    case 1:
        rtype = ResetTypeEnum.COLUMN;
        break;
    case 2:
        rtype = ResetTypeEnum.PAGE;
        break;
    default:
        if (sel > 2) {
            String groupname = rtypes.get(sel).substring(GROUP2.length());
            group = jDesign.getGroupsMap().get(groupname);
        }
    }

    StructuredSelection s = (StructuredSelection) fieldsView.getSelection();
    if (!s.isEmpty())
        field = (JRCloneable) s.getFirstElement();

    super.dispose();
}
项目: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(ResetTypeEnum.REPORT, I18n.getString("VariableNode.Property.Report")));
        l.add(new Tag(ResetTypeEnum.COLUMN, I18n.getString("VariableNode.Property.Column")));
        l.add(new Tag(ResetTypeEnum.GROUP, I18n.getString("VariableNode.Property.Group")));
        l.add(new Tag(ResetTypeEnum.NONE, I18n.getString("VariableNode.Property.None")));
        l.add(new Tag(ResetTypeEnum.PAGE, I18n.getString("VariableNode.Property.Page")));

        editor = new ComboBoxPropertyEditor(false, l);
    }
    return editor;
}
项目:dynamicreports-jasper    文件:ConstantTransform.java   
public static ResetTypeEnum variableResetType(ResetType resetType) {
    if (resetType == null) {
        return ResetTypeEnum.NONE;
    }

    switch (resetType) {
    case NONE:
        return ResetTypeEnum.NONE;
    case REPORT:
        return ResetTypeEnum.REPORT;
    case PAGE:
        return ResetTypeEnum.PAGE;
    case COLUMN:
        return ResetTypeEnum.COLUMN;
    case GROUP:
        return ResetTypeEnum.GROUP;
    default:
        throw new JasperDesignException("Variable reset type " + resetType.name() + " not supported");
    }
}
项目:jasperreports    文件:JRDesignValueDataset.java   
/**
 * Construct a new dataset that is a copy of an existing one.
 *
 * @param dataset the dataset to copy
 */
public JRDesignValueDataset(JRChartDataset dataset)
{
    super(dataset);

    if (dataset == null)
    {
        // value datasets hold a single value hence a reset type other
        // than None doesn't make sense
        // setting None as default reset type so that it doesn't need to be
        // explicitly set in order for the dataset to work as expected
        this.resetTypeValue = ResetTypeEnum.NONE;
    }
}
项目: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    文件:JRXmlWriter.java   
/**
 * Writes the description of a value dataset to the output stream.
 * @param dataset the value dataset to persist
 */

public void writeValueDataset(JRValueDataset dataset) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_valueDataset, getNamespace());

    // default reset type of value datasets is None
    writeElementDataset(dataset, ResetTypeEnum.NONE, true);

    writeExpression(JRXmlConstants.ELEMENT_valueExpression, dataset.getValueExpression(), false);
    writer.closeElement();
}
项目: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 setResetType(ResetTypeEnum resetTypeValue)
{
    Object old = this.resetTypeValue;
    this.resetTypeValue = resetTypeValue;
    getEventSupport().firePropertyChange(PROPERTY_RESET_TYPE, old, this.resetTypeValue);
}
项目:jasperreports    文件:JRDesignElementDataset.java   
/**
 *
 */
public void setResetType(ResetTypeEnum resetTypeValue)
{
    Object old = this.resetTypeValue;
    this.resetTypeValue = resetTypeValue;
    getEventSupport().firePropertyChange(PROPERTY_RESET_TYPE, old, this.resetTypeValue);
}
项目:jasperreports    文件:JRDesignDataset.java   
private static JRDesignVariable createMasterCurrentPageVariable()
{
    JRDesignVariable variable = new JRDesignVariable();
    variable.setName(JRVariable.MASTER_CURRENT_PAGE);
    variable.setValueClass(Integer.class);
    variable.setResetType(ResetTypeEnum.REPORT);
    variable.setCalculation(CalculationEnum.SYSTEM);
    variable.setSystemDefined(true);
    return variable;
}
项目:jasperreports    文件:JRDesignDataset.java   
private static JRDesignVariable createMasterTotalPagesVariable()
{
    JRDesignVariable variable = new JRDesignVariable();
    variable.setName(JRVariable.MASTER_TOTAL_PAGES);
    variable.setValueClass(Integer.class);
    variable.setResetType(ResetTypeEnum.REPORT);
    variable.setCalculation(CalculationEnum.SYSTEM);
    variable.setSystemDefined(true);
    return variable;
}
项目:jasperreports    文件:JRDesignDataset.java   
/**
 * Inserts a group at the specified position into the dataset.
 * @param index the group position
 * @param group the group to insert
 * @throws JRException
 * @see net.sf.jasperreports.engine.JRDataset#getGroups()
 */
public void addGroup(int index, JRDesignGroup group) throws JRException
{
    if (groupsMap.containsKey(group.getName()))
    {
        throw 
            new JRException(
                EXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP,
                new Object[]{group.getName()});
    }

    JRDesignVariable countVariable = new JRDesignVariable();
    countVariable.setName(group.getName() + "_COUNT");
    countVariable.setValueClass(Integer.class);
    countVariable.setResetType(ResetTypeEnum.GROUP);
    countVariable.setResetGroup(group);
    countVariable.setCalculation(CalculationEnum.COUNT);
    countVariable.setSystemDefined(true);
    JRDesignExpression expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(1)");
    countVariable.setExpression(expression);
    expression = new JRDesignExpression();
    //expression.setValueClass(Integer.class);
    expression.setText("new java.lang.Integer(0)");
    countVariable.setInitialValueExpression(expression);

    addVariable(countVariable, true);

    group.setCountVariable(countVariable);

    groupsList.add(index, group);
    groupsMap.put(group.getName(), group);

    getEventSupport().fireCollectionElementAddedEvent(PROPERTY_GROUPS, group, index);
}
项目: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 fillResetGroup() {
    JRDataset jrds = getJRdataset(eDataset);
    List<String> lsRsts = new ArrayList<String>();
    lsRsts.add(ResetTypeEnum.REPORT.getName());
    lsRsts.add(ResetTypeEnum.COLUMN.getName());
    lsRsts.add(ResetTypeEnum.PAGE.getName());

    for (JRGroup gr : jrds.getGroups())
        lsRsts.add(GROUPPREFIX + gr.getName());
    lsRsts.add(ResetTypeEnum.NONE.getName());
    cbReset.setItems(lsRsts.toArray(new String[lsRsts.size()]));

    ResetTypeEnum rst = eDataset.getResetTypeValue();
    String grname = eDataset.getResetGroup() != null ? eDataset
            .getResetGroup().getName() : null;
    for (int i = 0; i < lsRsts.size(); i++) {
        String rsttype = lsRsts.get(i);
        if (rst.equals(ResetTypeEnum.GROUP)) {
            if (rsttype.startsWith(GROUPPREFIX)
                    && grname
                            .equals(rsttype.substring(GROUPPREFIX.length()))) {
                cbReset.select(i);
                break;
            }
        } else if (rsttype.equals(rst.getName())) {
            cbReset.select(i);
            break;
        }
    }
}
项目:PDFReporter-Studio    文件:CreateCrosstabElement4ObjectCommand.java   
@Override
protected void createObject() {
    try {
        Tag tag = Tag.getExpression(child);

        var = Tag.createVariable(tag, ResetTypeEnum.REPORT, null, jDataset);
        srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name),
                tag.classname);

        jrElement = srcNode.getValue();
        super.createObject();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:PDFReporter-Studio    文件:CreateListElement4ObjectCommand.java   
@Override
protected void createObject() {
    try {
        Tag tag = Tag.getExpression(child);

        var = Tag.createVariable(tag, ResetTypeEnum.REPORT, null, jDataset);
        srcNode = Tag.createTextField(tag.txt.replaceAll("%", tag.name),
                tag.classname);

        jrElement = srcNode.getValue();
        super.createObject();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目: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 jComboBoxResetTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxResetTypeActionPerformed


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

        ResetTypeEnum val = (ResetTypeEnum)((Tag)jComboBoxResetType.getSelectedItem()).getValue();

        if (val == ResetTypeEnum.GROUP) {
            List groups = getComponentDataset().getGroupsList();



            if (groups.isEmpty()) {
                setInit(true);
                Misc.setComboboxSelectedTagValue(jComboBoxResetType, getDesignDataset().getResetTypeValue());
                SwingUtilities.invokeLater(new Runnable(){
                    public void run() {
                        JOptionPane.showMessageDialog(jComboBoxResetGroup, I18n.getString("ChartPropertiesDialog.MessageDialog.NoGroupsAvail"));
                    }
                });
                setInit(false);
                return;
            } else {
                getDesignDataset().setResetType(val);
                jComboBoxResetGroup.setEnabled(true);
                jComboBoxResetGroup.setSelectedIndex(0);
            }
        } else {
            getDesignDataset().setResetType(val);
            getDesignDataset().setResetGroup(null);
            jComboBoxResetGroup.setEnabled(false);
            jComboBoxResetGroup.setSelectedItem(null);
        }
}