org.simbrain.network.nodes
Class SynapseNode

java.lang.Object
  extended by edu.umd.cs.piccolo.PNode
      extended by org.simbrain.network.nodes.ScreenElement
          extended by org.simbrain.network.nodes.SynapseNode
All Implemented Interfaces:
Printable, Serializable, Cloneable

public final class SynapseNode
extends ScreenElement

SynapseNode is a Piccolo PNode corresponding to a Neuron in the neural network model.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.umd.cs.piccolo.PNode
PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
SynapseNode()
          Default constructor; used by Castor.
SynapseNode(NetworkPanel net, NeuronNode source, NeuronNode target, Synapse synapse)
          Create a new synapse node connecting a source and target neuron.
 
Method Summary
 Point2D calcCenter(Point2D src, Point2D tar)
          Calculates the position of the synapse circle based on the positions of the source and target NeuronNodes.
protected  JPopupMenu getContextMenu()
          Return a context menu specific to this screen element.
protected  JDialog getPropertyDialog()
          Return a property dialog for this screen element.
 NeuronNode getSource()
           
 Synapse getSynapse()
           
 NeuronNode getTarget()
           
protected  String getToolTipText()
          Return a String to use as tool tip text for this screen element.
 boolean hasContextMenu()
          Return true if this screen element has a context menu.
protected  boolean hasPropertyDialog()
          Return true if this screen element has a property dialog.
protected  boolean hasToolTipText()
          Return true if this screen element has tool tip text.
 void initCastor(NetworkPanel net)
          Initializes relevant data after a ScreenElement has been unmarshalled via Castor.
 boolean isDraggable()
          Return true if this screen element is draggable.
 boolean isSelectable()
          Return true if this screen element is selectable.
 void resetColors()
          Reset colors when default colors have been changed in NetworkPreferences.
 void setSource(NeuronNode source)
           
 void setSynapse(Synapse synapse)
           
 void setTarget(NeuronNode target)
           
 boolean showSelectionHandle()
          Return true if this screen element should show a selection handle.
 String toString()
          Returns String representation of this NeuronNode.
 void updateColor()
          Calculates the color for a weight, based on its current strength.
 void updateDiameter()
          Update the diameter of the drawn weight based on the logical weight's strength.
 void updatePosition()
          Update position of synapse.
 
Methods inherited from class org.simbrain.network.nodes.ScreenElement
getNetworkPanel, setNetworkPanel
 
Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToTransform, animateToTransparency, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperty, getClientPropertyKeysIterator, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getInverseTransform, getListenerList, getLocalToGlobalTransform, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, intersects, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paint, paintAfterChildren, paramString, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynapseNode

public SynapseNode()
Default constructor; used by Castor.


SynapseNode

public SynapseNode(NetworkPanel net,
                   NeuronNode source,
                   NeuronNode target,
                   Synapse synapse)
Create a new synapse node connecting a source and target neuron.

Parameters:
net - Reference to NetworkPanel
source - source neuronnode
target - target neuronmode
synapse - the model synapse this PNode represents
Method Detail

initCastor

public void initCastor(NetworkPanel net)
Description copied from class: ScreenElement
Initializes relevant data after a ScreenElement has been unmarshalled via Castor.

Overrides:
initCastor in class ScreenElement
Parameters:
net - network panel
See Also:
ScreenElement

updatePosition

public void updatePosition()
Update position of synapse.


updateColor

public void updateColor()
Calculates the color for a weight, based on its current strength. Positive values are (for example) red, negative values blue.


updateDiameter

public void updateDiameter()
Update the diameter of the drawn weight based on the logical weight's strength.


calcCenter

public Point2D calcCenter(Point2D src,
                          Point2D tar)
Calculates the position of the synapse circle based on the positions of the source and target NeuronNodes.

Parameters:
src - Source NeuronNode
tar - Target NeuronNode
Returns:
the appropriate position for the synapse circle

isSelectable

public boolean isSelectable()
Description copied from class: ScreenElement
Return true if this screen element is selectable.

