public Object getValue() throws IllegalAccessException, InvocationTargetException { JRPropertiesMap map = element.getPropertiesMap(); List properties = new ArrayList(); String[] names = map.getPropertyNames(); for (int i = 0; i < names.length; ++i) { properties.add(new GenericProperty(names[i], map.getProperty(names[i]))); } // add to the list the expression properties... JRPropertyExpression[] expProperties = element.getPropertyExpressions(); for (int i = 0; expProperties != null && i < expProperties.length; ++i) { properties.add( new GenericProperty( expProperties[i].getName(), (JRDesignExpression) expProperties[i].getValueExpression())); } return properties; }
public void setValue(Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { // if (!(val instanceof JRPropertiesMap)) throw new IllegalArgumentException(); if (!(val instanceof List)) throw new IllegalArgumentException(); // Fill this map with the content of the map we got here... // 1. Create the map... JRPropertiesMap map = new JRPropertiesMap(); List values = (List) val; for (int i = 0; i < values.size(); ++i) { GenericProperty prop = (GenericProperty) values.get(i); if (!prop.isUseExpression()) { map.setProperty(prop.getKey(), (String) prop.getValue()); } } ModelUtils.replacePropertiesMap(map, element.getPropertiesMap()); ModelUtils.replaceExpressionProperties(element, values); com.jaspersoft.ireport.designer.IReportManager.getInstance().notifyReportChange(); }