From: <jhs...@us...> - 2009-02-09 18:26:31
|
Revision: 129 http://flexotask.svn.sourceforge.net/flexotask/?rev=129&view=rev Author: jhspring Date: 2009-02-09 18:26:28 +0000 (Mon, 09 Feb 2009) Log Message: ----------- added support for port buffering change propagation, see 2582312 Modified Paths: -------------- trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Connection.java trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/NormalTask.java 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-09 17:01:13 UTC (rev 128) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/Connection.java 2009-02-09 18:26:28 UTC (rev 129) @@ -95,6 +95,9 @@ /** Indicates that type information is being propagated; stops cyclic propagation if true */ private boolean propagatingType; + /** Indicates that port buffering status is being propagated; stops cyclic propagation if true */ + private boolean propagatingPortBuffering; + /** Connection's source endpoint. */ private Task source; @@ -533,6 +536,8 @@ */ public void setSourcePortBuffering(boolean value) { sourcePortBuffering = value; + propagatePortBuffering((NormalTask) source, value, sourcePortName, true); + computeToolTipAndColor(); } /** @@ -541,9 +546,22 @@ */ public void setTargetPortBuffering(boolean value) { targetPortBuffering = value; + propagatePortBuffering((NormalTask) target, value, targetPortName, false); + computeToolTipAndColor(); } /** + * Propagate a newly-set buffering status to all connections connected to that + * port + */ + private void propagatePortBuffering(NormalTask task, boolean newValue, String name, boolean isSourcePort) + { + propagatingPortBuffering = true; + task.propagatingPortBuffering(newValue, name, isSourcePort); + propagatingPortBuffering = false; + } + + /** * Sets the buffering of the source or target port of the provided task. * @param isTarget true iff it is the target port name that is changing (source otherwise) * @param task the NormalTask that is affected by the change @@ -561,6 +579,8 @@ portDecl.isBuffered = isBuffered; task.portDeclarationsChanged(); firePropertyChange(PORT_DECLARATION_CHANGED_PROP, null, portDecl); + propagatePortBuffering(task, isBuffered, portName, !isTarget); + computeToolTipAndColor(); } /** 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-09 17:01:13 UTC (rev 128) +++ trunk/flexotask-editor/src/com/ibm/realtime/flexotask/editor/model/NormalTask.java 2009-02-09 18:26:28 UTC (rev 129) @@ -128,6 +128,9 @@ /** True while propagating type information to stop endless cycling */ private boolean propagatingType; + /** True while propagating port buffering status to stop endless cycling */ + private boolean propagatingPortBuffering; + /** * Create a new NormalTask */ @@ -610,6 +613,31 @@ } /** + * Function to handle incoming propagation of port buffer change + * @param newValue the new value to being set + * @param portName the name of the port by which the change is being propagated + * @param isSourcePort true if the portName names a source port, false for a target port + */ + void propagatingPortBuffering(boolean newValue, String portName, boolean isSourcePort) + { + if (propagatingPortBuffering) { + return; + } + List<Connection> conns = isSourcePort ? getOutgoingConnections() : getIncomingConnections(); + propagatingPortBuffering = true; + for (Connection conn : conns) { + String match = isSourcePort ? conn.getSourcePortName() : conn.getTargetPortName(); + if (match.equals(portName)) { + if (isSourcePort) + conn.setSourcePortBuffering(newValue); + else + conn.setTargetPortBuffering(newValue); + } + } + propagatingPortBuffering = false; + } + + /** * Set the predicate property. Only called from subclass constructor * @param predicate the new value of the predicate property */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |