psdi.webclient.applet.wfcanvas.diagram

Class DiagramWorkflowNode

  • java.lang.Object
    • java.awt.Component
      • java.awt.Container
        • javax.swing.JComponent
          • javax.swing.JPanel
            • psdi.webclient.applet.wfcanvas.diagram.DiagramWorkflowNode
  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Comparable, javax.accessibility.Accessible
    Direct Known Subclasses:
    EditableDiagramWorkflowNode


    public class DiagramWorkflowNode
    extends javax.swing.JPanel
    implements java.lang.Comparable

    This class holds a single node in the diagram

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • 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 
      Modifier and Type Field and Description
      protected int centerPoint 
      protected DiagramConfiguration configuration 
      protected java.awt.Image image 
      protected java.awt.Cursor imageCursor 
      protected javax.swing.JLabel imageLabel 
      protected boolean inToolbar 
      protected psdi.webclient.applet.wfcanvas.WorkflowNode node 
      static int REL_ENTER 
      static int REL_EXIT 
      protected java.util.Vector[] rels 
      protected java.awt.Color selectedBackground 
      protected java.awt.Color selectedForeground 
      protected boolean state 
      protected javax.swing.JLabel textLabel 
      • Fields inherited from class javax.swing.JComponent

        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

        accessibleContext, 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addIncomingRelationship(DiagramWorkflowRelationship rel)
      Adds an incoming relationship to the node
      void addOutgoingRelationship(DiagramWorkflowRelationship rel)
      Adds an outgoing relationship to the node
      int compareTo(java.lang.Object o)
      Compares 2 nodes for the Comparable interface
      boolean connectedTo(DiagramWorkflowNode dnode, boolean isNegative)
      Returns true if this node is connected to the passed node by the same line type
      protected void draw(java.awt.Graphics g)
      Draws the node onto a graphics context.
      protected javax.swing.Icon generateErrorIcon()
      Generates the icon for the image label
      protected javax.swing.Icon generateIcon()
      Generates the icon for the image label
      int getCenterPoint()
      Gets the center point for the line connections
      int getColumn()
      Gets the column
      java.awt.Cursor getCursorFromImage()
      Generates the icon for the image label
      java.util.Vector getIncomingRelationships()
      Gets the incoming relationships
      java.awt.Point getLocation()
      point location
      java.util.Vector getOutgoingRelationships()
      Gets the outgoing relationships
      int getRelationshipLocation(DiagramWorkflowRelationship rel, int type)
      Gets the location of the relationship amoung the incoming/outgoing relationships
      java.util.Vector getRelationships(int type)
      Gets the relationships of the passed type
      int getRow()
      Gets the row
      java.awt.Color getSelectedBackground()
      Gets the selected background color
      java.awt.Color getSelectedForeground()
      Gets the selected foreground color
      psdi.webclient.applet.wfcanvas.WorkflowNode getWorkflowNode()
      Gets the workflow node for this diagram node
      boolean isIndexUsed(int index, int type)
      Returns true if the index is used and false otherwise
      boolean isSuccessorOf(DiagramWorkflowNode dnode)
      Returns true if this node is a successor of the passed node
      boolean moreInomingAllowed()
      Returns true if it is possible to have more incoming relationships
      boolean moreOutgoingAllowed()
      Returns true if it is possible to have more outgoing relationships
      void removeIncomingRelationship(DiagramWorkflowRelationship rel)
      Removes an incoming relationship from the node
      void removeOutgoingRelationship(DiagramWorkflowRelationship rel)
      Removes an outgoing relationship from the node
      void setBackground(java.awt.Color background)
      Sets the background color
      void setFont(java.awt.Font font)
      Sets the font for the label
      void setSelected(boolean state)
      Sets the selection state of the node
      void setSelectedBackground(java.awt.Color selectedBackground)
      Sets the selected background color
      void setSelectedForeground(java.awt.Color selectedForeground)
      Sets the selected foreground color
      protected void sort(int type)
      Sorts the passed type of relationship
      void sortRelationships()
      Sorts the relationships
      java.lang.String toString()
      Returns the string representation of the node
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, 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, 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, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • node

        protected psdi.webclient.applet.wfcanvas.WorkflowNode node
      • rels

        protected java.util.Vector[] rels
      • imageLabel

        protected javax.swing.JLabel imageLabel
      • textLabel

        protected javax.swing.JLabel textLabel
      • centerPoint

        protected int centerPoint
      • state

        protected boolean state
      • selectedForeground

        protected java.awt.Color selectedForeground
      • selectedBackground

        protected java.awt.Color selectedBackground
      • inToolbar

        protected boolean inToolbar
      • image

        protected java.awt.Image image
      • imageCursor

        protected java.awt.Cursor imageCursor
    • Constructor Detail

      • DiagramWorkflowNode

        public DiagramWorkflowNode(psdi.webclient.applet.wfcanvas.WorkflowNode node,
                                   DiagramConfiguration configuration)
        Constructs a diagram node
        Parameters:
        node - The workflow node
        configuration - The configuration object for the diagram
      • DiagramWorkflowNode

        public DiagramWorkflowNode(psdi.webclient.applet.wfcanvas.WorkflowNode node,
                                   DiagramConfiguration configuration,
                                   boolean inToolbar)
        Constructs a diagram node
        Parameters:
        node - The workflow node
        configuration - The configuration object for the diagram
        inToolbar - If true it is to be shown in a toolbar
    • Method Detail

      • getCursorFromImage

        public java.awt.Cursor getCursorFromImage()
        Generates the icon for the image label
        Returns:
        The icon
      • generateIcon

        protected javax.swing.Icon generateIcon()
        Generates the icon for the image label
        Returns:
        The icon
      • generateErrorIcon

        protected javax.swing.Icon generateErrorIcon()
        Generates the icon for the image label
        Returns:
        The icon
      • setFont

        public void setFont(java.awt.Font font)
        Sets the font for the label
        Overrides:
        setFont in class javax.swing.JComponent
        Parameters:
        font - The forn to set
      • getWorkflowNode

        public psdi.webclient.applet.wfcanvas.WorkflowNode getWorkflowNode()
        Gets the workflow node for this diagram node
        Returns:
        The workflow node
      • isSuccessorOf

        public boolean isSuccessorOf(DiagramWorkflowNode dnode)
        Returns true if this node is a successor of the passed node
        Parameters:
        dnode - The node to test
        Returns:
        True if a successor and false otherwise
      • connectedTo

        public boolean connectedTo(DiagramWorkflowNode dnode,
                                   boolean isNegative)
        Returns true if this node is connected to the passed node by the same line type
        Parameters:
        dnode - The node to test
        isNegative - If true then the new connection is negative
        Returns:
        True if already connected by the line type or false if not
      • addIncomingRelationship

        public void addIncomingRelationship(DiagramWorkflowRelationship rel)
        Adds an incoming relationship to the node
        Parameters:
        rel - The incoming relationship
      • removeIncomingRelationship

        public void removeIncomingRelationship(DiagramWorkflowRelationship rel)
        Removes an incoming relationship from the node
        Parameters:
        rel - The incoming relationship
      • addOutgoingRelationship

        public void addOutgoingRelationship(DiagramWorkflowRelationship rel)
        Adds an outgoing relationship to the node
        Parameters:
        rel - The outgoing relationship
      • removeOutgoingRelationship

        public void removeOutgoingRelationship(DiagramWorkflowRelationship rel)
        Removes an outgoing relationship from the node
        Parameters:
        rel - The outgoing relationship
      • getIncomingRelationships

        public java.util.Vector getIncomingRelationships()
        Gets the incoming relationships
        Returns:
        The incoming relationships
      • getRelationships

        public java.util.Vector getRelationships(int type)
        Gets the relationships of the passed type
        Parameters:
        type - The relationship type
        Returns:
        The relationships
      • getOutgoingRelationships

        public java.util.Vector getOutgoingRelationships()
        Gets the outgoing relationships
        Returns:
        The outgoing relationships
      • getRelationshipLocation

        public int getRelationshipLocation(DiagramWorkflowRelationship rel,
                                           int type)
        Gets the location of the relationship amoung the incoming/outgoing relationships
        Parameters:
        rel - The relationship to find
        type - Exit/enter type
        Returns:
        The index of the relationship
      • compareTo

        public int compareTo(java.lang.Object o)
        Compares 2 nodes for the Comparable interface
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        o - The object to compare to
        Returns:
        negative value if less than passed object,zero if equals and positive value if greater
      • getColumn

        public int getColumn()
        Gets the column
        Returns:
        The column
      • getRow

        public int getRow()
        Gets the row
        Returns:
        The row
      • getLocation

        public java.awt.Point getLocation()
        point location
        Overrides:
        getLocation in class java.awt.Component
        Returns:
        The point
      • getCenterPoint

        public int getCenterPoint()
        Gets the center point for the line connections
        Returns:
        The center point
      • setSelected

        public void setSelected(boolean state)
        Sets the selection state of the node
        Parameters:
        state - the selection state
      • setBackground

        public void setBackground(java.awt.Color background)
        Sets the background color
        Overrides:
        setBackground in class javax.swing.JComponent
        Parameters:
        background - The background color
      • getSelectedForeground

        public java.awt.Color getSelectedForeground()
        Gets the selected foreground color
        Returns:
        The selected foreground color
      • setSelectedForeground

        public void setSelectedForeground(java.awt.Color selectedForeground)
        Sets the selected foreground color
        Parameters:
        selectedForeground - The selected foreground color
      • getSelectedBackground

        public java.awt.Color getSelectedBackground()
        Gets the selected background color
        Returns:
        The selected background color
      • setSelectedBackground

        public void setSelectedBackground(java.awt.Color selectedBackground)
        Sets the selected background color
        Parameters:
        selectedBackground - The selected background color
      • moreInomingAllowed

        public boolean moreInomingAllowed()
        Returns true if it is possible to have more incoming relationships
        Returns:
        True if more allowed
      • moreOutgoingAllowed

        public boolean moreOutgoingAllowed()
        Returns true if it is possible to have more outgoing relationships
        Returns:
        True if more allowed
      • toString

        public java.lang.String toString()
        Returns the string representation of the node
        Overrides:
        toString in class java.awt.Component
        Returns:
        The string representation
      • draw

        protected void draw(java.awt.Graphics g)
        Draws the node onto a graphics context. This shouldn't be needed but paint() doesn't work with the graphics image context.
        Parameters:
        g - The graphics context
      • sortRelationships

        public void sortRelationships()
        Sorts the relationships
      • isIndexUsed

        public boolean isIndexUsed(int index,
                                   int type)
        Returns true if the index is used and false otherwise
        Parameters:
        index - The index to test
        type - If relationship type
        Returns:
        true if index used and false otherwise
      • sort

        protected void sort(int type)
        Sorts the passed type of relationship
        Parameters:
        type - The realtionship type