org.simbrain.network.nodes
Class SubnetworkNode

java.lang.Object
  extended by edu.umd.cs.piccolo.PNode
      extended by org.simbrain.network.nodes.ScreenElement
          extended by org.simbrain.network.nodes.SubnetworkNode
All Implemented Interfaces:
Printable, PropertyChangeListener, Serializable, Cloneable, EventListener
Direct Known Subclasses:
BackpropNetworkNode, CompetitiveNetworkNode, ElmanNetworkNode, HopfieldNetworkNode, LMSNetworkNode, StandardNetworkNode, WTANetworkNode

public abstract class SubnetworkNode
extends ScreenElement
implements PropertyChangeListener

Abstract subnetwork node.

See Also:
Serialized Form

Field Summary
static double OUTLINE_INSET_HEIGHT
          Outline inset or border height.
static double OUTLINE_INSET_WIDTH
          Outline inset or border width.
static double TAB_HEIGHT
          Tab height.
 
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
protected SubnetworkNode(NetworkPanel networkPanel, Network subnetwork, double x, double y)
          Create a new abstract subnetwork node from the specified parameters.
 
Method Summary
 void addChild(PNode child)
           
protected  JPopupMenu getContextMenu()
          Return a context menu specific to this screen element.
 String getLabel()
          Return the label for this subnetwork node.
 Stroke getOutlineStroke()
          Return the outline stroke for this subnetwork node.
 Paint getOutlineStrokePaint()
          Return the outline stroke paint for this subnetwork node.
 Action getSetPropertiesAction()
           
 Network getSubnetwork()
          Return the subnetwork for this subnetwork node.
 Paint getTabPaint()
          Return the tab paint for this subnetwork node.
 Stroke getTabStroke()
          Return the tab stroke for this subnetwork node.
 Paint getTabStrokePaint()
          Return the tab stroke paint for this subnetwork node.
 boolean isDraggable()
          Return true if this screen element is draggable.
 boolean isSelectable()
          Return true if this screen element is selectable.
protected  void layoutChildren()
           
 void propertyChange(PropertyChangeEvent event)
           
 PNode removeChild(PNode child)
           
 void resetColors()
          Reset colors when default colors have been changed in NetworkPreferences.
 void setLabel(String label)
          Set the label for this subnetwork node to label.
 void setOutlineStroke(Stroke outlineStroke)
          Set the outline stroke for this subnetwork node to outlineStroke.
 void setOutlineStrokePaint(Paint outlineStrokePaint)
          Set the outline stroke paint for this subnetwork node to outlineStrokePaint.
 void setSetPropertiesAction(Action setPropertiesAction)
           
 void setShowOutline(boolean showOutline)
          Set to true if this subnetwork node is to show its outline.
 void setTabPaint(Paint tabPaint)
          Set the tab paint for this subnetwork node to tabPaint.
 void setTabStroke(Stroke tabStroke)
          Set the tab stroke for this subnetwork node to tabStroke.
 void setTabStrokePaint(Paint tabStrokePaint)
          Set the tab stroke paint for this subnetwork node to tabStrokePaint.
 boolean showSelectionHandle()
          Return true if this screen element should show a selection handle.
 
Methods inherited from class org.simbrain.network.nodes.ScreenElement
getNetworkPanel, getPropertyDialog, getToolTipText, hasContextMenu, hasPropertyDialog, hasToolTipText, initCastor, setNetworkPanel
 
Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, 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, 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, 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, toString, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAB_HEIGHT

public static final double TAB_HEIGHT
Tab height.

See Also:
Constant Field Values

OUTLINE_INSET_HEIGHT

public static final double OUTLINE_INSET_HEIGHT
Outline inset or border height.

See Also:
Constant Field Values

OUTLINE_INSET_WIDTH

public static final double OUTLINE_INSET_WIDTH
Outline inset or border width.

See Also:
Constant Field Values
Constructor Detail

