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

项目:PDFReporter-Studio    文件:ChartComponentFactory.java   
public ANode createNode(ANode parent, Object jrObject, int newIndex) {
    if (jrObject instanceof JRDesignChart)
        return new MChart(parent, (JRDesignChart) jrObject, newIndex);
    if (jrObject instanceof JRDesignChartAxis) {
        MChartAxes mChartAxes = new MChartAxes(parent, (JRChartAxis) jrObject, newIndex);
        return mChartAxes;
    }
    if (jrObject instanceof JRDesignChartDataset)
        return ChartDatasetFactory.getChartDataset(parent, (JRChartDataset) jrObject, newIndex);
    if (jrObject instanceof JRDesignCategorySeries)
        return new MCategorySeries(parent, (JRDesignCategorySeries) jrObject, newIndex);
    if (jrObject instanceof JRDesignGanttSeries)
        return new MGanttSeries(parent, (JRDesignGanttSeries) jrObject, newIndex);
    if (jrObject instanceof JRDesignPieSeries)
        return new MPieSeries(parent, (JRDesignPieSeries) jrObject, newIndex);
    if (jrObject instanceof JRDesignTimePeriodSeries)
        return new MTimePeriodSeries(parent, (JRDesignTimePeriodSeries) jrObject, newIndex);
    if (jrObject instanceof JRDesignTimeSeries)
        return new MTimeSeries(parent, (JRDesignTimeSeries) jrObject, newIndex);
    if (jrObject instanceof JRDesignXySeries)
        return new MXYSeries(parent, (JRDesignXySeries) jrObject, newIndex);
    if (jrObject instanceof JRDesignXyzSeries)
        return new MXYZSeries(parent, (JRDesignXyzSeries) jrObject, newIndex);
    return null;
}
项目:ireport-fork    文件:ChartPropertiesDialog.java   
public void jRTextExpressionAreaFilterExpressionTextChanged() {
    if (this.isInit()) return; 
    if (currentSelectedChartElement != null)
    {
        JRDesignExpression exp = null;
        if (jRTextExpressionAreaFilterExpression.getText().trim().length() > 0)
        {
            exp = new JRDesignExpression();
            exp.setValueClassName("java.lang.Boolean");//NOI18N
            exp.setText(jRTextExpressionAreaFilterExpression.getText());
        }

        ((JRDesignChartDataset) currentSelectedChartElement.getDataset()).setIncrementWhenExpression(exp);
        notifyChange();
    }
}
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jComboBoxIncrementGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxIncrementGroupActionPerformed
    if (isInit() || currentSelectedChartElement == null) return;
    String name = (String)jComboBoxIncrementGroup.getSelectedItem();

    if (name != null && name.trim().length() != 0)
    {
        ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setIncrementGroup( (JRGroup)getChartDataset().getGroupsMap().get(name));
    }
    else
    {
        ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setIncrementGroup(null);
    }

    System.out.println("Increment group set to: " + ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).getIncrementGroup());
    System.out.flush();

}
项目:ireport-fork    文件:ModelUtils.java   
public static JRDesignDataset getDatasetFromChartDataset(JRDesignChartDataset dataset, JasperDesign jd)
{
    JRDesignDataset ds = (JRDesignDataset)jd.getMainDataset();
    if (dataset.getDatasetRun() != null &&
        dataset.getDatasetRun().getDatasetName() != null)
    {
        ds = (JRDesignDataset)jd.getDatasetMap().get( dataset.getDatasetRun().getDatasetName() );
    }     

    return ds;
}
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jButtonPasteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPasteActionPerformed

    if (currentSelectedChartElement == null) return;
    if (IReportManager.getInstance().getChartDatasetClipBoard() == null) return;

    JRDesignChartDataset theDataset = IReportManager.getInstance().getChartDatasetClipBoard();
    try {
        currentSelectedChartElement.setDataset( (JRDesignChartDataset)theDataset.clone() );
        setChartElement(currentSelectedChartElement, getJasperDesign());
    } catch (Exception ex) { }

}
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jButtonCopyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCopyActionPerformed

        if (currentSelectedChartElement == null) return;
        try {
            IReportManager.getInstance().setChartDatasetClipBoard((JRDesignChartDataset)currentSelectedChartElement.getDataset().clone() );
            jButtonPaste.setEnabled(true);
        } catch (Exception ex) { }
    }
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jComboBoxResetGroupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxResetGroupActionPerformed

        if (isInit() || currentSelectedChartElement == null) return;
        String name = (String)jComboBoxResetGroup.getSelectedItem();

        if (name != null && name.trim().length() != 0)
        {
            ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setResetGroup( (JRGroup)getChartDataset().getGroupsMap().get(name));
        }
        else
        {
            ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setResetGroup(null);
        }
    }
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jComboBoxResetTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxResetTypeActionPerformed


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

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

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

            if (groups.isEmpty())
            {
                setInit(true);
                Misc.setComboboxSelectedTagValue(jComboBoxResetType, currentSelectedChartElement.getDataset().getResetTypeValue());
                SwingUtilities.invokeLater(new Runnable(){
                    public void run()
                    {
                        JOptionPane.showMessageDialog(jComboBoxResetGroup, I18n.getString("ChartPropertiesDialog.MessageDialog.NoGroupsAvail"));
                    }
                });
                setInit(false);
                return;
            }
            else
            {
                ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setResetType(val);
                jComboBoxResetGroup.setEnabled(true);
                jComboBoxResetGroup.setSelectedIndex(0);
            }
        }
        else
        {
           ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setResetType(val);
           ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setResetGroup(null);
           jComboBoxResetGroup.setEnabled(false);
           jComboBoxResetGroup.setSelectedItem(null);
        }
    }
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jComboBoxIncrementTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxIncrementTypeActionPerformed


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

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

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

        if (groups.isEmpty())
        {
            setInit(true);
            Misc.setComboboxSelectedTagValue(jComboBoxIncrementType, currentSelectedChartElement.getDataset().getIncrementTypeValue());
            SwingUtilities.invokeLater(new Runnable(){
                public void run()
                {
                    JOptionPane.showMessageDialog(jComboBoxIncrementGroup, I18n.getString("ChartPropertiesDialog.MessageDialog.NoGroupsAvail"));
                }
            });
            setInit(false);
            return;
        }
        else
        {
            ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setIncrementType(val);
            jComboBoxIncrementGroup.setEnabled(true);
            jComboBoxIncrementGroup.setSelectedIndex(0);
            jComboBoxIncrementGroupActionPerformed(null);
        }
    }
    else
    {
       ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setIncrementType(val);
       ((JRDesignChartDataset)currentSelectedChartElement.getDataset()).setIncrementGroup(null);
       jComboBoxIncrementGroup.setEnabled(false);
       jComboBoxIncrementGroup.setSelectedItem(null);
    }

}
项目:ireport-fork    文件:IReportManager.java   
/**
 * Copy of a dataset
 */
