Author: koen.aers(a)jboss.com
Date: 2009-04-29 13:04:11 -0400 (Wed, 29 Apr 2009)
New Revision: 14964
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ClassNameSection.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventTypeSection.java
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java
Log:
event listener and event listener container configuration
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-04-29 15:22:06 UTC (rev
14963)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-04-29 17:04:11 UTC (rev
14964)
@@ -290,6 +290,18 @@
<input type="org.jboss.tools.flow.jpdl4.model.Timer"/>
</propertySection>
<propertySection
+ class="org.jboss.tools.flow.jpdl4.properties.EventTypeSection"
+ id="org.jboss.tools.jpdl4.eventType"
+ tab="org.jboss.tools.jpdl4.general">
+ <input
type="org.jboss.tools.flow.jpdl4.model.EventListenerContainer"/>
+ </propertySection>
+ <propertySection
+ class="org.jboss.tools.flow.jpdl4.properties.ClassNameSection"
+ id="org.jboss.tools.jpdl4.className"
+ tab="org.jboss.tools.jpdl4.general">
+ <input
type="org.jboss.tools.flow.jpdl4.model.EventListener"/>
+ </propertySection>
+ <propertySection
class="org.jboss.tools.flow.jpdl4.properties.AssignmentSection"
id="org.jboss.tools.jpdl4.assignment"
tab="org.jboss.tools.jpdl4.assignment">
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java 2009-04-29
15:22:06 UTC (rev 14963)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editpart/EventListenerListTreeEditPart.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -9,6 +9,7 @@
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.flow.common.wrapper.ModelEvent;
import org.jboss.tools.flow.common.wrapper.Wrapper;
+import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
import org.jboss.tools.flow.jpdl4.util.SharedImages;
public class EventListenerListTreeEditPart extends JpdlTreeEditPart implements
ElementTreeEditPart {
@@ -31,8 +32,8 @@
protected List<Object> getModelChildren() {
List<Object> result = new ArrayList<Object>();
Wrapper wrapper = (Wrapper)getModel();
- if (wrapper.getChildren("listener") != null) {
- result.addAll(wrapper.getChildren("listener"));
+ if (wrapper.getChildren(EventListenerContainer.LISTENERS) != null) {
+ result.addAll(wrapper.getChildren(EventListenerContainer.LISTENERS));
}
return result;
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java 2009-04-29
15:22:06 UTC (rev 14963)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/AddEventListenerHandler.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -44,9 +44,9 @@
wrapper.setElement(new EventListener());
addChildCommand.setType("eventListener");
child.setElement(new EventListenerContainer());
- child.addChild("listener", wrapper);
+ child.addChild(EventListenerContainer.LISTENERS, wrapper);
} else {
- addChildCommand.setType("listener");
+ addChildCommand.setType(EventListenerContainer.LISTENERS);
child.setElement(new EventListener());
}
addChildCommand.setChild(child);
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java 2009-04-29
15:22:06 UTC (rev 14963)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/handler/DeleteElementHandler.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -52,7 +52,7 @@
} else if (child.getElement() instanceof Timer) {
deleteChildCommand.setType("timer");
} else if (child.getElement() instanceof EventListener) {
- deleteChildCommand.setType("listener");
+ deleteChildCommand.setType(EventListenerContainer.LISTENERS);
} else if (child.getElement() instanceof EventListenerContainer) {
deleteChildCommand.setType("eventListener");
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java 2009-04-29
15:22:06 UTC (rev 14963)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListener.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -1,10 +1,19 @@
package org.jboss.tools.flow.jpdl4.model;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.jboss.tools.flow.common.model.DefaultElement;
public class EventListener extends DefaultElement {
+ public static final String CLASS_NAME =
"org.jboss.tools.flow.jpdl4.model.eventListener.className";
+
private String className;
+
+ public EventListener() {
+ setMetaData("propertySource", new PropertySource());
+ }
public String getClassName() {
return className;
@@ -14,4 +23,48 @@
this.className = className;
}
+ private class PropertySource implements IPropertySource {
+
+ private IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(CLASS_NAME, "Class") {
+ public String getCategory() {
+ return "General";
+ }
+ }
+ };
+
+ public Object getEditableValue() {
+ return null;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return propertyDescriptors;
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (CLASS_NAME.equals(id)) {
+ return getClassName() != null ? getClassName() : "";
+ }
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ if (CLASS_NAME.equals(id)) {
+ return getClassName() != null;
+ }
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (CLASS_NAME.equals(id)) {
+ if (value instanceof String) {
+ setClassName((String)value);
+ }
+ }
+ }
+
+ }
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java 2009-04-29
15:22:06 UTC (rev 14963)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/EventListenerContainer.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -5,10 +5,14 @@
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.jboss.tools.flow.common.model.DefaultElement;
public class EventListenerContainer extends DefaultElement {
+ public static final String LISTENERS =
"org.jboss.tools.flow.jpdl4.model.eventListenerContainer.listeners";
+ public static final String EVENT_TYPE =
"org.jboss.tools.flow.jpdl4.model.eventListenerContainer.eventType";
+
private String eventType;
private List<EventListener> listeners = new ArrayList<EventListener>();
@@ -34,24 +38,36 @@
private class PropertySource implements IPropertySource {
+ private IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(EVENT_TYPE, "Event Type") {
+ public String getCategory() {
+ return "General";
+ }
+ }
+ };
+
public Object getEditableValue() {
return null;
}
public IPropertyDescriptor[] getPropertyDescriptors() {
- return new IPropertyDescriptor[0];
+ return propertyDescriptors;
}
public Object getPropertyValue(Object id) {
- if ("listener".equals(id)) {
+ if (LISTENERS.equals(id)) {
return listeners;
+ } else if (EVENT_TYPE.equals(id)) {
+ return getEventType() != null ? getEventType() : "";
}
return null;
}
public boolean isPropertySet(Object id) {
- if ("listener".equals(id)) {
+ if (LISTENERS.equals(id)) {
return true;
+ } else if (EVENT_TYPE.equals(id)) {
+ return getEventType() != null;
}
return false;
}
@@ -60,6 +76,11 @@
}
public void setPropertyValue(Object id, Object value) {
+ if (EVENT_TYPE.equals(id)) {
+ if (value instanceof String) {
+ setEventType((String)value);
+ }
+ }
}
}
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ClassNameSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ClassNameSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ClassNameSection.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -0,0 +1,69 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.jboss.tools.flow.jpdl4.model.EventListener;
+
+public class ClassNameSection extends JpdlPropertySection {
+
+ private Text classNameText;
+ private CLabel classNameLabel;
+
+ private ModifyListener textModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent arg0) {
+ changeProperty(EventListener.CLASS_NAME,
getValueNullsAllowed(classNameText.getText()));
+ }
+ };
+
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ Composite composite = getFlatFormComposite();
+ createEventTypeLabel(composite);
+ createEventTypeText(composite);
+ }
+
+
+ private void createEventTypeLabel(Composite parent) {
+ classNameLabel = getWidgetFactory().createCLabel(parent, "Class");
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 5);
+ classNameLabel.setLayoutData(data);
+ }
+
+ private void createEventTypeText(Composite parent) {
+ classNameText = getWidgetFactory().createText(parent, "");
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(classNameLabel, 0, SWT.RIGHT);
+ data.right = new FormAttachment(100, 0);
+ classNameText.setLayoutData(data);
+ }
+
+ protected void hookListeners() {
+ classNameText.addModifyListener(textModifyListener);
+ }
+
+ protected void unhookListeners() {
+ classNameText.removeModifyListener(textModifyListener);
+ }
+
+ protected void updateValues() {
+ IPropertySource input = getInput();
+ if (input != null) {
+ classNameText.setText(getValueNotNull((String)input.getPropertyValue(EventListener.CLASS_NAME)));
+ } else {
+ classNameText.setText("");
+ }
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/ClassNameSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventTypeSection.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventTypeSection.java
(rev 0)
+++
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventTypeSection.java 2009-04-29
17:04:11 UTC (rev 14964)
@@ -0,0 +1,69 @@
+package org.jboss.tools.flow.jpdl4.properties;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.jboss.tools.flow.jpdl4.model.EventListenerContainer;
+
+public class EventTypeSection extends JpdlPropertySection {
+
+ private Text eventTypeText;
+ private CLabel eventTypeLabel;
+
+ private ModifyListener textModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent arg0) {
+ changeProperty(EventListenerContainer.EVENT_TYPE,
getValueNullsAllowed(eventTypeText.getText()));
+ }
+ };
+
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ Composite composite = getFlatFormComposite();
+ createEventTypeLabel(composite);
+ createEventTypeText(composite);
+ }
+
+
+ private void createEventTypeLabel(Composite parent) {
+ eventTypeLabel = getWidgetFactory().createCLabel(parent, "Event Type");
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 5);
+ eventTypeLabel.setLayoutData(data);
+ }
+
+ private void createEventTypeText(Composite parent) {
+ eventTypeText = getWidgetFactory().createText(parent, "");
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(eventTypeLabel, 0, SWT.RIGHT);
+ data.right = new FormAttachment(100, 0);
+ eventTypeText.setLayoutData(data);
+ }
+
+ protected void hookListeners() {
+ eventTypeText.addModifyListener(textModifyListener);
+ }
+
+ protected void unhookListeners() {
+ eventTypeText.removeModifyListener(textModifyListener);
+ }
+
+ protected void updateValues() {
+ IPropertySource input = getInput();
+ if (input != null) {
+ eventTypeText.setText(getValueNotNull((String)input.getPropertyValue(EventListenerContainer.EVENT_TYPE)));
+ } else {
+ eventTypeText.setText("");
+ }
+ }
+
+}
Property changes on:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/properties/EventTypeSection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain