站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

VMDNodeWidget (Visual Library API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.api.visual 2.2

org.netbeans.api.visual.vmd
Class VMDNodeWidget

java.lang.Object
  extended by org.netbeans.api.visual.widget.Widget
      extended by org.netbeans.api.visual.vmd.VMDNodeWidget
All Implemented Interfaces:
StateModel.Listener, VMDMinimizeAbility

public class VMDNodeWidget
extends Widget
implements StateModel.Listener, VMDMinimizeAbility

This class represents a node widget in the VMD visualization style. It implements the minimize ability. It allows to add pin widgets into the widget using attachPinWidget method.

The node widget consists of a header (with an image, a name, secondary name and a glyph set) and the content. The content contains pin widgets. Pin widgets can be organized in pin-categories defined by calling sortPins method. The sortPins method has to be called refresh the order after adding a pin widget.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.netbeans.api.visual.widget.Widget
Widget.Dependency
 
Constructor Summary
VMDNodeWidget(Scene scene)
          Creates a node widget.
 
Method Summary
 void attachPinWidget(Widget widget)
          Attaches a pin widget to the node widget.
 void collapseWidget()
          Collapses the widget.
 Anchor createAnchorPin(Anchor anchor)
          Creates an extended pin anchor with an ability of reconnecting to the node anchor when the node is minimized.
 void expandWidget()
          Expands the widget.
 Widget getHeader()
          Returns a header widget.
 Anchor getNodeAnchor()
          Returns a node anchor.
 String getNodeName()
          Returns a node name.
 LabelWidget getNodeNameWidget()
          Returns a node name widget.
protected  boolean isMinimizableWidget(Widget widget)
          Called to check whether a particular widget is minimizable.
 boolean isMinimized()
          Check the minimized state.
protected  void notifyStateChanged(ObjectState previousState, ObjectState state)
          Called to notify about the change of the widget state.
 void setGlyphs(List<Image> glyphs)
          Sets node glyphs.
 void setMinimized(boolean minimized)
          Set the minimized state.
 void setNodeImage(Image image)
          Sets a node image.
 void setNodeName(String nodeName)
          Sets a node name.
 void setNodeProperties(Image image, String nodeName, String nodeType, List<Image> glyphs)
          Sets all node properties at once.
 void setNodeType(String nodeType)
          Sets a node type (secondary name).
 void sortPins(HashMap<String,List<Widget>> pinsCategories)
          Sorts and assigns pins into categories.
 void stateChanged()
          Called when a minimized state is changed.
 void toggleMinimized()
          Toggles the minimized state.
 
Methods inherited from class org.netbeans.api.visual.widget.Widget
addChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, calculateClientArea, convertLocalToScene, convertLocalToScene, convertSceneToLocal, convertSceneToLocal, createActions, equals, getAccessibleContext, getActions, getActions, getBackground, getBorder, getBounds, getChildConstraint, getChildren, getClientArea, getCursor, getFont, getForeground, getGraphics, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isRepaintRequiredForRevalidating, isValidated, isVisible, notifyAdded, notifyRemoved, paint, paintBackground, paintBorder, paintChildren, paintWidget, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setForeground, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setState, setToolTipText, setVisible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VMDNodeWidget

public VMDNodeWidget(Scene scene)
Creates a node widget.

Parameters:
scene - the scene
Method Detail

isMinimizableWidget

protected boolean isMinimizableWidget(Widget widget)
Called to check whether a particular widget is minimizable. By default it returns true. The result have to be the same for whole life-time of the widget. If not, then the revalidation has to be invoked manually. An anchor (created by VMDNodeWidget.createPinAnchor is not affected by this method.

Parameters:
widget - the widget
Returns:
true, if the widget is minimizable; false, if the widget is not minimizable

isMinimized

public boolean isMinimized()
Check the minimized state.

Returns:
true, if minimized

setMinimized

public void setMinimized(boolean minimized)
Set the minimized state. This method will show/hide child widgets of this Widget and switches anchors between node and pin widgets.

Parameters:
minimized - if true, then the widget is going to be minimized

toggleMinimized

public void toggleMinimized()
Toggles the minimized state. This method will show/hide child widgets of this Widget and switches anchors between node and pin widgets.


stateChanged

public void stateChanged()
Called when a minimized state is changed. This method will show/hide child widgets of this Widget and switches anchors between node and pin widgets.

Specified by:
stateChanged in interface StateModel.Listener

notifyStateChanged

protected void notifyStateChanged(ObjectState previousState,
                                  ObjectState state)
Called to notify about the change of the widget state.

Overrides:
notifyStateChanged in class Widget
Parameters:
previousState - the previous state
state - the new state

setNodeImage

public void setNodeImage(Image image)
Sets a node image.

Parameters:
image - the image

getNodeName

public String getNodeName()
Returns a node name.

Returns:
the node name

setNodeName

public void setNodeName(String nodeName)
Sets a node name.

Parameters:
nodeName - the node name

setNodeType

public void setNodeType(String nodeType)
Sets a node type (secondary name).

Parameters:
nodeType - the node type

attachPinWidget

public void attachPinWidget(Widget widget)
Attaches a pin widget to the node widget.

Parameters:
widget - the pin widget

setGlyphs

public void setGlyphs(List<Image> glyphs)
Sets node glyphs.

Parameters:
glyphs - the list of images

setNodeProperties

public void setNodeProperties(Image image,
                              String nodeName,
                              String nodeType,
                              List<Image> glyphs)
Sets all node properties at once.

Parameters:
image - the node image
nodeName - the node name
nodeType - the node type (secondary name)
glyphs - the node glyphs

getNodeNameWidget

public LabelWidget getNodeNameWidget()
Returns a node name widget.

Returns:
the node name widget

getNodeAnchor

public Anchor getNodeAnchor()
Returns a node anchor.

Returns:
the node anchor

createAnchorPin

public Anchor createAnchorPin(Anchor anchor)
Creates an extended pin anchor with an ability of reconnecting to the node anchor when the node is minimized.

Parameters:
anchor - the original pin anchor from which the extended anchor is created
Returns:
the extended pin anchor

sortPins

public void sortPins(HashMap<String,List<Widget>> pinsCategories)
Sorts and assigns pins into categories.

Parameters:
pinsCategories - the map of category name as key and a list of pin widgets as value

collapseWidget

public void collapseWidget()
Collapses the widget.

Specified by:
collapseWidget in interface VMDMinimizeAbility

expandWidget

public void expandWidget()
Expands the widget.

Specified by:
expandWidget in interface VMDMinimizeAbility

getHeader

public Widget getHeader()
Returns a header widget.

Returns:
the header widget

org.netbeans.api.visual 2.2

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.