SubnetworkNode

protected SubnetworkNode(NetworkPanel networkPanel,
                         Network subnetwork,
                         double x,
                         double y)
Create a new abstract subnetwork node from the specified parameters.

Parameters:
networkPanel - networkPanel for this subnetwork node, must not be null
subnetwork - subnetwork for this subnetwork node, must not be null
x - x offset for this subnetwork node
y - y offset for this subnetwork node
Method Detail

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

setShowOutline

public void setShowOutline(boolean showOutline)
Set to true if this subnetwork node is to show its outline.

This is a bound property.

Parameters:
showOutline - true if this subnetwork node is to show its outline

isSelectable

public final 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 final 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 final 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

resetColors

public final 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

getLabel

public final String getLabel()
Return the label for this subnetwork node. The label may be null.

Returns:
the label for this subnetwork node

setLabel

public void setLabel(String label)
Set the label for this subnetwork node to label.

This is a bound property.

Parameters:
label - label for this subnetwork node

getSubnetwork

public final Network getSubnetwork()
Return the subnetwork for this subnetwork node. The subnetwork will not be null.

Returns:
the subnetwork for this subnetwork node

getTabPaint

public final Paint getTabPaint()
Return the tab paint for this subnetwork node. The tab paint may be null.

Returns:
the tab paint for this subnetwork node

setTabPaint

public final void setTabPaint(Paint tabPaint)
Set the tab paint for this subnetwork node to tabPaint.

This is a bound property.

Parameters:
tabPaint - tab paint for this subnetwork node

getTabStroke

public final Stroke getTabStroke()
Return the tab stroke for this subnetwork node. The tab stroke may be null.

Returns:
the tab stroke for this subnetwork node

setTabStroke

public final void setTabStroke(Stroke tabStroke)
Set the tab stroke for this subnetwork node to tabStroke.

This is a bound property.

Parameters:
tabStroke - tab stroke for this subnetwork node

getTabStrokePaint

public final Paint getTabStrokePaint()
Return the tab stroke paint for this subnetwork node. The tab stroke paint may be null.

Returns:
the tab stroke paint for this subnetwork node

setTabStrokePaint

public final void setTabStrokePaint(Paint tabStrokePaint)
Set the tab stroke paint for this subnetwork node to tabStrokePaint.

This is a bound property.

Parameters:
tabStrokePaint - tab stroke paint for this subnetwork node

getOutlineStroke

public final Stroke getOutlineStroke()
Return the outline stroke for this subnetwork node. The outline stroke may be null.

Returns:
the outline stroke for this subnetwork node

setOutlineStroke

public final void setOutlineStroke(Stroke outlineStroke)
Set the outline stroke for this subnetwork node to outlineStroke.

This is a bound property.

Parameters:
outlineStroke - outline stroke for this subnetwork node

getOutlineStrokePaint

public final Paint getOutlineStrokePaint()
Return the outline stroke paint for this subnetwork node. The outline stroke paint may be null.

Returns:
the outline stroke paint for this subnetwork node

setOutlineStrokePaint

public final void setOutlineStrokePaint(Paint outlineStrokePaint)
Set the outline stroke paint for this subnetwork node to outlineStrokePaint.

This is a bound property.

Parameters:
outlineStrokePaint - outline stroke paint for this subnetwork node

layoutChildren

protected void layoutChildren()
Overrides:
layoutChildren in class PNode
See Also:
PNode

addChild

public void addChild(PNode child)
Overrides:
addChild in class PNode
See Also:
PNode

removeChild

public PNode removeChild(PNode child)
Overrides:
removeChild in class PNode
See Also:
PNode

propertyChange

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

getSetPropertiesAction

public Action getSetPropertiesAction()
Returns:
Returns the setPropertiesAction.

setSetPropertiesAction

public void setSetPropertiesAction(Action setPropertiesAction)
Parameters:
setPropertiesAction - The setPropertiesAction to set.