@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); }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignHighLowDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignHighLowDataset) eDataset; series.bindObject(dataset, "SeriesExpression"); //$NON-NLS-1$ volume.bindObject(dataset, "VolumeExpression"); //$NON-NLS-1$ date.bindObject(dataset, "DateExpression"); //$NON-NLS-1$ close.bindObject(dataset, "CloseExpression"); //$NON-NLS-1$ open.bindObject(dataset, "OpenExpression"); //$NON-NLS-1$ high.bindObject(dataset, "HighExpression"); //$NON-NLS-1$ low.bindObject(dataset, "LowExpression"); //$NON-NLS-1$ }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignPieDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignPieDataset) eDataset; setSeries(0); if (dataset.getMinPercentage() != null) minSlice.setText(NumberFormat.getInstance().format( dataset.getMinPercentage())); else minSlice.setText(""); maxSlice.setSelection(dataset.getMaxCount() != null ? dataset .getMaxCount().intValue() : 0); }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignTimeSeriesDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignTimeSeriesDataset) eDataset; setSeries(0); TimePeriodEnum tpe = TimePeriodEnum.getByValue(dataset.getTimePeriod()); if (tpe == null) { timePeriodCombo.select(5); } else { TimePeriodEnum[] tpevalues = TimePeriodEnum.values(); for (int i = 0; i < tpevalues.length; i++) { if (tpe.equals(tpevalues[i])) { timePeriodCombo.select(i + 1); break; } } } }
@Override public JRDesignComponentElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement designMap = new JRDesignComponentElement(); StandardMapComponent component = new StandardMapComponent(); JRDesignExpression exp1 = new JRDesignExpression(); exp1.setText(MapDesignConverter.DEFAULT_LATITUDE.toString() + "f"); //$NON-NLS-1$ JRDesignExpression exp2 = new JRDesignExpression(); exp2.setText(MapDesignConverter.DEFAULT_LONGITUDE.toString() + "f"); //$NON-NLS-1$ component.setLatitudeExpression(exp1); component.setLongitudeExpression(exp2); JRDesignExpression exp3 = new JRDesignExpression(); exp3.setText(String.valueOf(MapComponent.DEFAULT_ZOOM)); component.setZoomExpression(exp3); designMap.setComponent(component); designMap.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components", "c", //$NON-NLS-1$ //$NON-NLS-2$ "map")); //$NON-NLS-1$ StandardItemData markerData = safeGetMarkerData(component, null); markerData.setDataset(new JRDesignElementDataset()); DefaultManager.INSTANCE.applyDefault(this.getClass(), designMap); return designMap; }
@Override public void setPropertyValue(Object id, Object value) { StandardListComponent jrList = getList(); if (id.equals(StandardListComponent.PROPERTY_IGNORE_WIDTH)) jrList.setIgnoreWidth((Boolean) value); else if (id.equals(StandardListComponent.PROPERTY_PRINT_ORDER)) jrList.setPrintOrderValue((PrintOrderEnum) printOrderD.getEnumValue(value)); else if (id.equals(PREFIX + DesignListContents.PROPERTY_HEIGHT)) ((DesignListContents) jrList.getContents()).setHeight((Integer) value); else if (id.equals(PREFIX + DesignListContents.PROPERTY_WIDTH)) ((DesignListContents) jrList.getContents()).setWidth((Integer) value); else if (id.equals(PREFIX + JRDesignElementDataset.PROPERTY_DATASET_RUN)) { if (value == null) { jrList.setDatasetRun(null); } else { MDatasetRun mdr = (MDatasetRun) value; JRDesignDatasetRun dr = (JRDesignDatasetRun) mdr.getValue(); if (dr.getDatasetName() != null) jrList.setDatasetRun(dr); else jrList.setDatasetRun(null); } } else super.setPropertyValue(id, value); }
@Override public void execute() { if (newChart == null) { JRDesignComponentElement clone = (JRDesignComponentElement) oldChart .clone(); SpiderChartComponent scc = (SpiderChartComponent) clone .getComponent(); // TODO SHOULD TAKE THIS ONE FROM EDITOR ChartWizard wizard = new ChartWizard(new MSpiderChart(null, clone, -1), (JRDesignElementDataset) scc.getDataset()); 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 = (JRDesignComponentElement) wizard.getChart() .getValue(); } else return; } switchCharts(oldChart, newChart); }
/** * @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(2, false)); IPropertyDescriptor pd = getPropertyDesriptor(JRDesignElementDataset.PROPERTY_INCREMENT_TYPE); IPropertyDescriptor gpd = getPropertyDesriptor(JRDesignElementDataset.PROPERTY_INCREMENT_GROUP); getWidgetFactory().createCLabel(parent, pd.getDisplayName()); widgets.put(pd.getId(), new SPIncrementType(parent, this, pd, gpd)); createWidget4Property(parent, JRDesignElementDataset.PROPERTY_INCREMENT_WHEN_EXPRESSION); pd = getPropertyDesriptor(JRDesignElementDataset.PROPERTY_RESET_TYPE); gpd = getPropertyDesriptor(JRDesignElementDataset.PROPERTY_RESET_GROUP); getWidgetFactory().createCLabel(parent, pd.getDisplayName()); widgets.put(pd.getId(), new SPResetType(parent, this, pd, gpd)); Composite group = getWidgetFactory().createSection(parent, "Dataset Run", true, 2, 2); datasetRunSection = (ExpandableComposite)group.getParent(); createWidget4Property(group, JRDesignElementDataset.PROPERTY_DATASET_RUN); }
/** * Return the dataset nearest to this element * * @param node the actual node * @return the dataset nearest to this element or null if it can't be found */ private JRDataset getElementDataset(ANode node){ if (node instanceof APropertyNode){ APropertyNode pnode = (APropertyNode)node; MDatasetRun mdataset = (MDatasetRun) pnode.getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN); if (mdataset != null) { JRDesignDatasetRun datasetRun = mdataset.getValue(); if (datasetRun != null) { String dsname = datasetRun.getDatasetName(); return getJasperDesign().getDatasetMap().get(dsname); } } } ANode parent = node.getParent(); if (parent != null){ return getElementDataset(parent); } else if (getJasperDesign() != null){ return getJasperDesign().getMainDataset(); } else { return null; } }
/** * Get the dataset form the component... * It returns a standard JRDesignElementDataset and creates it in case it does not exist and create is true... * * @return */ public JRDesignElementDataset getDesignDataset(boolean create) { if (this.getCurrentSelectedComponent() != null) { StandardItemData itemData = getMarkerData(create); if (itemData == null) { return null; } if (itemData.getDataset() == null) { itemData.setDataset( new JRDesignElementDataset() ); } return (JRDesignElementDataset)this.getCurrentSelectedComponent().getMarkerData().getDataset(); } return null; }
@Override public Object createObject(Attributes atts) { JRDesignElementDataset dataset = getDataset(); setDatasetAtts(atts, dataset); return dataset; }
/** * */ public static ItemData getItemData(MarkerDataset markerDataset) { if (markerDataset != null) { StandardItemData itemData = new StandardItemData(); for (Marker marker : markerDataset.getMarkers()) { StandardItem item = new StandardItem(); for (MarkerProperty markerProperty : marker.getProperties()) { StandardItemProperty itemProperty = new StandardItemProperty(); itemProperty.setName(markerProperty.getName()); itemProperty.setValue(markerProperty.getValue()); itemProperty.setValueExpression(markerProperty.getValueExpression()); item.addItemProperty(itemProperty); } itemData.addItem(item); } if (markerDataset.getDatasetRun() != null) { JRDesignElementDataset dataset = new JRDesignElementDataset(); dataset.setDatasetRun(markerDataset.getDatasetRun()); itemData.setDataset(dataset); } return itemData; } return null; }
/** * Create the dialog. * @param parentShell */ public CVItemDataDialog(Shell parentShell, CVItemData itemData, JasperReportsConfiguration jconfig) { super(parentShell); this.itemData = (CVDesignItemData) itemData; if(this.itemData == null){ this.itemData = new CVDesignItemData(); } this.dataset = (JRDesignElementDataset) this.itemData.getDataset(); if(this.dataset==null){ this.dataset = new JRDesignElementDataset(); } this.jconfig = jconfig; }
private void toggleDatasetUsage(boolean selection) { if(selection){ this.dataset = new JRDesignElementDataset(); ((GridData)compositeDatasetInfo.getLayoutData()).exclude = false; compositeDatasetInfo.setVisible(true); compositeDatasetInfo.setEnabled(true); } else { compositeDatasetInfo.setEnabled(false); compositeDatasetInfo.setVisible(false); ((GridData)compositeDatasetInfo.getLayoutData()).exclude = true; this.dataset = null; } compositeDatasetInfo.getParent().layout(); }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignValueDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignValueDataset) eDataset; valueWidget.bindObject(dataset, "ValueExpression"); }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignXyzDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignXyzDataset) eDataset; setSeries(0); }
public ChartDatasetDialog(Shell parentShellProvider, Map<Class<? extends JRDesignElementDataset>, String> map, Class<? extends JRDesignElementDataset> selection) { super(parentShellProvider); this.map = map; this.selection = selection; }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignGanttDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignGanttDataset) eDataset; setSeries(0); }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignXyDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignXyDataset) eDataset; setSeries(0); }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignCategoryDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); this.dataset = (JRDesignCategoryDataset) eDataset; setSeries(0); }
public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { this.jrElement = jrChart; this.eDataset = eDataset; jrElement.setWidth(canvasChart.getSize().x); jrElement.setHeight(canvasChart.getSize().y); setChartFigure(); chartFigure.setJRElement(jrElement, drawVisitor); canvasChart.redraw(); btDatasetType.setEnabled(false); if (jrElement instanceof JRDesignChart) { JRDesignChart jrDChart = (JRDesignChart) jrElement; if (jrDChart.getChartType() == JRChart.CHART_TYPE_XYBAR) btDatasetType.setEnabled(true); } }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof JRDesignTimePeriodDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); dataset = (JRDesignTimePeriodDataset) eDataset; setSeries(0); }
public String getName(Class<? extends JRDesignElementDataset> key) { ADSComponent c = map.get(key); if (c != null) { return c.getName(); } return "noname"; }
public void setDataset(JasperDesign jrDesign, JRDesignElement jrChart, JRDesignElementDataset eDataset) { this.eDataset = eDataset; if (jrDesign != null && this.jrDesign != jrDesign) { this.jrDesign = jrDesign; } this.jrChart = jrChart; fillData(); }
private JRDataset getJRdataset(final JRDesignElementDataset jrDataset) { JRDataset jrds = jrDesign.getMainDataset(); if (jrDataset != null && jrDataset.getDatasetRun() != null) { String dsname = jrDataset.getDatasetRun().getDatasetName(); jrDesign.getDatasetMap().get(dsname); } final JRDataset jrdsfinal = jrds; return jrdsfinal; }
protected ChartDataPage(JRDesignElement jrChart, JRDesignElementDataset edataset, JasperReportsConfiguration jrContext) { super("chartdataconfiguration"); //$NON-NLS-1$ setTitle(Messages.ChartDataPage_title); setDescription(Messages.ChartDataPage_description); this.jrChart = jrChart; this.edataset = edataset; this.jrContext = jrContext; }
public ChartWizard(MGraphicElement chart, JRDesignElementDataset edataset) { super(); setWindowTitle(Messages.common_chart_wizard); this.chart = chart; this.edataset = edataset; JRDesignElement jrChart = (JRDesignElement) chart.getValue(); width = jrChart.getWidth(); height = jrChart.getHeight(); }
@Override public List<MDatasetRun> getDatasetRunList() { List<MDatasetRun> datasetList = new ArrayList<MDatasetRun>(); MCrosstabDataset crosstabDataset = (MCrosstabDataset) getPropertyValue(JRDesignCrosstab.PROPERTY_DATASET); datasetList.add((MDatasetRun) crosstabDataset.getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN)); return datasetList; }
/** * Returns the expression context that should be used with the map markers. * Markers can be generated by a dataset and therefore the related expressions * should use this as their context. * * @return the expression context to be used for the markers expressions */ public ExpressionContext getMarkersExpressionContext() { MDatasetRun datasetRun = (MDatasetRun) getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN); if(datasetRun!=null){ JRDesignDatasetRun value = datasetRun.getValue(); if(value!=null && value.getDatasetName()!=null){ JRDesignDataset ds = ModelUtils.getDesignDatasetByName(getJasperDesign(),value.getDatasetName()); if(ds!=null) { return new ExpressionContext(ds, getJasperConfiguration()); } } } return null; }
@Override public void setPropertyValue(Object id, Object value) { if (id.equals(JRDesignDatasetRun.PROPERTY_DATASET_NAME)) { super.setPropertyValue(id, value); mapModel.setPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN, this); } else super.setPropertyValue(id, value); }
@Override public List<MDatasetRun> getDatasetRunList() { List<MDatasetRun> datasetList = new ArrayList<MDatasetRun>(); MDatasetRun datasetRun = (MDatasetRun) getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN); datasetList.add(new MapDatasetRun(datasetRun.getValue(), this)); return datasetList; }
public ElementDatasetDialog( Shell parentShell,String title, String message, JRElementDataset dataset, JasperReportsConfiguration jConfig) { super(parentShell); this.title = title; this.message = message; this.dataset = (JRDesignElementDataset) dataset; if(this.dataset==null){ this.dataset = new JRDesignElementDataset(); } this.jConfig = jConfig; }
@Override public void setData(JSSDrawVisitor drawVisitor, JRDesignElement jrChart, JRDesignElementDataset eDataset, JasperReportsConfiguration jrContext) { Assert.isTrue(eDataset instanceof StandardSpiderDataset); super.setData(drawVisitor, jrChart, eDataset, jrContext); this.dataset = (StandardSpiderDataset) eDataset; setSeries(0); }
@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"); }
@Override protected void initializeProvidedProperties() { super.initializeProvidedProperties(); addProvidedProperties(JRDesignElementDataset.PROPERTY_INCREMENT_TYPE, Messages.common_increment_type); addProvidedProperties(JRDesignElementDataset.PROPERTY_INCREMENT_WHEN_EXPRESSION, Messages.MElementDataset_increment_when_expression); addProvidedProperties(JRDesignElementDataset.PROPERTY_RESET_TYPE, Messages.common_reset_type); addProvidedProperties(JRDesignElementDataset.PROPERTY_DATASET_RUN, Messages.MElementDataset_dataset_run); }
protected JRDesignElementDataset getDataset() { return (JRDesignElementDataset) digester.peek(); }
@Override public JRDesignElementDataset getDataset() { return new JRDesignElementDataset(); }
public Class<? extends JRDesignElementDataset> getSelection() { return selection; }
public void setDataset(JRDesignElementDataset eDataset, JasperDesign jrDesign) { this.eDataset = eDataset; this.jrDesign = jrDesign; fillData(); }