public class VMDNodeWidget extends Widget implements StateModel.Listener, VMDMinimizeAbility
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.
Widget.Dependency
Constructor and Description |
---|
VMDNodeWidget(Scene scene)
Creates a node widget.
|
VMDNodeWidget(Scene scene,
VMDColorScheme scheme)
Creates a node widget with a specific color scheme.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Widget |
getMinimizeButton()
Returns a minimize button widget.
|
Anchor |
getNodeAnchor()
Returns a node anchor.
|
String |
getNodeName()
Returns a node name.
|
LabelWidget |
getNodeNameWidget()
Returns a node name widget.
|
Widget |
getPinsSeparator()
Returns a pins separator.
|
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.
|
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
public VMDNodeWidget(Scene scene)
scene
- the scenepublic VMDNodeWidget(Scene scene, VMDColorScheme scheme)
scene
- the scenescheme
- the color schemeprotected boolean isMinimizableWidget(Widget widget)
VMDNodeWidget.createPinAnchor
is not affected by this method.widget
- the widgetpublic boolean isMinimized()
public void setMinimized(boolean minimized)
minimized
- if true, then the widget is going to be minimizedpublic void toggleMinimized()
public void stateChanged()
stateChanged
in interface StateModel.Listener
protected void notifyStateChanged(ObjectState previousState, ObjectState state)
notifyStateChanged
in class Widget
previousState
- the previous statestate
- the new statepublic void setNodeImage(Image image)
image
- the imagepublic String getNodeName()
public void setNodeName(String nodeName)
nodeName
- the node namepublic void setNodeType(String nodeType)
nodeType
- the node typepublic void attachPinWidget(Widget widget)
widget
- the pin widgetpublic void setGlyphs(List<Image> glyphs)
glyphs
- the list of imagespublic void setNodeProperties(Image image, String nodeName, String nodeType, List<Image> glyphs)
image
- the node imagenodeName
- the node namenodeType
- the node type (secondary name)glyphs
- the node glyphspublic LabelWidget getNodeNameWidget()
public Anchor getNodeAnchor()
public Anchor createAnchorPin(Anchor anchor)
anchor
- the original pin anchor from which the extended anchor is createdpublic void sortPins(HashMap<String,List<Widget>> pinsCategories)
pinsCategories
- the map of category name as key and a list of pin widgets as valuepublic void collapseWidget()
collapseWidget
in interface VMDMinimizeAbility
public void expandWidget()
expandWidget
in interface VMDMinimizeAbility
public Widget getHeader()
public Widget getMinimizeButton()
public Widget getPinsSeparator()