com.iternum.swlink
Class DefaultTwowayLink

java.lang.Object
  extended bycom.iternum.swlink.DefaultTwowayLink
All Implemented Interfaces:
EndpointObserver, Link, TwowayLink

public final class DefaultTwowayLink
extends java.lang.Object
implements TwowayLink

Default implementation of a TwowayLink.

Author:
Karl F. Banke

Constructor Summary
DefaultTwowayLink(Link pLink, Link pMirroredLink)
          Creates a mirrored connection from two input connections.
 
Method Summary
 void activate()
          No-op.
 void activate(java.lang.Object pSourceOverride)
          No-op.
 void close()
          Close the inherited links.
 Action getAction()
           
 Action getReverseAction()
          Return the mirrored Link.
 java.lang.Object getSource()
           
 java.lang.Object getTarget()
          The target of the link.
 boolean isActivateOnSetSource()
           
 boolean isActivateOnSetTarget()
           
 void setAction(Action pAction)
           
 void setActivateOnSetSource(boolean pIsActivate)
           
 void setActivateOnSetTarget(boolean pIsActivate)
           
 void setActivator(Activator pActivator)
          Sets the Activator for this link.
 void setReverseAction(Action pAction)
          Set the mirrored action.
 void setReverseActivtator(Activator pActivator)
          Set the reverse activator.
 void setSource(java.lang.Object pSource)
          Sets and registers the source of this link.
 void setSource(java.lang.Object pSource, java.lang.String pPath)
          Sets the source path of the link.
 void setTarget(java.lang.Object pTarget)
          Sets the TargetObject on the Link and the Source on its mirror.
 void setTarget(java.lang.Object pTarget, java.lang.String pPath)
          Sets the target path of the link.
 void sourceChanged(java.lang.Object pObject)
          Called if the source Proxy that this link is observing is changed.
 void targetChanged(java.lang.Object pObject)
          Called if the target Proxy that this link is observing is changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTwowayLink

public DefaultTwowayLink(Link pLink,
                         Link pMirroredLink)
Creates a mirrored connection from two input connections.

Parameters:
pLink - The "forward" link
pMirroredLink - The mirrored or "backward" link
Method Detail

activate

public void activate()
No-op.


activate

public void activate(java.lang.Object pSourceOverride)
No-op.

Parameters:
pSourceOverride - Ignored object

close

public void close()
Close the inherited links.

Specified by:
close in interface Link

getReverseAction

public Action getReverseAction()
Return the mirrored Link.

Specified by:
getReverseAction in interface TwowayLink
Returns:
The Action for the mirrored link
See Also:
TwowayLink.getReverseAction()

setReverseAction

public void setReverseAction(Action pAction)
Description copied from interface: TwowayLink
Set the mirrored action.

Specified by:
setReverseAction in interface TwowayLink
Parameters:
pAction - The Action for the mirrored link.
See Also:
(com.iternum.swlink.Action)

setReverseActivtator

public void setReverseActivtator(Activator pActivator)
Description copied from interface: TwowayLink
Set the reverse activator.

Specified by:
setReverseActivtator in interface TwowayLink
Parameters:
pActivator - The Activator for the mirrored link.
See Also:
(com.iternum.swlink.Action)

getAction

public Action getAction()
Specified by:
getAction in interface Link
Returns:
Action to invoke if this link is activated

getSource

public java.lang.Object getSource()
Specified by:
getSource in interface Link
Returns:
The source of this link (and the target of the mirrored link)

getTarget

public java.lang.Object getTarget()
Description copied from interface: Link
The target of the link.

Specified by:
getTarget in interface Link
Returns:
The TargetObject of this link.

setSource

public void setSource(java.lang.Object pSource)
Description copied from interface: Link
Sets and registers the source of this link. If the passed argument is of Type EndpointProxy the link add itself as an Observer with the EndpointProxy and uses the object wrapped in the proxy as the actual target

Specified by:
setSource in interface Link
Parameters:
pSource - - Sets the source on this object and the target on its link.

setTarget

public void setTarget(java.lang.Object pTarget)
Sets the TargetObject on the Link and the Source on its mirror.

Specified by:
setTarget in interface Link
Parameters:
pTarget - - The target to set

setSource

public void setSource(java.lang.Object pSource,
                      java.lang.String pPath)
Sets the source path of the link. The actual source object is resolved using nested propery of the source path. In case the source is an EndpointProxy, the source path applies to the wrapped object

Specified by:
setSource in interface Link
Parameters:
pSource - The source of the link or an EndpointProxy
pPath - The property path relative to pSource

setTarget

public void setTarget(java.lang.Object pTarget,
                      java.lang.String pPath)
Sets the target path of the link. The target object is resolved using the target path. In case the target object is an EndpointProxy, the target path applies to the wrapped object

Specified by:
setTarget in interface Link
Parameters:
pTarget - The target of the link or an EndpointProxy
pPath - The property path relative to pTarget

setAction

public void setAction(Action pAction)
Specified by:
setAction in interface Link
Parameters:
pAction - - Sets the target Action.

setActivator

public void setActivator(Activator pActivator)
Description copied from interface: Link
Sets the Activator for this link. Any Activator still connected with the link is closed.

Specified by:
setActivator in interface Link
Parameters:
pActivator - - Sets the activator of the link.

targetChanged

public void targetChanged(java.lang.Object pObject)
Called if the target Proxy that this link is observing is changed.

Specified by:
targetChanged in interface EndpointObserver
Parameters:
pObject - - The changed proxied value

sourceChanged

public void sourceChanged(java.lang.Object pObject)
Called if the source Proxy that this link is observing is changed.

Specified by:
sourceChanged in interface EndpointObserver
Parameters:
pObject - - The changed proxied value

isActivateOnSetSource

public boolean isActivateOnSetSource()
Specified by:
isActivateOnSetSource in interface Link
Returns:
code if the link activates on set source
See Also:
Link.isActivateOnSetSource()

setActivateOnSetSource

public void setActivateOnSetSource(boolean pIsActivate)
Specified by:
setActivateOnSetSource in interface Link
Parameters:
pIsActivate - - true to activate the link on setSource()
See Also:
Link.setActivateOnSetSource(boolean)

isActivateOnSetTarget

public boolean isActivateOnSetTarget()
Specified by:
isActivateOnSetTarget in interface TwowayLink
Returns:
code if the link activates on set source

setActivateOnSetTarget

public void setActivateOnSetTarget(boolean pIsActivate)
Specified by:
setActivateOnSetTarget in interface TwowayLink
Parameters:
pIsActivate - - true to activate the link on setSource()