@Override public void dispose() { // clear all properties List<PropertyDTO> props = (List<PropertyDTO>) tableViewer.getInput(); List<JRPropertyExpression> pexpr = new ArrayList<JRPropertyExpression>(); for (String str : value.getPropMap().getPropertyNames()) value.getPropMap().removeProperty(str); value.setPropExpressions(null); for (PropertyDTO p : props) { if (p.getValue() instanceof JRExpression) { JRDesignPropertyExpression jrpexp = new JRDesignPropertyExpression(); jrpexp.setName(p.getProperty()); jrpexp.setValueExpression((JRExpression) p.getValue()); pexpr.add(jrpexp); } else if (p.getValue() instanceof String) { value.getPropMap().setProperty(p.getProperty(), (String) p.getValue()); } } if (pexpr != null && !pexpr.isEmpty()) value.setPropExpressions(pexpr.toArray(new JRPropertyExpression[pexpr.size()])); super.dispose(); }
/** * replace the expression properties in element with the ones found in newExpressionProperties. */ public static void replaceExpressionProperties(StandardBaseColumn column, List<GenericProperty> newExpressionProperties) { // Update names. List usedProps = new ArrayList(); List propertyExpressions = column.getPropertyExpressionsList(); for(int i = 0; i < propertyExpressions.size(); i++) { column.removePropertyExpression((JRPropertyExpression)propertyExpressions.get(i)); } if (newExpressionProperties == null) return; for(GenericProperty prop : newExpressionProperties) { if (!prop.isUseExpression()) continue; JRDesignPropertyExpression newProp = new JRDesignPropertyExpression(); newProp.setName(prop.getKey()); newProp.setValueExpression(prop.getExpression()); column.addPropertyExpression(newProp); } }
/** * replace the expression properties in element with the ones found in newExpressionProperties. */ public static void replaceExpressionProperties(JRDesignElement element, List<GenericProperty> newExpressionProperties) { // Update names. List usedProps = new ArrayList(); // List propertyExpressions = element.getPropertyExpressionsList(); while(element.getPropertyExpressionsList().size() > 0) { element.removePropertyExpression((JRPropertyExpression)element.getPropertyExpressionsList().get(0)); } if (newExpressionProperties == null) return; for(GenericProperty prop : newExpressionProperties) { if (!prop.isUseExpression()) continue; JRDesignPropertyExpression newProp = new JRDesignPropertyExpression(); newProp.setName(prop.getKey()); newProp.setValueExpression(prop.getExpression()); element.addPropertyExpression(newProp); } }
@Override public Object createObject(Attributes attrs) throws Exception { JRDesignPropertyExpression propertyExpression = new JRDesignPropertyExpression(); String name = attrs.getValue(JRXmlConstants.ATTRIBUTE_name); propertyExpression.setName(name); return propertyExpression; }
protected void addDynamicProperty(String name, JRExpression expression) { JRDesignPropertyExpression prop = new JRDesignPropertyExpression(); prop.setName(name); prop.setValueExpression(expression); propertyExpressions.add(prop); // recomputing dynamicTransferProperties = findDynamicTransferProperties(); }
public JRDesignPropertyExpression toPropertyExpression() { JRDesignPropertyExpression pp = new JRDesignPropertyExpression(); pp.setName(key); pp.setValueExpression(getExpression()); return pp; }
protected JRPropertyExpression getPropertyExpression(DRIDesignPropertyExpression propertyExpression) { JRDesignPropertyExpression jrPropertyExpression = new JRDesignPropertyExpression(); jrPropertyExpression.setName(propertyExpression.getName()); jrPropertyExpression.setValueExpression(getExpression(propertyExpression.getValueExpression())); return jrPropertyExpression; }