public JRDesignChartDataset getChartDatasetClipBoard() {
    return chartDatasetClipBoard;
}
项目:ireport-fork    文件:IReportManager.java   
/**
 * Set a JRDesignChartDataset to be used with another chart.
 */
public void setChartDatasetClipBoard(JRDesignChartDataset chartDatasetClipBoard) {
    this.chartDatasetClipBoard = chartDatasetClipBoard;
}
项目:ireport-fork    文件:ChartPropertiesDialog.java   
private void jComboBoxTypeOfDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTypeOfDataActionPerformed

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

        if (jComboBoxTypeOfData.getSelectedItem() != null)
        {
            String typeOfDataset = ((Tag)jComboBoxTypeOfData.getSelectedItem()).getValue()+"";//NOI18N
            if (currentSelectedChartElement.getDataset().getClass().getName().equals(typeOfDataset)) return;

            try {
                jPanelDataDefinition.removeAll();

                JRChartDataset currentDataset =  currentSelectedChartElement.getDataset();

                Constructor constructor = this.getClass().forName( typeOfDataset ).getConstructor(new Class[]{JRChartDataset.class});

                JRDesignChartDataset dataset = (JRDesignChartDataset)constructor.newInstance(currentDataset);
                currentSelectedChartElement.setDataset( dataset) ;
                setDatasetPanel(currentSelectedChartElement.getDataset());

            } catch (Exception ex)
            {
              ex.printStackTrace();;   
            }


            this.notifyChange();
        }

    }