/** * Remove a property expression. * * @param name the name of the property to remove * @return the removed property expression (if found) */ public JRPropertyExpression removePropertyExpression(String name) { JRPropertyExpression removed = null; for (ListIterator<JRPropertyExpression> it = propertyExpressions.listIterator(); it.hasNext();) { JRPropertyExpression prop = it.next(); if (name.equals(prop.getName())) { removed = prop; int idx = it.previousIndex(); it.remove(); getEventSupport().fireCollectionElementRemovedEvent(JRDesignElement.PROPERTY_PROPERTY_EXPRESSIONS, removed, idx); break; } } return removed; }
public static void setSelection(JRDesignElement jrElement, boolean add) { EditPart ep = getEditPart(jrElement); if (ep != null) { // The selection is set only if the refresh is enabled ANode mainNode = JSSCompoundCommand.getMainNode((ANode) ep.getModel()); if (!JSSCompoundCommand.isRefreshEventsIgnored(mainNode)) { ISelection sel = ep.getViewer().getSelection(); List<Object> s = new ArrayList<Object>(); s.add(ep); if (add) { if (sel instanceof StructuredSelection) { for (Object o : ((StructuredSelection) sel).toList()) { s.add(o); } } } ep.getViewer().select(ep); ep.getViewer().reveal(ep); } } }
@Override public void performRequest(Request req) { if (RequestConstants.REQ_OPEN.equals(req.getType())) { if(!ExpressionEditorSupportUtil.isExpressionEditorDialogOpen()) { JRExpressionEditor wizard = new JRExpressionEditor(); MHtml m = (MHtml) getModel(); wizard.setValue((JRDesignExpression) m .getPropertyValue(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION)); ExpressionContext ec=ModelUtils.getElementExpressionContext((JRDesignElement)m.getValue(), m); wizard.setExpressionContext(ec); WizardDialog dialog = ExpressionEditorSupportUtil.getExpressionEditorWizardDialog(Display.getDefault() .getActiveShell(), wizard); if (dialog.open() == Dialog.OK) { SetValueCommand cmd = new SetValueCommand(); cmd.setTarget((IPropertySource) getModel()); cmd.setPropertyId(HtmlComponent.PROPERTY_HTMLCONTENT_EXPRESSION); cmd.setPropertyValue(wizard.getValue()); getViewer().getEditDomain().getCommandStack().execute(cmd); } } } else super.performRequest(req); }
@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$ }
public static JSSCompoundCommand generateCommand(List<APropertyNode> nodes) { JSSCompoundCommand command = new JSSCompoundCommand(null); int height = (Integer) nodes.get(0).getPropertyValue(JRDesignElement.PROPERTY_HEIGHT); // Find the smallest one... for (int i = 1; i < nodes.size(); ++i) { if (nodes.get(i).getValue() instanceof JRDesignElement) { JRDesignElement element = (JRDesignElement) nodes.get(i).getValue(); if (height > element.getHeight()) height = element.getHeight(); } } for (APropertyNode node : nodes) { command.setReferenceNodeIfNull(node); SetValueCommand setCommand = new SetValueCommand(); setCommand.setTarget(node); setCommand.setPropertyId(JRDesignElement.PROPERTY_HEIGHT); setCommand.setPropertyValue(height); command.add(setCommand); } return command; }
private void updateContainerSize() { MCrosstab table = null; for (INode n : getPage().getChildren()) { if (n instanceof MCrosstab) { table = (MCrosstab) n; break; } } if (table != null) { Dimension d = table.getCrosstabManager().getSize(); d.height = Math.max(d.height, (Integer) table .getPropertyValue(JRDesignElement.PROPERTY_HEIGHT)); d.width = Math.max(d.width, (Integer) table .getPropertyValue(JRDesignElement.PROPERTY_WIDTH)); containerSize = d; } else containerSize = null; }
protected void showChangeBoundsFeedback(ChangeBoundsRequest request) { if (getHost().getModel() instanceof IGraphicElement) { // if (getHost() instanceof BandEditPart // && ((BandEditPart) getHost()).getModelNode().getValue() instanceof JRDesignBand) { APropertyNode n = (APropertyNode) getHost().getModel(); int bandHeight = (Integer) n.getPropertyValue(JRDesignElement.PROPERTY_HEIGHT); Integer bWidth = (Integer) n.getPropertyValue(JRDesignElement.PROPERTY_WIDTH); Rectangle oldBounds = new Rectangle(0, 0, bWidth != null ? bWidth : 0, bandHeight); PrecisionRectangle rect2 = new PrecisionRectangle(new Rectangle(0, 0, request.getSizeDelta().width, request.getSizeDelta().height)); getHostFigure().translateToRelative(rect2); oldBounds.resize(rect2.width, rect2.height); setFeedbackText(oldBounds.height + (bWidth != null ? "," + oldBounds.width : "") + " px"); } super.showChangeBoundsFeedback(request); }
@Override public void execute() { oldStyle = jrElement.getStyle() != null ? jrElement.getStyle().getName() : null;; String styleName = newStyleTemplate.getDescription(); JRStyle previousStyle = checkIfExist(styleName); if (previousStyle == null){ JRDesignStyle previousDesignStyle = new JRDesignStyle(); previousDesignStyle.setName(createStyleName(styleName)); copyTextStyleToStyle(previousDesignStyle); CreateStyleCommand command = new CreateStyleCommand(elementModel.getJasperDesign(), previousDesignStyle); styleCreted = true; command.execute(); previousStyle = previousDesignStyle; } elementModel.setPropertyValue(JRDesignElement.PROPERTY_PARENT_STYLE, previousStyle.getName()); }
@Override public void execute() { elementPosition = jrDesign.getStylesList().indexOf(jrStyle); jrDesign.removeStyle(jrStyle); elementsUsingStyle = new ArrayList<JRDesignElement>(); for(JRDesignElement element : ModelUtils.getAllElements(jrDesign)){ if (jrStyle.equals(element.getStyle())){ elementsUsingStyle.add(element); element.setStyle(null); } } stylesUsingStyle = new ArrayList<JRDesignStyle>(); for(JRStyle style : jrDesign.getStyles()){ if (jrStyle.equals(style.getStyle()) && style instanceof JRDesignStyle){ JRDesignStyle baseStyle = (JRDesignStyle)style; stylesUsingStyle.add(baseStyle); baseStyle.setParentStyle(null); } } }
public static JSSCompoundCommand generateCommand(List<APropertyNode> nodes){ JSSCompoundCommand command = new JSSCompoundCommand(null); if (nodes.isEmpty()) return command; List<APropertyNode> sortedElements = sortYX( nodes ); for (int i=1; i<sortedElements.size(); ++i) { APropertyNode element = sortedElements.get(i); command.setReferenceNodeIfNull(element); JRDesignElement jrElement = (JRDesignElement)element.getValue(); if (jrElement.getY() - 5*i > 0) { SetValueCommand setCommand = new SetValueCommand(); setCommand.setTarget(element); setCommand.setPropertyId(JRDesignElement.PROPERTY_Y); setCommand.setPropertyValue(jrElement.getY() - 5*i); command.add(setCommand); } } return command; }
@Override public HashSet<String> generateGraphicalProperties() { HashSet<String> result = super.generateGraphicalProperties(); result.add(JRBaseStyle.PROPERTY_BACKCOLOR); result.add(JRDesignCellContents.PROPERTY_STYLE); result.add(JRBaseStyle.PROPERTY_MODE); result.add(JRDesignCellContents.PROPERTY_STYLE_NAME_REFERENCE); result.add(JRDesignCrosstabCell.PROPERTY_WIDTH); result.add(JRDesignCrosstabCell.PROPERTY_HEIGHT); result.add(JRDesignElement.PROPERTY_ELEMENT_GROUP); result.add(JRDesignCrosstab.PROPERTY_COLUMN_GROUPS); result.add(JRDesignCrosstab.PROPERTY_ROW_GROUPS); result.add(JRDesignCrosstab.PROPERTY_MEASURES); result.add(JRDesignCrosstab.PROPERTY_TITLE_CELL); result.add(JRDesignCrosstab.PROPERTY_HEADER_CELL); result.add(JRDesignCrosstab.PROPERTY_CELLS); return result; }
@Override public void undo() { if (commands != null) commands.undo(); for (JRElement el : map.keySet()) { JRDesignElement del = (JRDesignElement) el; Rectangle r = map.get(el); del.setX(r.x); del.setY(r.y); del.setWidth(r.width); del.setHeight(r.height); } DesignListContents dlist = (DesignListContents) listcomponent .getContents(); dlist.removeElement(jrElement); }
private APropertyNode getContainerNode(ANode n) { Object val = n.getValue(); if (n instanceof IGroupElement) return (APropertyNode) n; if (val instanceof JRElementGroup){ if(n instanceof MElementGroup) { return getContainerNode(n.getParent()); } else { return (APropertyNode) n; } } if (val instanceof JRDesignElement) return getContainerNode(n.getParent()); return null; }
/** * Copy all the report independent properties from this element to * the target one. The target must have the same type, or a subtype, * of the value of this element. The report dependent properties are * expressions, groups and styles essentially * * @param target the target of the copy */ public void trasnferProperties(JRElement target){ JRDesignElement jrTarget = (JRDesignElement)target; JRDesignElement jrSource = getValue(); jrTarget.setKey(getStringClone(jrSource.getKey())); jrTarget.setWidth(jrSource.getWidth()); jrTarget.setHeight(jrSource.getHeight()); jrTarget.setBackcolor(jrSource.getOwnBackcolor()); jrTarget.setForecolor(jrSource.getOwnForecolor()); jrTarget.setMode(jrSource.getOwnModeValue()); jrTarget.setPositionType(jrSource.getPositionTypeValue()); jrTarget.setStretchType(jrSource.getStretchTypeValue()); jrTarget.setPrintRepeatedValues(jrSource.isPrintRepeatedValues()); jrTarget.setRemoveLineWhenBlank(jrSource.isRemoveLineWhenBlank()); jrTarget.setPrintInFirstWholeBand(jrSource.isPrintInFirstWholeBand()); jrTarget.setPrintWhenDetailOverflows(jrSource.isPrintWhenDetailOverflows()); }
private APropertyNode getContainerNode(ANode n) { Object val = n.getValue(); if (n instanceof IGroupElement) return (APropertyNode) n; if (val instanceof JRElementGroup) { if(n instanceof MElementGroup) { return getContainerNode(n.getParent()); } else { return (APropertyNode) n; } } if (val instanceof JRDesignElement) return getContainerNode(n.getParent()); return null; }
public Object getPropertyValue(Object id) { StandardBaseColumn jrElement = getValue(); if (id.equals(StandardBaseColumn.PROPERTY_WIDTH)) return jrElement.getWidth(); if (id.equals(StandardBaseColumn.PROPERTY_PRINT_WHEN_EXPRESSION)) return ExprUtil.getExpression(jrElement.getPrintWhenExpression()); if (id.equals(DesignCell.PROPERTY_HEIGHT)) return getMTable().getTableManager().getYhcolumn(type, grName, jrElement).height; JRPropertiesMap propertiesMap = jrElement.getPropertiesMap(); if (propertiesMap != null) propertiesMap = propertiesMap.cloneProperties(); if (id.equals(JRDesignElement.PROPERTY_PROPERTY_EXPRESSIONS)) { JRPropertyExpression[] propertyExpressions = jrElement .getPropertyExpressions(); if (propertyExpressions != null) propertyExpressions = propertyExpressions.clone(); return new PropertyExpressionsDTO(propertyExpressions, propertiesMap, this); } if (id.equals(MGraphicElement.PROPERTY_MAP)) return propertiesMap; return null; }
public AlignCommand(int alignement, MGraphicElement m){ super(); this.alignement = alignement; jrElement = (JRDesignElement) m.getValue(); INode n = m.getParent(); if (n instanceof IContainer) { if (n instanceof MBand) { // height of band, width of Report - margins int h = ((JRDesignBand) ((MBand) n).getValue()).getHeight(); JasperDesign jasperDesign = m.getJasperDesign(); int w = jasperDesign.getPageWidth() - jasperDesign.getLeftMargin() - jasperDesign.getRightMargin(); parent = new Dimension(w, h); } else if (n instanceof IGraphicElementContainer) parent = ((IGraphicElementContainer) n).getSize(); } }
/** * @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 = getWidgetFactory().createSection(parent, Messages.LocationSection_locationLabel, true, 4); section = (ExpandableComposite)parent.getParent(); ASPropertyWidget pw = createWidget4Property(parent, JRDesignElement.PROPERTY_X); CLabel lbl = pw.getLabel(); lbl.setText(Messages.LocationSection_xCoordinateLabel); lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); pw = createWidget4Property(parent, JRDesignElement.PROPERTY_Y); lbl = pw.getLabel(); lbl.setText(Messages.LocationSection_yCoordinateLabel); lbl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ASPropertyWidget w = createWidget4Property(parent, JRDesignElement.PROPERTY_POSITION_TYPE); GridData gd = new GridData(); gd.horizontalSpan = 3; w.getControl().setLayoutData(gd); }
@Override public void setStyle(JRFont font, Attributes atts) { JRDesignElement element = (JRDesignElement)font; if ( element.getStyle() == null && element.getStyleNameReference() == null ) { String styleName = atts.getValue(JRXmlConstants.ATTRIBUTE_reportFont); if (styleName != null) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); Map<String,JRStyle> stylesMap = jasperDesign.getStylesMap(); if (stylesMap.containsKey(styleName)) { JRStyle style = stylesMap.get(styleName); element.setStyle(style); } else { element.setStyleNameReference(styleName); } } } }
protected static void addComponentRules(JasperReportsContext jasperReportsContext, Digester digester) { digester.addFactoryCreate("*/componentElement", JRComponentElementFactory.class.getName()); digester.addSetNext("*/componentElement", "addElement", JRDesignElement.class.getName()); Collection<ComponentsBundle> components = ComponentsEnvironment.getInstance(jasperReportsContext).getBundles(); for (Iterator<ComponentsBundle> it = components.iterator(); it.hasNext();) { ComponentsBundle componentsBundle = it.next(); ComponentsXmlParser xmlParser = componentsBundle.getXmlParser(); digester.setRuleNamespaceURI(xmlParser.getNamespace()); XmlDigesterConfigurer configurer = xmlParser.getDigesterConfigurer(); if (configurer != null) { configurer.configureDigester(digester); } digester.setRuleNamespaceURI(xmlParser.getNamespace()); for (Iterator<String> namesIt = componentsBundle.getComponentNames().iterator(); namesIt.hasNext();) { String componentName = namesIt.next(); digester.addRule("*/componentElement/" + componentName, JRComponentRule.newInstance()); } } digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE); }
private static void addFrameRules(Digester digester) { String framePattern = "*/" + JRXmlConstants.ELEMENT_frame; digester.addFactoryCreate(framePattern, JRFrameFactory.class.getName()); digester.addSetNext(framePattern, "addElement", JRDesignElement.class.getName()); digester.addRule(framePattern, new XmlConstantPropertyRule(JRXmlConstants.ATTRIBUTE_borderSplitType, BorderSplitType.values())); }
protected static void addGenericElementRules(Digester digester) { String genericElementPattern = "*/" + JRXmlConstants.ELEMENT_genericElement; digester.addFactoryCreate(genericElementPattern, JRGenericElementFactory.class); digester.addSetNext(genericElementPattern, "addElement", JRDesignElement.class.getName()); String genericElementTypePattern = genericElementPattern + "/" + JRXmlConstants.ELEMENT_genericElementType; digester.addFactoryCreate(genericElementTypePattern, JRGenericElementTypeFactory.class); digester.addSetNext(genericElementTypePattern, "setGenericType", JRGenericElementType.class.getName()); String genericElementParameterPattern = genericElementPattern + "/" + JRXmlConstants.ELEMENT_genericElementParameter; digester.addFactoryCreate(genericElementParameterPattern, JRGenericElementParameterFactory.class); digester.addSetNext(genericElementParameterPattern, "addParameter", JRGenericElementParameter.class.getName()); String genericElementParameterExpressionPattern = genericElementParameterPattern + "/" + JRXmlConstants.ELEMENT_genericElementParameter_valueExpression; @SuppressWarnings("deprecation") Class<?> depArbitraryExprFactory = JRExpressionFactory.ArbitraryExpressionFactory.class; digester.addFactoryCreate(genericElementParameterExpressionPattern, depArbitraryExprFactory); digester.addSetNext(genericElementParameterExpressionPattern, "setValueExpression", JRExpression.class.getName()); digester.addCallMethod(genericElementParameterExpressionPattern, "setText", 0); }
/** * Add a dynamic/expression-based property. * * @param propertyExpression the property to add * @see #getPropertyExpressions() */ public void addPropertyExpression(JRPropertyExpression propertyExpression) { propertyExpressions.add(propertyExpression); getEventSupport().fireCollectionElementAddedEvent(JRDesignElement.PROPERTY_PROPERTY_EXPRESSIONS, propertyExpression, propertyExpressions.size() - 1); }
/** * Remove a property expression. * * @param propertyExpression the property expression to remove * @see #addPropertyExpression(JRPropertyExpression) */ public void removePropertyExpression(JRPropertyExpression propertyExpression) { int idx = propertyExpressions.indexOf(propertyExpression); if (idx >= 0) { propertyExpressions.remove(idx); getEventSupport().fireCollectionElementRemovedEvent(JRDesignElement.PROPERTY_PROPERTY_EXPRESSIONS, propertyExpression, idx); } }
private void publishJrxml(AMJrxmlContainer mres, IProgressMonitor monitor, JasperDesign jasper, Set<String> fileset, IFile file) throws Exception { if (monitor.isCanceled()) return; MReportUnit mrunit = null; if (mres instanceof MReportUnit) mrunit = (MReportUnit) mres; else if (mres.getParent() instanceof MReportUnit) mrunit = (MReportUnit) mres.getParent(); if (mrunit != null) { List<JRDesignElement> elements = ModelUtils.getAllElements(jasper); for (JRDesignElement ele : elements) { if (ele instanceof JRDesignImage) publishImage(mrunit, monitor, jasper, fileset, file, ele, version); else if (ele instanceof JRDesignSubreport) { publishSubreport(mrunit, monitor, jasper, fileset, file, ele, version); } else { publishElement(mrunit, monitor, jasper, fileset, file, ele, version); } } publishDataAdapters(mrunit, monitor, jasper, fileset, file, version); publishBundles(mrunit, monitor, jasper, fileset, file, version); publishTemplates(mrunit, monitor, jasper, fileset, file, version); } // here extend and give possibility to contribute to plugins Activator.getExtManager().publishJrxml(mres, monitor, jasper, fileset, file, version); }
public Object getPropertyActualValue(Object id) { JRDesignElement jrElement = (JRDesignElement) getValue(); if (id.equals(JRBaseStyle.PROPERTY_BACKCOLOR)) return Colors.getSWTRGB4AWTGBColor(jrElement.getBackcolor()); if (id.equals(JRBaseStyle.PROPERTY_FORECOLOR)) return Colors.getSWTRGB4AWTGBColor(jrElement.getForecolor()); // opacity if (id.equals(JRBaseStyle.PROPERTY_MODE)) return jrElement.getModeValue().equals(ModeEnum.TRANSPARENT); return super.getPropertyActualValue(id); }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignEllipse jrDesignEllipse = new JRDesignEllipse(jasperDesign); DefaultManager.INSTANCE.applyDefault(this.getClass(), jrDesignEllipse); jrDesignEllipse.setWidth(getDefaultWidth()); jrDesignEllipse.setWidth(getDefaultHeight()); return jrDesignEllipse; }
private JRDesignElement getElementFromTable(JRChild[] childs, StandardTable table){ for(JRChild child : childs){ if (child instanceof JRDesignComponentElement && ((JRDesignComponentElement)child).getComponent() == table) return (JRDesignElement)child; if (child instanceof JRElementGroup) { JRElementGroup group = (JRElementGroup)child; JRDesignElement value = getElementFromTable(group.getElements(), table); if (value != null) return value; } } return null; }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignComponentElement el = new JRDesignComponentElement(); HtmlComponent component = new HtmlComponent(); JRDesignExpression exp = new JRDesignExpression(); exp.setValueClassName("java.lang.String"); //$NON-NLS-1$ exp.setText("\"<p style='background-color:yellow;'>HTML paragraph</p>\""); //$NON-NLS-1$ component.setHtmlContentExpression(exp); el.setComponent(component); el.setComponentKey(new ComponentKey( "http://jasperreports.sourceforge.net/htmlcomponent", "hc", "html")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return el; }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignElement jrDesignElement = new JRDesignFrame(); DefaultManager.INSTANCE.applyDefault(this.getClass(), jrDesignElement); jrDesignElement.setWidth(getDefaultWidth()); jrDesignElement.setHeight(getDefaultHeight()); return jrDesignElement; }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignElement jrDesignElement = new JRDesignImage(jasperDesign); DefaultManager.INSTANCE.applyDefault(this.getClass(), jrDesignElement); jrDesignElement.setWidth(getDefaultWidth()); jrDesignElement.setHeight(getDefaultHeight()); return jrDesignElement; }
private JRElementGroup getContainer(ANode n) { if (n != null){ Object val = n.getValue(); if (n instanceof IGroupElement) return ((IGroupElement) n).getJRElementGroup(); if (val instanceof JRElementGroup) return (JRElementGroup) val; if (val instanceof JRDesignElement) return getContainer(n.getParent()); } return null; }
@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); }
/** * Return the internal style used. If the internal style is a reference to a removed style * then it is also removed from the element */ public JRStyle getActualStyle(){ JRDesignElement jrElement = (JRDesignElement) getValue(); //Check if the used style is valid otherwise set it to null if (jrElement.getStyle() != null && !getJasperDesign().getStylesMap().containsKey(jrElement.getStyle().getName())){ setPropertyValue(JRDesignElement.PROPERTY_PARENT_STYLE, null); } if (jrElement.getStyle() != null){ return jrElement.getStyle(); } return null; }
@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); } }
public static JSSCompoundCommand generateCommand(List<APropertyNode> nodes){ JSSCompoundCommand command = new JSSCompoundCommand(null); // Find the smallest one... for (APropertyNode element : nodes) { command.setReferenceNodeIfNull(element); SetValueCommand setCommand = new SetValueCommand(); setCommand.setTarget(element); setCommand.setPropertyId(JRDesignElement.PROPERTY_Y); setCommand.setPropertyValue(0); command.add(setCommand); } return command; }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignRectangle jrDesignRectangle = new JRDesignRectangle(jasperDesign); DefaultManager.INSTANCE.applyDefault(this.getClass(), jrDesignRectangle); jrDesignRectangle.setWidth(getDefaultWidth()); jrDesignRectangle.setHeight(getDefaultHeight()); return jrDesignRectangle; }