org.simbrain.network.nodes
Class ScreenElement

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

public abstract class ScreenElement
extends PNode

ScreenElement extends a Piccolo node with property change, tool tip, property dialog, and ... support.

Subclasses of this class must implement the following methods:

 protected abstract boolean isSelectable();
 protected abstract boolean showSelectionHandle();
 protected abstract boolean isDraggable();
 protected abstract boolean hasToolTipText();
 protected abstract String getToolTipText();
 protected abstract boolean hasContextMenu();
 protected abstract JPopupMenu getContextMenu();
 protected abstract boolean hasPropertyDialog();
 protected abstract JDialog getPropertyDialog();
 

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
  ScreenElement()
          Default Constructor.
protected ScreenElement(NetworkPanel networkPanel)
          Create a new abstract screen element with the specified network panel.
 
Method Summary
protected abstract  JPopupMenu getContextMenu()
          Return a context menu specific to this screen element.
 NetworkPanel getNetworkPanel()
          Return the network panel for this screen element.
protected abstract  JDialog getPropertyDialog()
          Return a property dialog for this screen element.
protected abstract  String getToolTipText()
          Return a String to use as tool tip text for this screen element.
protected abstract  boolean hasContextMenu()
          Return true if this screen element has a context menu.
protected abstract  boolean hasPropertyDialog()
          Return true if this screen element has a property dialog.
protected abstract  boolean hasToolTipText()
          Return true if this screen element has tool tip text.
 void initCastor(NetworkPanel networkPanel)
          Initializes relevant data after a ScreenElement has been unmarshalled via Castor.
abstract  boolean isDraggable()
          Return true if this screen element is draggable.
abstract  boolean isSelectable()
          Return true if this screen element is selectable.
abstract  void resetColors()
          Reset colors when default colors have been changed in NetworkPreferences.
 void setNetworkPanel(NetworkPanel networkPanel)
          Set the network panel for this screen element to networkPanel.
abstract  boolean showSelectionHandle()
          Return true if this screen element should show a selection handle.
 
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, toString, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScreenElement

public ScreenElement()
Default Constructor. Used by Castor.


ScreenElement

protected ScreenElement(NetworkPanel networkPanel)
Create a new abstract screen element with the specified network panel.

Parameters:
networkPanel - network panel for this screen element
Method Detail

initCastor

public void initCastor(NetworkPanel networkPanel)
Initializes relevant data after a ScreenElement has been unmarshalled via Castor.

Parameters:
networkPanel - network panel

isSelectable

public abstract boolean isSelectable()
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.

Returns:
true if this screen element is selectable
See Also:
PNode.getPickable(), PNode.setPickable(boolean)

showSelectionHandle

public abstract boolean showSelectionHandle()
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.

Returns:
true if this screen element should show a selection handle
See Also:
PNode.getPickable(), PNode.setPickable(boolean), isSelectable()

isDraggable

public abstract boolean isDraggable()
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.

Returns:
true if this screen element is draggable
See Also:
PNode.getPickable(), PNode.setPickable(boolean), isSelectable()

hasToolTipText

protected abstract boolean hasToolTipText()
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.

Returns:
true if this screen element has tool tip text
See Also:
getToolTipText()

getToolTipText

protected abstract String getToolTipText()
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.

Returns:
a String to use as tool tip text for this screen element
See Also:
hasToolTipText()

hasContextMenu

protected abstract boolean hasContextMenu()
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.

Returns:
true if this screen element has a context menu.
See Also:
getContextMenu()

getContextMenu

protected abstract JPopupMenu getContextMenu()
Return a context menu specific to this screen element. Return null if this screen element does not have a context menu.

Returns:
a context menu specific to this screen element
See Also:
hasContextMenu()

hasPropertyDialog

protected abstract boolean hasPropertyDialog()
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.

Returns:
true if this screen element has a property dialog
See Also:
getPropertyDialog()

getPropertyDialog

protected abstract JDialog getPropertyDialog()
Return a property dialog for this screen element. Return null if this screen element does not have a property dialog.

Returns:
a property dialog for this screen element
See Also:
hasPropertyDialog()

resetColors

public abstract void resetColors()
Reset colors when default colors have been changed in NetworkPreferences.


getNetworkPanel

public final NetworkPanel getNetworkPanel()
Return the network panel for this screen element.

Returns:
the network panel for this screen element

setNetworkPanel

public final void setNetworkPanel(NetworkPanel networkPanel)
Set the network panel for this screen element to networkPanel.

This is a bound property.

Parameters:
networkPanel - network panel for this screen element