public JRDesignElement createReportElement(JasperDesign jd) { if (getScene() instanceof CrosstabObjectScene) { Runnable r = new Runnable() { public void run() { JOptionPane.showMessageDialog(Misc.getMainFrame(), "You can not use a break element inside a crosstab","Error", JOptionPane.WARNING_MESSAGE); } }; Mutex.EVENT.readAccess(r); return null; } JRDesignBreak element = new JRDesignBreak(); BreakTypeDialog dialog = new BreakTypeDialog(Misc.getMainFrame(), true); dialog.setVisible(true); element.setWidth(100); element.setType( dialog.getBreakTypeValue() ); return element; }
@Override public Object createObject(Attributes atts) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); JRDesignBreak breakElement = new JRDesignBreak(jasperDesign); BreakTypeEnum type = BreakTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_type)); if (type != null) { breakElement.setType(type); } return breakElement; }
@Override public Object getPropertyValue(Object id) { JRDesignBreak jrElement = (JRDesignBreak) getValue(); if (id.equals(JRBaseBreak.PROPERTY_TYPE)) return typeD.getEnumValue(jrElement.getTypeValue()); return super.getPropertyValue(id); }
@Override public void setPropertyValue(Object id, Object value) { JRDesignBreak jrElement = (JRDesignBreak) getValue(); if (id.equals(JRBaseBreak.PROPERTY_TYPE)) jrElement.setType((BreakTypeEnum) typeD.getEnumValue(value)); else super.setPropertyValue(id, value); }
@Override public JRDesignElement createJRElement(JasperDesign jasperDesign) { JRDesignBreak brk = new JRDesignBreak(); brk.setWidth(getDefaultWidth()); brk.setHeight(getDefaultHeight()); DefaultManager.INSTANCE.applyDefault(this.getClass(), brk); return brk; }
@Override public void trasnferProperties(JRElement target){ super.trasnferProperties(target); JRDesignBreak jrSource = (JRDesignBreak) getValue(); if (jrSource != null){ JRDesignBreak jrTarget = (JRDesignBreak)target; jrTarget.setType(jrSource.getTypeValue()); } }
public static Sheet.Set getBreakPropertySet(JRDesignBreak breakElement) { Sheet.Set propertySet = Sheet.createPropertiesSet(); propertySet.setName("BREAK_PROPERTIES"); propertySet.setDisplayName("Break properties"); propertySet.put(new BreakTypeProperty(breakElement)); return propertySet; }
/** * */ public void visitBreak(JRBreak breakElement) { node = new ElementNode(jasperDesign, (JRDesignBreak)breakElement,doLkp); node.setIconBaseWithExtension(ICON_BREAK); }
/** * Convenient way to get all the properties of an element. * Properties positions could be reordered to have a better order. */ public static List<Sheet.Set> getPropertySets(JRDesignElement element, JasperDesign jd) { List<Sheet.Set> sets = new ArrayList<Sheet.Set>(); sets.add( getCommonPropertySet(element, jd) ); if (element instanceof JRDesignGraphicElement) { sets.addAll( GraphicElementPropertiesFactory.getGraphicPropertySets((JRDesignGraphicElement)element, jd) ); } if (element instanceof JRDesignTextElement) { sets.addAll( TextElementPropertiesFactory.getPropertySets(element, jd) ); } if (element instanceof JRDesignSubreport) { sets.addAll( SubreportPropertiesFactory.getPropertySets(element, jd) ); } if (element instanceof JRDesignBreak) { sets.add( getBreakPropertySet((JRDesignBreak)element) ); } if (element instanceof JRDesignChart) { sets.addAll( ChartPropertiesFactory.getPropertySets((JRDesignChart)element, jd) ); } if (element instanceof JRBox) { sets.add( getBoxPropertySet((JRBox)element) ); } if (element instanceof JRDesignGenericElement) { sets.add( getGenericElementPropertySet((JRDesignGenericElement)element, jd ) ); } return sets; }
@SuppressWarnings("unchecked") public BreakTypeProperty(JRDesignBreak breakElement) { super( BreakTypeEnum.class, breakElement); this.breakElement = breakElement; }
/** * Instantiates a new m break. * * @param parent * the parent * @param jrBreak * the jr break * @param newIndex * the new index */ public MBreak(ANode parent, JRDesignBreak jrBreak, int newIndex) { super(parent, newIndex); setValue(jrBreak); }