From: <jhs...@us...> - 2009-02-02 20:49:18
|
Revision: 124 http://flexotask.svn.sourceforge.net/flexotask/?rev=124&view=rev Author: jhspring Date: 2009-02-02 20:49:06 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Improve model signaling - ID: 2558172 Modified Paths: -------------- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Communicator.java trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Connection.java trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/ModelElement.java trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/NormalTask.java trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Task.java Modified: trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Communicator.java =================================================================== --- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Communicator.java 2009-02-02 15:40:27 UTC (rev 123) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Communicator.java 2009-02-02 20:49:06 UTC (rev 124) @@ -48,6 +48,12 @@ /** Property ID for the initialValue property */ private static final int INITIAL_VALUE = 2; + /** Property id for type property */ + private static final String TYPE_PROP = "Communicator.Type"; + + /** Property id for type property */ + private static final String INITIAL_VALUE_PROP = "Communicator.InitialValue"; + /** The type of this special task, as a full Java class name */ private String type = ""; @@ -234,14 +240,19 @@ if (id instanceof ModelProperty) { switch(((ModelProperty) id).id) { case ID: + String oldName = getName(); setName((String) value); - firePropertyChange(LABEL_PROP, null, value); + firePropertyChange(LABEL_PROP, oldName, value); break; case TYPE: + String oldType = getType(); setType(value.toString()); + firePropertyChange(TYPE_PROP, oldType, value); break; case INITIAL_VALUE: + String oldInitialValue = getInitialValue(); setInitialValue((String) value); + firePropertyChange(INITIAL_VALUE_PROP, oldInitialValue, value); break; } } else { Modified: trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Connection.java =================================================================== --- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Connection.java 2009-02-02 15:40:27 UTC (rev 123) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Connection.java 2009-02-02 20:49:06 UTC (rev 124) @@ -69,6 +69,21 @@ /** Property id for targetPortBuffering property */ private static final int TARGET_PORT_BUFFERING = 6; + /** Property ID to use when the connection type changed. */ + public static final String TYPE_PROP = "Connection.Type"; + + /** Property ID to use when the connection mode changed. */ + public static final String CONNECTION_MODE_PROP = "Connection.ConnectionMode"; + + /** Property ID to use when the source port buffering changed. */ + public static final String SOURCE_PORT_BUFFERING_PROP = "Connection.SourcePortBuffering"; + + /** Property ID to use when the target port buffering changed. */ + public static final String TARGET_PORT_BUFFERING_PROP = "Connection.TargetPortBuffering"; + + /** Property ID to use when the port declaration property changed. */ + public static final String PORT_DECLARATION_CHANGED_PROP = "Connection.PortDeclarationChanged"; + /** True, if the connection is attached to its endpoints. */ private boolean isConnected; @@ -480,9 +495,13 @@ setTargetPortName((String) null); return; case SOURCE_PORT_BUFFERING: + setSourcePortBuffering(false); + firePropertyChange(SOURCE_PORT_BUFFERING_PROP, null, false); + return; case TARGET_PORT_BUFFERING: - setSourcePortBuffering(false); setTargetPortBuffering(false); + firePropertyChange(TARGET_PORT_BUFFERING_PROP, null, false); + return; case TYPE: setType(""); return; @@ -541,6 +560,7 @@ PortDeclaration portDecl = decls.get(portName); portDecl.isBuffered = isBuffered; task.portDeclarationsChanged(); + firePropertyChange(PORT_DECLARATION_CHANGED_PROP, null, portDecl); } /** @@ -581,6 +601,7 @@ } /* In any case, we notify the task that connectivity to ports has changed */ task.portDeclarationsChanged(); + firePropertyChange(PORT_DECLARATION_CHANGED_PROP, null, latter); } else if (newPort.rename) { /* The new name is to be considered a renaming. This is propagated specially. */ task.portRenamed(former.name, newName, !isTarget); @@ -590,6 +611,7 @@ latter = new PortDeclaration(type, newName); decls.add(latter); task.portDeclarationsChanged(); + firePropertyChange(PORT_DECLARATION_CHANGED_PROP, null, latter); } } @@ -611,26 +633,35 @@ break; case SOURCE_PORT_BUFFERING: { task = (NormalTask) source; + boolean oldValue = sourcePortBuffering; final boolean buffering = ((Integer) value).intValue() == 0; setPortBuffering(false, task, task.getOutputPortDeclarations(), buffering); sourcePortBuffering = ((Integer) value).intValue() == 0; + firePropertyChange(SOURCE_PORT_BUFFERING_PROP, oldValue, sourcePortBuffering); break; } case TARGET_PORT_BUFFERING: { task = (NormalTask) target; + boolean oldValue = targetPortBuffering; final boolean buffering = ((Integer) value).intValue() == 0; setPortBuffering(true, task, task.getInputPortDeclarations(), buffering); targetPortBuffering = ((Integer) value).intValue() == 0; + firePropertyChange(TARGET_PORT_BUFFERING_PROP, oldValue, targetPortBuffering); break; } case TYPE: + String type = getType(); setType(value == null ? null : value.toString()); + firePropertyChange(TYPE_PROP, type, value); break; case MODE: + FlexotaskConnectionMode oldMode = getMode(); setMode(FlexotaskConnectionMode.getConnectionMode((Integer) value)); + firePropertyChange(CONNECTION_MODE_PROP, oldMode, mode); break; case ID: setName(value == null ? null : value.toString()); + firePropertyChange(LABEL_PROP, null, value); break; } } else { @@ -747,6 +778,7 @@ /* Generate a new entry */ PortDeclaration ans = new PortDeclaration(type, stem + portDeclarations.size()); portDeclarations.add(ans); + firePropertyChange(PORT_DECLARATION_CHANGED_PROP, null, ans); return ans; } Modified: trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/ModelElement.java =================================================================== --- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/ModelElement.java 2009-02-02 15:40:27 UTC (rev 123) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/ModelElement.java 2009-02-02 20:49:06 UTC (rev 124) @@ -50,6 +50,9 @@ * <p>This class provides property-change support (used to notify edit parts of model changes). */ public abstract class ModelElement implements IPropertySource{ + /** Property ID to use when the label text of this shape is modified */ + public static final String LABEL_PROP = "Shape.LabelText"; + /** Property ID to use when the color of this shape or connection is modified. */ public static final String COLOR_PROP = "Shape.Color"; Modified: trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/NormalTask.java =================================================================== --- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/NormalTask.java 2009-02-02 15:40:27 UTC (rev 123) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/NormalTask.java 2009-02-02 20:49:06 UTC (rev 124) @@ -78,6 +78,18 @@ /** The property ID for parameterValue */ private static final int PARAMETER_VALUE = 6; + /** Property ID to use when the implementation class changed. */ + public static final String IMPLEMENTATION_PROP = "NormalTask.ImplementationChanged"; + + /** Property ID to use when the parameter type changed. */ + public static final String PARAMETER_TYPE_PROP = "NormalTask.ParameterTypeChanged"; + + /** Property ID to use when the parameter value changed. */ + public static final String PARAMETER_VALUE_PROP = "NormalTask.ParameterValueChanged"; + + /** Property ID to use when the isolation property changed. */ + public static final String ISOLATION_PROP = "NormalTask.IsolationChanged"; + /** A list of labels for tooltip display representing conflicts found at implementation validation * time and for which no automatic resolution was possible */ private List<Label> conflicts = new ArrayList<Label>(); @@ -392,16 +404,24 @@ firePropertyChange(LABEL_PROP, null, getName()); break; case IMPLEMENTATION: + String implementation = getImplementation(); setImplementation(""); + firePropertyChange(IMPLEMENTATION_PROP, implementation, ""); break; case PARAMETER_TYPE: + String parameterType = getParameterType(); setParameterType(""); + firePropertyChange(PARAMETER_TYPE_PROP, parameterType, ""); break; case PARAMETER_VALUE: + String parameterValue = getParameterValue(); setParameterValue(""); + firePropertyChange(PARAMETER_VALUE_PROP, parameterValue, ""); break; case ISOLATION: + boolean isolation = getCommunicating(); setCommunicating(false); + firePropertyChange(ISOLATION_PROP, isolation, false); break; } } else { @@ -412,6 +432,14 @@ } } } + + /** + * Returns true if this task is a communicating task, otherwise false + * @param true if this task is a communicating task, otherwise false + */ + public boolean getCommunicating() { + return communicating; + } /** * Indicates that this task is a communicating task @@ -490,16 +518,24 @@ firePropertyChange(LABEL_PROP, null, getName()); break; case IMPLEMENTATION: + String implementation = getImplementation(); setImplementationType(((ClassWrapper) value).classType); + firePropertyChange(IMPLEMENTATION_PROP, implementation, getImplementation()); break; case PARAMETER_TYPE: + String parameterType = getParameterType(); setParameterType(value.toString()); + firePropertyChange(PARAMETER_TYPE_PROP, parameterType, getParameterType()); break; case PARAMETER_VALUE: + String parameterValue = getParameterValue(); setParameterValue((String) value); + firePropertyChange(PARAMETER_VALUE_PROP, parameterValue, getParameterValue()); break; case ISOLATION: + boolean isolation = getCommunicating(); setCommunicating(((Integer) value).intValue() > 0); + firePropertyChange(ISOLATION_PROP, isolation, getCommunicating()); break; } } else { Modified: trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Task.java =================================================================== --- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Task.java 2009-02-02 15:40:27 UTC (rev 123) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Task.java 2009-02-02 20:49:06 UTC (rev 124) @@ -40,8 +40,6 @@ */ public abstract class Task extends ShapedModelElement { - /** Property ID to use when the label text of this shape is modified */ - public static final String LABEL_PROP = "Shape.LabelText"; /** Property ID to use when the list of outgoing connections is modified. */ public static final String SOURCE_CONNECTIONS_PROP = "Shape.SourceConn"; /** Property ID to use when the list of incoming connections is modified. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |