org.simbrain.network.nodes
Class NeuronNode

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

public class NeuronNode
extends ScreenElement
implements ActionListener, PropertyChangeListener

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

See Also:
Serialized Form

Field Summary
static Font IN_OUT_FONT
          Font for input and output labels.
static Font NEURON_FONT
          Neuron Font.
static Font NEURON_FONT_BOLD
          Neuron font bold.
static Font NEURON_FONT_SMALL
          Neuron font small.
static Font NEURON_FONT_VERYSMALL
          Neuron font very small.
 
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
NeuronNode()
          Default constructor; used by Castor.
NeuronNode(double x, double y)
          Initialize a NeuronNode to a location.
NeuronNode(NetworkPanel net, Neuron neuron)
          Create a new neuron node.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
protected  JPopupMenu createContextMenu()
           
 Point2D getCenter()
          Return the center of this node (the circle) in global coordinates.
 Set getConnectedSynapses()
           
protected  JPopupMenu getContextMenu()
          Return a context menu specific to this screen element.
static int getDIAMETER()
           
 String getId()
           
 Neuron getNeuron()
          Return the neuron for this neuron node.
protected  JDialog getPropertyDialog()
          Return a property dialog for this screen element.
protected  String getToolTipText()
          Return a String to use as tool tip text for this screen element.
 double getXpos()
           
 double getYpos()
           
protected  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 propertyChange(PropertyChangeEvent event)
           
 void resetColors()
          Reset colors when default colors have been changed in NetworkPreferences.
 void setId(String id)
           
 void setNeuron(Neuron neuron)
          Set the neuron for this neuron node to neuron.
 void setXpos(double xpos)
           
 void setYpos(double ypos)
           
 boolean showSelectionHandle()
          Return true if this screen element should show a selection handle.
 String toString()
          Returns String representation of this NeuronNode.
 void update()
          Update the neuron view based on the model neuron.
 void updateAttachmentStatus()
          Change the color of input and output nodes to reflect whether they are 'attached' to an agent in a world.
 void updateInArrow()
          Updates graphics depending on whether this is an input node or not.
 void updateInLabel()
          Update the label showing sensory coupling information.
 void updateModelNeuronPosition()
          Update the position of the model neuron based on the global coordinates of this pnode.
 void updateOutArrow()
          Updates graphics depending on whether this is an output node or not.
 void updateOutLabel()
          Update the label showing sensory coupling information.
 void updateSynapseNodePositions()
          Update connected synapse node positions.
 
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
 

Field Detail

IN_OUT_FONT

public static final Font IN_OUT_FONT
Font for input and output labels.


NEURON_FONT

public static final Font NEURON_FONT
Neuron Font.


NEURON_FONT_BOLD

public static final Font NEURON_FONT_BOLD
Neuron font bold.


NEURON_FONT_SMALL

public static final Font NEURON_FONT_SMALL
Neuron font small.


NEURON_FONT_VERYSMALL

public static final Font NEURON_FONT_VERYSMALL
Neuron font very small.

Constructor Detail

NeuronNode

public NeuronNode()
Default constructor; used by Castor.


NeuronNode

public NeuronNode(double x,
                  double y)
Initialize a NeuronNode to a location. Used by Castor.

Parameters:
x - x coordinate of NeuronNode
y - y coordinate of NeuronNode

NeuronNode

public NeuronNode(NetworkPanel net,
                  Neuron neuron)
Create a new neuron node.

Parameters:
net - Reference to NetworkPanel
neuron - reference to model neuron
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

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

protected 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

getCenter

public Point2D getCenter()
Return the center of this node (the circle) in global coordinates.

Returns:
the center point of this node.

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

update

public void update()
Update the neuron view based on the model neuron.


updateInArrow

public void updateInArrow()
Updates graphics depending on whether this is an input node or not.


updateOutArrow

public void updateOutArrow()
Updates graphics depending on whether this is an output node or not.


updateInLabel

public void updateInLabel()
Update the label showing sensory coupling information.


updateOutLabel

public void updateOutLabel()
Update the label showing sensory coupling information.


toString

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

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

getNeuron

public Neuron getNeuron()
Return the neuron for this neuron node.

Returns:
the neuron for this neuron node

setNeuron

public void setNeuron(Neuron neuron)
Set the neuron for this neuron node to neuron.

This is a bound property.

Parameters:
neuron - neuron for this neuron node

createContextMenu

protected JPopupMenu createContextMenu()
See Also:
ScreenElement

propertyChange

public void propertyChange(PropertyChangeEvent event)
Specified by:
propertyChange in interface PropertyChangeListener
See Also:
PropertyChangeListener

updateModelNeuronPosition

public void updateModelNeuronPosition()
Update the position of the model neuron based on the global coordinates of this pnode.


actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener
See Also:
ActionListener

getDIAMETER

public static int getDIAMETER()
Returns:
Returns the DIAMETER.

getConnectedSynapses

public Set getConnectedSynapses()
Returns:
Connected synapses.

updateSynapseNodePositions

public void updateSynapseNodePositions()
Update connected synapse node positions.


getId

public String getId()
Returns:
Returns the id.

setId

public void setId(String id)
Parameters:
id - The id to set.

getXpos

public double getXpos()
Returns:
Returns the xpos.

setXpos

public void setXpos(double xpos)
Parameters:
xpos - The xpos to set.

getYpos

public double getYpos()
Returns:
Returns the ypos.

setYpos

public void setYpos(double ypos)
Parameters:
ypos - The ypos to set.

updateAttachmentStatus

public void updateAttachmentStatus()
Change the color of input and output nodes to reflect whether they are 'attached' to an agent in a world.


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