Class VMDNodeWidget
java.lang.Object
org.netbeans.api.visual.widget.Widget
org.netbeans.api.visual.vmd.VMDNodeWidget
- All Implemented Interfaces:
Accessible
,StateModel.Listener
,VMDMinimizeAbility
,org.openide.util.Lookup.Provider
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
ConstructorsConstructorDescriptionVMDNodeWidget
(Scene scene) Creates a node widget.VMDNodeWidget
(Scene scene, VMDColorScheme scheme) Creates a node widget with a specific color scheme. -
Method Summary
Modifier and TypeMethodDescriptionvoid
attachPinWidget
(Widget widget) Attaches a pin widget to the node widget.void
Collapses the widget.createAnchorPin
(Anchor anchor) Creates an extended pin anchor with an ability of reconnecting to the node anchor when the node is minimized.void
Expands the widget.Returns a header widget.Returns a minimize button widget.Returns a node anchor.Returns a node name.Returns a node name widget.Returns a pins separator.protected boolean
isMinimizableWidget
(Widget widget) Called to check whether a particular widget is minimizable.boolean
Check the minimized state.protected void
notifyStateChanged
(ObjectState previousState, ObjectState state) Called to notify about the change of the widget state.void
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
Sets all node properties at once.void
setNodeType
(String nodeType) Sets a node type (secondary name).void
Sorts and assigns pins into categories.void
Called when a minimized state is changed.void
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, getCursorAt, getDependencies, getFont, getForeground, getGraphics, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getResourceTable, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isRepaintRequiredForRevalidating, isValidated, isVisible, notifyAdded, notifyBackgroundChanged, notifyFontChanged, notifyForegroundChanged, notifyRemoved, paint, paintBackground, paintBorder, paintChildren, paintWidget, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBackgroundFromResource, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setFontFromResource, setForeground, setForegroundFromResource, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setResourceTable, setState, setToolTipText, setVisible, updateResources
-
Constructor Details
-
VMDNodeWidget
-
VMDNodeWidget
Creates a node widget with a specific color scheme.- Parameters:
scene
- the scenescheme
- the color scheme
-
-
Method Details
-
isMinimizableWidget
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 byVMDNodeWidget.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 interfaceStateModel.Listener
-
notifyStateChanged
Called to notify about the change of the widget state.- Overrides:
notifyStateChanged
in classWidget
- Parameters:
previousState
- the previous statestate
- the new state
-
setNodeImage
-
getNodeName
-
setNodeName
-
setNodeType
Sets a node type (secondary name).- Parameters:
nodeType
- the node type
-
attachPinWidget
Attaches a pin widget to the node widget.- Parameters:
widget
- the pin widget
-
setGlyphs
-
setNodeProperties
-
getNodeNameWidget
-
getNodeAnchor
-
createAnchorPin
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, the returned anchor is cached and returns a single extended pin anchor instance of each original pin anchor
-
sortPins
-
collapseWidget
public void collapseWidget()Collapses the widget.- Specified by:
collapseWidget
in interfaceVMDMinimizeAbility
-
expandWidget
public void expandWidget()Expands the widget.- Specified by:
expandWidget
in interfaceVMDMinimizeAbility
-
getHeader
-
getMinimizeButton
Returns a minimize button widget.- Returns:
- the miminize button widget
-
getPinsSeparator
-