/** * */ public JRChartAxis removeAxis(JRChartAxis axis) { if (axis != null) { int idx = axes.indexOf(axis); if (idx >= 0) { axes.remove(idx); ((JRDesignChart) getChart()).setDataset(axis.getChart().getDataset()); getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_AXES, axis, idx); } } return axis; }
/** * Set the chart that contains the dataset and plot to use for this * axis. The plot is used to figure out how to render the dataset (ie * as a line or bar chart) when adding it to the multiple axis chart. * * @param chart the chart that contains the dataset and plot for this axis */ public void setChart(JRDesignChart chart) { // Override the chart elements that we are going to ignore, as they // are supposed to be controlled by the multi chart's settings. chart.setBackcolor(parentChart.getBackcolor()); chart.setShowLegend(parentChart.getShowLegend()); chart.setTitleExpression(parentChart.getTitleExpression()); chart.setTitleFont(parentChart.getTitleFont()); chart.setTitlePosition(parentChart.getTitlePositionValue()); chart.setTitleColor(parentChart.getTitleColor()); chart.setSubtitleExpression(parentChart.getSubtitleExpression()); chart.setSubtitleFont(parentChart.getSubtitleFont()); chart.setSubtitleColor(parentChart.getSubtitleColor()); chart.setLegendColor(parentChart.getLegendColor()); chart.setLegendBackgroundColor(parentChart.getLegendBackgroundColor()); chart.setLegendFont(parentChart.getLegendFont()); chart.setLegendPosition(parentChart.getLegendPositionValue()); chart.setRenderType(parentChart.getRenderType()); chart.setTheme(parentChart.getTheme()); Object old = this.chart; this.chart = chart; getEventSupport().firePropertyChange(PROPERTY_CHART, old, this.chart); }
@Override public Object createObject(Attributes atts) { JRDesignChart chart = (JRDesignChart) digester.peek(); EdgeEnum position = EdgeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_position)); if (position != null) { chart.setTitlePosition(position); } Color color = JRColorUtil.getColor(atts.getValue(JRXmlConstants.ATTRIBUTE_color), Color.black); if (color != null) { chart.setTitleColor(color); } return chart; }
/** * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); parent.setLayout(new GridLayout(3, false)); createWidget4Property(parent, JRDesignChart.PROPERTY_CUSTOMIZER_CLASS); GridData gd = new GridData(); gd.horizontalSpan = 2; createWidget4Property(parent, JRBaseChart.PROPERTY_RENDER_TYPE) .getControl().setLayoutData(gd); gd = new GridData(); gd.horizontalSpan = 2; createWidget4Property(parent, JRBaseChart.PROPERTY_THEME).getControl() .setLayoutData(gd); IPropertyDescriptor pd = getPropertyDesriptor(JRDesignChart.PROPERTY_EVALUATION_TIME); IPropertyDescriptor gpd = getPropertyDesriptor(JRDesignChart.PROPERTY_EVALUATION_GROUP); getWidgetFactory().createCLabel(parent, pd.getDisplayName()); widgets.put(pd.getId(), new SPEvaluationTime(parent, this, pd, gpd)); }
/** * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); Composite group = getWidgetFactory().createSection(parent, com.jaspersoft.studio.messages.Messages.SubTitleSection_Subtitle_Label, true, 2); section = (ExpandableComposite)group.getParent(); getWidgetFactory().createCLabel(group, com.jaspersoft.studio.messages.Messages.SubTitleSection_Expression_Label); createWidget4Property(group, JRDesignChart.PROPERTY_SUBTITLE_EXPRESSION, false); getWidgetFactory().createCLabel(group, com.jaspersoft.studio.messages.Messages.SubTitleSection_Color_Label); createWidget4Property(group, JRBaseChart.PROPERTY_SUBTITLE_COLOR, false); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; createWidget4Property(group, JRDesignChart.PROPERTY_SUBTITLE_FONT, false).getControl().setLayoutData(gd); }
@Override public void trasnferProperties(JRElement target){ super.trasnferProperties(target); JRDesignChart jrSource = (JRDesignChart) getValue(); if (jrSource != null){ JRDesignChart jrTarget = (JRDesignChart)target; jrTarget.setTitleFont(getFontClone(jrSource.getTitleFont())); jrTarget.setSubtitleFont(getFontClone(jrSource.getSubtitleFont())); jrTarget.setLegendFont(getFontClone(jrSource.getLegendFont())); jrTarget.setTitlePosition(jrSource.getTitlePositionValue()); jrTarget.setLegendPosition(jrSource.getLegendPositionValue()); jrTarget.setShowLegend(jrSource.getShowLegend()); jrTarget.setRenderType(jrSource.getRenderType()); jrTarget.setTitleColor(getColorClone(jrSource.getOwnTitleColor())); jrTarget.setSubtitleColor(getColorClone(jrSource.getOwnSubtitleColor())); jrTarget.setLegendColor(getColorClone(jrSource.getOwnLegendColor())); jrTarget.setLegendBackgroundColor(getColorClone(jrSource.getOwnLegendBackgroundColor())); } }
@Override public void execute() { if (newChart == null) { JRDesignChart clone = (JRDesignChart) oldChart.clone(); ChartWizard wizard = new ChartWizard(new MChart(null, clone, -1), (JRDesignElementDataset) clone.getDataset(), true); wizard.init(jConfig); wizard.setExpressionContext(ModelUtils.getElementExpressionContext(oldChart, originalNode)); WizardDialog dialog = new WizardDialog(Display.getDefault() .getActiveShell(), wizard); dialog.create(); if (dialog.open() == Dialog.OK) { this.newChart = (JRDesignChart) wizard.getChart().getValue(); } else return; } switchCharts(oldChart, newChart); }
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; }
/** * */ public void visitChart(JRChart chart) { if (chart.getChartType() == JRChart.CHART_TYPE_MULTI_AXIS) { node = new MultiAxisChartElementNode(jasperDesign, (JRDesignChart)chart, doLkp); } else { node = new ElementNode(jasperDesign, (JRDesignChart)chart,doLkp); } node.setIconBaseWithExtension(ICON_CHART); ((JRBaseChartPlot)((JRDesignChart)chart).getPlot()).getEventSupport() .addPropertyChangeListener((PropertyChangeListener)node); }
protected void performAction(org.openide.nodes.Node[] activatedNodes) { JRDesignChart theChart = (JRDesignChart)((ElementNode)activatedNodes[0]).getElement(); // Show a window with all the available charts... ChartSelectionJDialog cd = new ChartSelectionJDialog(Misc.getMainFrame(), true); cd.setMultiAxisMode(true); cd.setJasperDesign( ((ElementNode)activatedNodes[0]).getJasperDesign()); cd.setVisible(true); if (cd.getDialogResult() == JOptionPane.OK_OPTION) { JRDesignChart designChart = cd.getChart(); JRDesignChartAxis axis = new JRDesignChartAxis(theChart); axis.setChart(designChart); ((JRDesignMultiAxisPlot)theChart.getPlot()).setChart(theChart); ((JRDesignMultiAxisPlot)theChart.getPlot()).addAxis(axis); } }
@Override public void destroy() throws IOException { super.destroy(); // Get the parent node... Node node = getParentNode(); if (node instanceof MultiAxisChartElementNode) { JRDesignChart element = (JRDesignChart) ((MultiAxisChartElementNode)node).getElement(); JRDesignMultiAxisPlot plot = (JRDesignMultiAxisPlot)element.getPlot(); if (plot.getAxes().size() > 1) { plot.getAxes().remove(chartAxis); JRDesignChartAxis axis0 = (JRDesignChartAxis)plot.getAxes().get(0); ((JRDesignChart)plot.getChart()).setDataset( axis0.getChart().getDataset()); plot.getEventSupport().firePropertyChange( JRDesignMultiAxisPlot.PROPERTY_AXES, null, plot.getAxes()); } } }
public void dropFieldElementAt(Scene theScene, JasperDesign jasperDesign, JRDesignChart element, Point location) { if (theScene instanceof ReportObjectScene) { Point p = theScene.convertViewToScene( location ); // find the band... JRDesignBand b = ModelUtils.getBandAt(jasperDesign, p); int yLocation = ModelUtils.getBandLocation(b, jasperDesign); Point pLocationInBand = new Point(p.x - jasperDesign.getLeftMargin(), p.y - yLocation); if (b != null) { // if the band is not a detail, propose to aggregate the value... if (b.getOrigin().getBandTypeValue() == BandTypeEnum.TITLE) { element.setEvaluationTime( EvaluationTimeEnum.REPORT); } } } super.dropElementAt(theScene, jasperDesign, element, location); }
@Override public void collect(JRChart element) { JRDesignChart chart = (JRDesignChart)element; super.collect(element); chart.getDataset().collectExpressions(this); chart.getPlot().collectExpressions(this); JRDatasetRun datasetRun = chart.getDataset().getDatasetRun(); if (datasetRun != null && datasetRun.getDatasetName() != null) { JRExpressionCollector collector = getCollector( (JRDataset)jasperDesign.getDatasetMap().get(datasetRun.getDatasetName())); extraExpressions.addAll(collector.getExpressions()); } System.out.flush(); }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_STACKEDBAR); return chart; }
@Override public Object createObject( Attributes atts ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_XYAREA); return chart; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_SCATTER); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_HIGHLOW); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_THERMOMETER); return chart; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_XYLINE); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_XYBAR); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_STACKEDAREA); return chart; }
/** * Creates an Area chart which is a combination of a Pie dataset and a Pie plot. * @return an instance of {@link net.sf.jasperreports.engine.design.JRDesignChart JRDesignChart} * representing the Area chart */ @Override public Object createObject( Attributes atts ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart areaChart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_AREA); return areaChart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_PIE); return chart; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_BAR3D); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_CANDLESTICK); return chart; }
@Override public Object createObject(Attributes atts) throws JRException { JRDesignChart chart = (JRDesignChart)digester.peek(); JRDesignMultiAxisPlot multiAxisPlot = (JRDesignMultiAxisPlot)chart.getPlot(); multiAxisPlot.setChart(chart); return multiAxisPlot; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_TIMESERIES ); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_PIE3D); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_MULTI_AXIS); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_BAR); return chart; }
@Override public Object createObject(Attributes atts) throws JRException { JRDesignChart parentChart = (JRDesignChart)digester.peek(1); JRDesignChartAxis axis = new JRDesignChartAxis(parentChart); AxisPositionEnum position = AxisPositionEnum.getByName(atts.getValue(ATTRIBUTE_position)); if (position != null) { axis.setPosition(position); } return axis; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_GANTT); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_METER); return chart; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_STACKEDBAR3D); return chart; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_LINE); return chart; }
@Override public Object createObject( Attributes attrs ){ JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignChart chart = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_BUBBLE); return chart; }
/** * Adds an axis to the plot. The axis contains the complete information on * the data and rendering to use as well as where to draw the axis. * * @param axis the axis to add to the plot */ public void addAxis(JRChartAxis axis) { axes.add(axis); if (axes.size() == 1) { ((JRDesignChart) getChart()).setDataset(axis.getChart().getDataset()); } getEventSupport().fireCollectionElementAddedEvent(PROPERTY_AXES, axis, axes.size() - 1); }
/** * Adds an axis to the plot. The axis contains the complete information on * the data and rendering to use as well as where to draw the axis. * * @param axis the axis to add to the plot */ public void addAxis(int index, JRChartAxis axis) { axes.add(index, axis); if (axes.size() == 1) { ((JRDesignChart) getChart()).setDataset(axis.getChart().getDataset()); } getEventSupport().fireCollectionElementAddedEvent(PROPERTY_AXES, axis, index); }
/** * Removes all the axes from the plot. */ public void clearAxes() { List<JRChartAxis> tmpList = new ArrayList<JRChartAxis>(axes); for(Iterator<JRChartAxis> it = tmpList.iterator(); it.hasNext();){ removeAxis(it.next()); } ((JRDesignChart) getChart()).setDataset(null); }
/** * Sets the chart object that this plot belongs to. The chart object defines * all the information about the multiple axis chart. * * @param chart the chart that this plot belongs to */ public void setChart(JRDesignChart chart) { Object old = this.chart; this.chart = chart; getEventSupport().firePropertyChange(PROPERTY_CHART, old, this.chart); }