public class EditableDiagram extends Diagram implements WorkflowEditListener, java.awt.dnd.Autoscroll, java.awt.dnd.DropTargetListener, java.lang.Runnable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, DnDContainer
This class displays allows editing of a workflow diagram via an associated workflow editor
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ITEM_DRAW_LINE |
static java.lang.String |
ITEM_DRAW_NEGATIVE_LINE |
static java.lang.String |
ITEM_LINE |
static java.lang.String |
ITEM_NODE |
static java.lang.String |
ITEM_NORMAL |
static java.lang.String |
ITEM_TASK |
static int |
MODE_DRAW_LINE |
static int |
MODE_DRAW_NEGATIVE_LINE |
static int |
MODE_NORMAL |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
EditableDiagram(Workflow workflow,
WorkflowEditor editor,
WorkflowApplet applet,
boolean canEdit)
Constructs the ditable diagram for a workflow using the editor
|
Modifier and Type | Method and Description |
---|---|
void |
autoscroll(java.awt.Point p)
Autoscroll the tree.
|
void |
buildDiagram()
Builds the diagram based on the current workflow and configuration.
|
void |
clearCursor()
Clears the container's cursor - this is necessary for the
re-written DnD which doesn't use the system handler
|
void |
dragEnter(java.awt.dnd.DropTargetDragEvent event)
Called when drag enters the drop target
|
void |
dragExit(java.awt.dnd.DropTargetEvent event)
Called when drag leaves the drop target
|
void |
dragOver(java.awt.dnd.DropTargetDragEvent event)
Called when drag occurs
|
void |
drop(java.awt.dnd.DropTargetDropEvent event)
Called when a drop occurs
|
void |
dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
Called when the drop action changes
|
void |
dropComplete(WorkflowNode sourceNode,
WorkflowNode dropNode)
Called when one node is dropped over another
|
java.awt.Insets |
getAutoscrollInsets()
Returns the insets used by the drag/drop autoscrolling
|
java.awt.Cursor |
getCursor(java.lang.String name)
Gets a cursor for the diagram
|
int |
getMode()
Gets the diagram mode
|
java.awt.Cursor |
getModeCursor()
Gets the cursor for the current mode
|
java.awt.Dimension |
getPreferredSize()
Returns the preferred size - this is the diagram size + extra
for adding/dragging nodes beyond the last nodes
|
java.awt.datatransfer.Transferable |
getProxy(DiagramWorkflowNode node)
Constructs the correct proxy for dragging
|
java.lang.String |
getToolTip(java.lang.String name)
Gets a tooltip for the diagram
|
boolean |
isDragOk(java.awt.dnd.DropTargetDragEvent event)
Checks whether the row is a valid drop site.
|
boolean |
isDropSupported()
Returns whether a node can be dropped on another in the container
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Called when the mouse has been pressed and released
Locate the rectangle within which the mouse is clicked and
fire the action.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Called when the mouse is being dragged
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Called when the mouse has entered the component
|
void |
mouseExited(java.awt.event.MouseEvent e)
Called when the mouse leaves the component
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Called when the mouse has moved
|
void |
mousePressed(java.awt.event.MouseEvent e)
Called when the mouse is pressed.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Called when the mouse is released.
|
void |
run()
Run method - used to delay listener firing
|
void |
setCursor(java.lang.String name,
java.awt.Cursor cursor)
Sets a cursor for the diagram
|
void |
setMode(int mode)
Sets the diagram mode
|
void |
setScrollPane(javax.swing.JScrollPane scrollPane) |
void |
setSelection(WorkflowEntity selection,
javax.swing.JScrollPane scrollPane)
Sets the current selection for the diagram.
|
void |
setToolTip(java.lang.String name,
java.lang.String text)
Sets a tooltip for the diagram
|
void |
setWorkflow(Workflow workflow)
Sets a new workflow
|
void |
setWorkflow(Workflow workflow,
WorkflowEditor editor,
boolean canEdit) |
void |
workflowChanged(WorkflowEditEvent e)
Called when the editor state changes
|
addDiagramListener, addNode, getImage, removeDiagramListener, selectNode, setConfiguration, setCur
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String ITEM_NODE
public static final java.lang.String ITEM_LINE
public static final java.lang.String ITEM_NORMAL
public static final java.lang.String ITEM_DRAW_LINE
public static final java.lang.String ITEM_TASK
public static final java.lang.String ITEM_DRAW_NEGATIVE_LINE
public static final int MODE_NORMAL
public static final int MODE_DRAW_LINE
public static final int MODE_DRAW_NEGATIVE_LINE
public EditableDiagram(Workflow workflow, WorkflowEditor editor, WorkflowApplet applet, boolean canEdit)
workflow
- The workflow to editeditor
- The editor to handle the operationspublic void setWorkflow(Workflow workflow)
setWorkflow
in class Diagram
workflow
- The workflow to displayeditor
- The workflow editorpublic void setWorkflow(Workflow workflow, WorkflowEditor editor, boolean canEdit)
public void buildDiagram()
buildDiagram
in class Diagram
public void setMode(int mode)
mode
- The modepublic int getMode()
public java.awt.Cursor getModeCursor()
public void setCursor(java.lang.String name, java.awt.Cursor cursor) throws java.lang.Exception
name
- The item namecursor
- The cursorjava.lang.Exception
public java.awt.Cursor getCursor(java.lang.String name)
name
- The item namepublic void setToolTip(java.lang.String name, java.lang.String text) throws java.lang.Exception
name
- The item nametext
- The tooltipjava.lang.Exception
public void setScrollPane(javax.swing.JScrollPane scrollPane)
public void setSelection(WorkflowEntity selection, javax.swing.JScrollPane scrollPane)
selection
- The new selectionpublic java.lang.String getToolTip(java.lang.String name)
name
- The item namepublic void workflowChanged(WorkflowEditEvent e)
workflowChanged
in interface WorkflowEditListener
e
- The WorkflowEditEvent eventpublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class Diagram
public boolean isDragOk(java.awt.dnd.DropTargetDragEvent event)
event
- The drop target drag eventpublic void dragEnter(java.awt.dnd.DropTargetDragEvent event)
dragEnter
in interface java.awt.dnd.DropTargetListener
event
- The drop target drag eventpublic void dragExit(java.awt.dnd.DropTargetEvent event)
dragExit
in interface java.awt.dnd.DropTargetListener
event
- The drop target drag eventpublic void dragOver(java.awt.dnd.DropTargetDragEvent event)
dragOver
in interface java.awt.dnd.DropTargetListener
event
- The drop target drag eventpublic void drop(java.awt.dnd.DropTargetDropEvent event)
drop
in interface java.awt.dnd.DropTargetListener
event
- The drop target drop eventpublic void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
dropActionChanged
in interface java.awt.dnd.DropTargetListener
event
- The drop target drag eventpublic java.awt.Insets getAutoscrollInsets()
getAutoscrollInsets
in interface java.awt.dnd.Autoscroll
public void autoscroll(java.awt.Point p)
autoscroll
in interface java.awt.dnd.Autoscroll
p
- The cursor pointpublic void run()
run
in interface java.lang.Runnable
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- The mouse eventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- The mouse eventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- The mouse eventpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- The mouse eventpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- The mouse eventpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
e
- The mouse eventpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- The mouse eventpublic java.awt.datatransfer.Transferable getProxy(DiagramWorkflowNode node)
getProxy
in interface DnDContainer
node
- The node to be draggedpublic boolean isDropSupported()
isDropSupported
in interface DnDContainer
public void dropComplete(WorkflowNode sourceNode, WorkflowNode dropNode)
dropComplete
in interface DnDContainer
sourceNode
- The Node being draggeddropNode
- The node dropped overpublic void clearCursor()
clearCursor
in interface DnDContainer