Being selectable requires that this screen element is pickable as far as the Piccolo API is concerned, so if this method returns true, be sure that this class also returns true for its getPickable() method.

Specified by:
isSelectable in class ScreenElement
Returns:
true if this screen element is selectable
See Also:
ScreenElement

showSelectionHandle

public boolean showSelectionHandle()
Description copied from class: ScreenElement
Return true if this screen element should show a selection handle.

Showing a selection handle requires that this screen element is pickable as far as the Piccolo API is concerned, so if this method returns true, be sure that this class also returns true for its getPickable() method.

Showing a selection handle also requires that this screen element is selectable, so if this method returns true, be sure that this class also returns true for its isSelectable() method.

Specified by:
showSelectionHandle in class ScreenElement
Returns:
true if this screen element should show a selection handle
See Also:
ScreenElement

isDraggable

public boolean isDraggable()
Description copied from class: ScreenElement
Return true if this screen element is draggable.

Being draggable requires that this screen element is pickable as far as the Piccolo API is concerned, so if this method returns true, be sure that this class also returns true for its getPickable() method.

Being draggable also requires that this screen element is selectable, so if this method returns true, be sure that this class also returns true for its isSelectable() method.

Specified by:
isDraggable in class ScreenElement
Returns:
true if this screen element is draggable
See Also:
ScreenElement

hasToolTipText

protected boolean hasToolTipText()
Description copied from class: ScreenElement
Return true if this screen element has tool tip text. If this screen element does not have tool tip text, a tool tip event handler will not be registered.

Specified by:
hasToolTipText in class ScreenElement
Returns:
true if this screen element has tool tip text
See Also:
ScreenElement

getToolTipText

protected String getToolTipText()
Description copied from class: ScreenElement
Return a String to use as tool tip text for this screen element. Return null if this screen element does not have tool tip text or to temporarily prevent the tool tip from displaying.

Specified by:
getToolTipText in class ScreenElement
Returns:
a String to use as tool tip text for this screen element
See Also:
ScreenElement

hasContextMenu

public boolean hasContextMenu()
Description copied from class: ScreenElement
Return true if this screen element has a context menu. If this screen element does not have a context menu, a context menu event handler will not be registered.

Specified by:
hasContextMenu in class ScreenElement
Returns:
true if this screen element has a context menu.
See Also:
ScreenElement

getContextMenu

protected JPopupMenu getContextMenu()
Description copied from class: ScreenElement
Return a context menu specific to this screen element. Return null if this screen element does not have a context menu.

Specified by:
getContextMenu in class ScreenElement
Returns:
a context menu specific to this screen element
See Also:
ScreenElement

hasPropertyDialog

protected boolean hasPropertyDialog()
Description copied from class: ScreenElement
Return true if this screen element has a property dialog. If this screen element does not have a property dialog, a property dialog event handler will not be registered.

Specified by:
hasPropertyDialog in class ScreenElement
Returns:
true if this screen element has a property dialog
See Also:
ScreenElement

getPropertyDialog

protected JDialog getPropertyDialog()
Description copied from class: ScreenElement
Return a property dialog for this screen element. Return null if this screen element does not have a property dialog.

Specified by:
getPropertyDialog in class ScreenElement
Returns:
a property dialog for this screen element
See Also:
ScreenElement

toString

public String toString()
Returns String representation of this NeuronNode.

Overrides:
toString in class PNode
Returns:
String representation of this node.

getSynapse

public Synapse getSynapse()
Returns:
Returns the synapse.

setSynapse

public void setSynapse(Synapse synapse)
Parameters:
synapse - The synapse to set.

getSource

public NeuronNode getSource()
Returns:
Returns the source.

getTarget

public NeuronNode getTarget()
Returns:
Returns the target.

setSource

public void setSource(NeuronNode source)
Parameters:
source - The source to set.

setTarget

public void setTarget(NeuronNode target)
Parameters:
target - The target to set.

resetColors

public void resetColors()
Description copied from class: ScreenElement
Reset colors when default colors have been changed in NetworkPreferences.

Specified by:
resetColors in class ScreenElement
See Also:
ScreenElement