Author: DartPeng
Date: 2009-03-10 06:00:06 -0400 (Tue, 10 Mar 2009)
New Revision: 14123
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/BeanPopulatorGraphicalModelListener.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/PropertyModel.java
Log:
JBIDE-3982
Fix it
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/BeanPopulatorGraphicalModelListener.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/BeanPopulatorGraphicalModelListener.java 2009-03-10
09:06:31 UTC (rev 14122)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/BeanPopulatorGraphicalModelListener.java 2009-03-10
10:00:06 UTC (rev 14123)
@@ -461,6 +461,10 @@
Object obj = event.getNewValue();
if (obj != null && obj instanceof PropertyModel && line != null) {
String name = ((PropertyModel) obj).getName();
+ if (name.equals(JavaBeanPropertiesSection.PRO_TYPE)) {
+ String value = (String) ((PropertyModel) obj).getValue();
+ modifyResourceConfigAdditionalProperties(line, name, value);
+ }
if (name
.equals(BeanPopulatorMappingAnalyzer.PRO_SELECTOR_ATTRIBUTES)) {
SelectorAttributes sa = (SelectorAttributes) ((PropertyModel) obj)
@@ -478,6 +482,34 @@
}
}
+ protected void modifyResourceConfigAdditionalProperties(
+ LineConnectionModel line, String proName, String value) {
+ ResourceConfigType resourceConfigType = getResourceConfig(line);
+ if (resourceConfigType != null) {
+ JavaBeanModel target = (JavaBeanModel) ((AbstractStructuredDataModel) line
+ .getTarget()).getReferenceEntityModel();
+ String name = target.getName();
+ List bindings = SmooksModelUtils
+ .getBindingListFromResourceConfigType(resourceConfigType);
+ if (bindings == null)
+ return;
+ for (Iterator iterator = bindings.iterator(); iterator.hasNext();) {
+ AnyType param = (AnyType) iterator.next();
+ String property = SmooksModelUtils
+ .getAttributeValueFromAnyType(param,
+ SmooksModelUtils.ATTRIBUTE_PROPERTY);
+ if (property == null)
+ return;
+ property = property.trim();
+ if (name.equalsIgnoreCase(property)) {
+ SmooksModelUtils.setPropertyValueToAnyType(value,
+ SmooksModelUtils.ATTRIBUTE_TYPE, param);
+ break;
+ }
+ }
+ }
+ }
+
protected void modifyResourceConfigSelector(LineConnectionModel line,
SelectorAttributes sa) {
ResourceConfigType resourceConfig = getResourceConfig(line);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java 2009-03-10
09:06:31 UTC (rev 14122)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/ui/JavaBeanPropertiesSection.java 2009-03-10
10:00:06 UTC (rev 14123)
@@ -65,7 +65,7 @@
*/
public class JavaBeanPropertiesSection extends AbstractSmooksPropertySection {
- private static final String PRO_TYPE = "type"; //$NON-NLS-1$
+ public static final String PRO_TYPE = "type"; //$NON-NLS-1$
private Text instanceClassText;
@@ -143,6 +143,7 @@
PropertyModel pro = getTypePropertyModel();
if (pro != null) {
pro.setValue(beanClassType);
+ getLineConnectionModel().addPropertyModel(pro);
fireDirty();
refresh();
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/PropertyModel.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/PropertyModel.java 2009-03-10
09:06:31 UTC (rev 14122)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/gef/model/PropertyModel.java 2009-03-10
10:00:06 UTC (rev 14123)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.smooks.ui.gef.model;
+import javax.print.attribute.SupportedValuesAttribute;
+
/**
* @author Dart Peng<br>
* Date : Sep 4, 2008