com.mindfusion.diagramming
Class NodeListView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JList
                  extended by com.mindfusion.diagramming.NodeListView
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class NodeListView
extends javax.swing.JList

Represents a list box with MindFusion.Diagramming.DiagramNode objects.

See Also:
Serialized Form

Nested Class Summary
 class NodeListView.NodeTransferHandler
           
 
Nested classes/interfaces inherited from class javax.swing.JList
javax.swing.JList.AccessibleJList, javax.swing.JList.DropLocation
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NodeListView()
          Initializes a new instance of the NodeListView class.
 
Method Summary
 void addNode(DiagramNode node)
          Adds a new node to the end of the list view.
 void addNode(DiagramNode node, java.lang.String label)
          Adds a new node to the end of the list view.
 void addNodeListViewListener(NodeListViewListener listener)
          Registers listener so that it will receive events when users select or delete nodes from the list.
 void addNodes(DiagramNode[] nodes, java.lang.String[] labels)
          Adds the specified nodes to the end of the list box.
 void addNodes(DiagramNodeList nodes)
          Adds the specified nodes to the end of the list box.
 void addNodes(DiagramNodeList nodes, java.lang.String[] labels)
          Adds the specified nodes to the end of the list box.
 void clearNodes()
          Removes all nodes from the list view.
 boolean getAllowRemove()
          Gets a value indicating whether to allow deletion of list nodes by pressing Del.
 java.awt.geom.Dimension2D getDefaultNodeSize()
          Gets the default size with which nodes dragged onto a diagram will be created.
 java.awt.Dimension getIconMargin()
          Gets the horizontal and vertical margins around the nodes.
 java.awt.Dimension getIconSize()
          Gets the size of the nodes displayed in the list.
 int getMeasureUnit()
          Gets the unit of measure used when drawing nodes.
 DiagramNode getNodeAt(int index)
          Gets the node at the specified position.
 int getNodesCount()
          Gets the number of nodes in the list view.
 void insertNode(int index, DiagramNode node)
          Inserts the node at the specified position.
 void insertNode(int index, DiagramNode node, java.lang.String label)
          Inserts the node at the specified position.
 boolean isShowLabels()
          Gets a value indicating whether to show text labels along with icons for each list item.
protected  void onItemSelected(javax.swing.event.ListSelectionEvent e)
           
protected  void onKeyPressed(java.awt.event.KeyEvent e)
           
protected  void onMousePressed(java.awt.event.MouseEvent e)
           
protected  void onNodeRemoved(NodeListEvent e)
           
protected  void onNodeSelected(NodeListEvent e)
           
 void removeNodeAt(int index)
          Removes the node at the specified position.
 void removeNodeListViewListener(NodeListViewListener listener)
          Unregisters listener so that it will no longer receive NodeListView events.
 void setAllowRemove(boolean value)
          Sets a value indicating whether to allow deletion of list nodes by pressing Del.
 void setDefaultNodeSize(java.awt.geom.Dimension2D value)
          Sets the default size with which nodes dragged onto a diagram will be created.
 void setIconMargin(java.awt.Dimension value)
          Sets the horizontal and vertical margins around the nodes.
 void setIconSize(java.awt.Dimension value)
          Sets the size of the nodes displayed in the list.
 void setMeasureUnit(int value)
          Sets the unit of measure used when drawing nodes.
 void setShowLabels(boolean value)
          Sets a value specifying whether to show text labels along with icons for each list item.
protected  void updateComponentResize()
           
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeListView

public NodeListView()
Initializes a new instance of the NodeListView class.

Method Detail

updateComponentResize

protected void updateComponentResize()

onKeyPressed

protected void onKeyPressed(java.awt.event.KeyEvent e)

onItemSelected

protected void onItemSelected(javax.swing.event.ListSelectionEvent e)

onMousePressed

protected void onMousePressed(java.awt.event.MouseEvent e)

getMeasureUnit

public int getMeasureUnit()
Gets the unit of measure used when drawing nodes.

Returns:
One of the GraphicsUnit constants.

setMeasureUnit

public void setMeasureUnit(int value)
Sets the unit of measure used when drawing nodes.

Parameters:
value - One of the GraphicsUnit constants.

getIconSize

