Package de.x28hd.tool.core
Class GraphCore
Object
Component
Container
JComponent
JLayeredPane
JDesktopPane
GraphCore
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
GraphPanel
public class GraphCore extends JDesktopPane
The visual map container in the left pane
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JDesktopPane
JDesktopPane.AccessibleJDesktopPane
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
JLayeredPane.AccessibleJLayeredPane
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields Modifier and Type Field Description PresentationCore
controlerCore
The controller classprotected boolean
dragInProgress
protected boolean
dumbCaller
protected boolean
edgeInProgress
protected Hashtable<Integer,GraphEdge>
edges
protected int
ex
used while edgeInProgressprotected int
ey
used while edgeInProgressprotected Font
font
protected boolean
labelUpdate
protected Point
lastPoint
protected boolean
moveInProgress
protected int
mX
last mouse positionprotected int
mY
last mouse positionprotected Hashtable<Integer,GraphNode>
nodes
Selection
selection
GraphNode
targetNode
used while edgeInProgressprotected boolean
translateInProgress
protected Point
translation
panned distances x and yFields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
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
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected void
edgeSelected(GraphEdge edge)
protected GraphEdge
findEdge(int x, int y)
GraphNode
findNode(int x, int y, boolean selectNextInBunch)
protected Selection
getSelectionInstance()
void
graphSelected()
Triggered via graphClicked() and thisPanelPressed() from MouseAdaptervoid
init()
protected boolean
isPopupTrigger(MouseEvent e)
protected boolean
isSpecial(MouseEvent e)
void
nodeSelected(GraphNode node)
protected void
paintEdge(GraphEdge edge, Graphics g)
protected void
paintEdges(Graphics g)
Called from the JComponent's paint()protected static void
paintLine(Graphics g, int x1, int y1, int x2, int y2, boolean hasDirection)
protected void
paintNode(GraphNode node, Graphics g)
protected void
paintNodes(Graphics g)
Called from the JComponent's paint()void
setModel(Hashtable<Integer,GraphNode> nodes, Hashtable<Integer,GraphEdge> edges)
Defines the items and linesvoid
setSize(int size)
protected void
thisPanelDragged(MouseEvent e)
protected void
thisPanelPressed(MouseEvent e)
protected void
thisPanelReleased(MouseEvent e)
void
translateGraph(int x, int y)
Pan the mapprotected void
translateNode(GraphNode node, int x, int y)
Move an iconMethods inherited from class javax.swing.JDesktopPane
addImpl, getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, paramString, remove, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUI
Methods inherited from class javax.swing.JLayeredPane
getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition
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, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, 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, removeContainerListener, 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, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
controlerCore
The controller class -
dumbCaller
protected boolean dumbCaller -
labelUpdate
protected boolean labelUpdate -
nodes
-
edges
-
font
-
selection
-
dragInProgress
protected boolean dragInProgress -
translateInProgress
protected boolean translateInProgress -
moveInProgress
protected boolean moveInProgress -
edgeInProgress
protected boolean edgeInProgress -
targetNode
used while edgeInProgress -
ex
protected int exused while edgeInProgress -
ey
protected int eyused while edgeInProgress -
mX
protected int mXlast mouse position -
mY
protected int mYlast mouse position -
translation
panned distances x and y -
lastPoint
-
-
Constructor Details
-
Method Details
-
paintNodes
Called from the JComponent's paint()- Parameters:
g
- the JComponent's Graphics object to draw on
-
paintEdges
Called from the JComponent's paint()- Parameters:
g
- the JComponent's Graphics object to draw on
-
paintNode
-
paintEdge
-
paintLine
-
setModel
Defines the items and lines- Parameters:
nodes
- the items (icons and text)edges
- the connector lines
-
thisPanelPressed
-
thisPanelDragged
-
thisPanelReleased
-
nodeSelected
-
edgeSelected
-
graphSelected
public void graphSelected()Triggered via graphClicked() and thisPanelPressed() from MouseAdapter -
translateGraph
public void translateGraph(int x, int y)Pan the map- Parameters:
x
- the horizontal move in pixelsy
- the vertital move in pixels
-
translateNode
Move an icon- Parameters:
node
- the icon's itemx
- the horizontal move in pixelsy
- the vertital move in pixels
-
findNode
-
findEdge
-
isSpecial
-
isPopupTrigger
-
getSelectionInstance
-
setSize
public void setSize(int size) -
init
public void init()
-