public java.awt.Dimension getIconSize()
Gets the size of the nodes displayed in the list.

Returns:
A Dimension instance specifying the node size.

setIconSize

public void setIconSize(java.awt.Dimension value)
Sets the size of the nodes displayed in the list.

Parameters:
value - A Dimension instance specifying the node size.

getIconMargin

public java.awt.Dimension getIconMargin()
Gets the horizontal and vertical margins around the nodes.

Returns:
A Dimension instance specifying the icon margins.

setIconMargin

public void setIconMargin(java.awt.Dimension value)
Sets the horizontal and vertical margins around the nodes.

Parameters:
value - A Dimension instance specifying the icon margins.

getDefaultNodeSize

public java.awt.geom.Dimension2D getDefaultNodeSize()
Gets the default size with which nodes dragged onto a diagram will be created.

Returns:
A Dimension2D instance specifying the size of created nodes.

setDefaultNodeSize

public void setDefaultNodeSize(java.awt.geom.Dimension2D value)
Sets the default size with which nodes dragged onto a diagram will be created.

Parameters:
value - A Dimension2D instance specifying the size of created nodes.

getAllowRemove

public boolean getAllowRemove()
Gets a value indicating whether to allow deletion of list nodes by pressing Del.

Returns:
true to allow node deletion, otherwise false.

setAllowRemove

public void setAllowRemove(boolean value)
Sets a value indicating whether to allow deletion of list nodes by pressing Del.

Parameters:
value - true to allow node deletion, otherwise false.

addNode

public void addNode(DiagramNode node)
Adds a new node to the end of the list view.

Parameters:
node - The node to add.

addNode

public void addNode(DiagramNode node,
                    java.lang.String label)
Adds a new node to the end of the list view.

Parameters:
node - The node to add.
label - The text to be displayed for the node.

addNodes

public void addNodes(DiagramNodeList nodes)
Adds the specified nodes to the end of the list box.

Parameters:
nodes - The collection of nodes to add.

addNodes

public void addNodes(DiagramNodeList nodes,
                     java.lang.String[] labels)
Adds the specified nodes to the end of the list box.

Parameters:
nodes - The collection of nodes to add.
labels - The array of texts to be displayed for the nodes.

addNodes

public void addNodes(DiagramNode[] nodes,
                     java.lang.String[] labels)
Adds the specified nodes to the end of the list box.

Parameters:
nodes - The array of nodes to add.
labels - The array of texts to be displayed for the nodes.

insertNode

public void insertNode(int index,
                       DiagramNode node)
Inserts the node at the specified position.

Parameters:
index - The zero-based index at which the node should be inserted.
node - The node to insert.

insertNode

public void insertNode(int index,
                       DiagramNode node,
                       java.lang.String label)
Inserts the node at the specified position.

Parameters:
index - The zero-based index at which the node should be inserted.
node - The node to insert. The text to be displayed for the node.

removeNodeAt

public void removeNodeAt(int index)
Removes the node at the specified position.

Parameters:
index - The zero-based index of the node to remove.

clearNodes

public void clearNodes()
Removes all nodes from the list view.


getNodeAt

public DiagramNode getNodeAt(int index)
Gets the node at the specified position.

Parameters:
index - An integer value specifying the node's index in the list.
Returns:
The DiagramNode at the specified position.

getNodesCount

public int getNodesCount()
Gets the number of nodes in the list view.


onNodeSelected

protected void onNodeSelected(NodeListEvent e)

onNodeRemoved

protected void onNodeRemoved(NodeListEvent e)

addNodeListViewListener

public void addNodeListViewListener(NodeListViewListener listener)
Registers listener so that it will receive events when users select or delete nodes from the list.

Parameters:
listener - An object implementing the NodeListViewListener interface.

removeNodeListViewListener

public void removeNodeListViewListener(NodeListViewListener listener)
Unregisters listener so that it will no longer receive NodeListView events.

Parameters:
listener - An object implementing the NodeListViewListener interface.

isShowLabels

public boolean isShowLabels()
Gets a value indicating whether to show text labels along with icons for each list item.

Returns:
true if labels are shown.

setShowLabels

public void setShowLabels(boolean value)
Sets a value specifying whether to show text labels along with icons for each list item.

Parameters:
value - true if text labels must be shown, otherwise false.