public class GraphPanel extends javax.swing.JPanel implements Zoomer, javax.swing.event.ChangeListener, javax.swing.event.MouseInputListener, java.awt.event.MouseWheelListener
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected IOPGraph |
graph |
protected java.awt.Dimension |
graphSize |
protected GraphItem |
lastItem |
protected java.awt.Point |
lastPoint |
protected java.util.Set<ZoomListener> |
zoomListeners |
protected java.awt.geom.AffineTransform |
zoomTransform |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
GraphPanel() |
Modifier and Type | Method and Description |
---|---|
void |
addZoomListener(ZoomListener zl)
Add given zoom listener to list of objects to be notified upon
zoom change.
|
void |
centerOn(java.awt.Rectangle r)
Center component on given rectangle.
|
protected void |
checkSize() |
protected javax.swing.JButton |
createMenuButton(java.lang.String text,
int m_index) |
protected void |
displayContextMNode(BaseFrame frame,
IOPNode node) |
protected void |
displayInfo(IOPNode node) |
void |
displayMenu(IOPNode node)
Display context menu for given node.
|
BaseFrame |
getFrame() |
IOPGraph |
getGraph() |
java.awt.Dimension |
getGraphSize() |
protected java.awt.geom.AffineTransform |
getInverseZoom() |
double |
getZoomScale()
Obtain current zoom scale in effect.
|
void |
highlight(GraphItem item)
Select given graph item (node or edge) by highlighting it.
|
boolean |
isEmpty()
Test whether this graph panel is empty.
|
boolean |
isGlyphishVisible(Glyphish g)
Test whether given glyphish thing is currently visible
in the parental viewport.
|
protected javax.swing.JButton |
makeCenterOnButton(java.lang.String text,
int m_index,
GraphItem item) |
protected javax.swing.JButton |
makeDisplayButton(java.lang.String text,
int m_index,
IOPNode node) |
protected javax.swing.JButton |
makeG2MaudeButton(java.lang.String text,
int m_index,
java.lang.String cmd,
java.lang.String msg) |
void |
mouseClicked(java.awt.event.MouseEvent event) |
void |
mouseClicked(java.awt.event.MouseEvent event,
GraphItem item,
java.awt.Point p) |
void |
mouseDragged(java.awt.event.MouseEvent event) |
void |
mouseEntered(java.awt.event.MouseEvent event) |
void |
mouseExited(java.awt.event.MouseEvent event) |
void |
mouseMoved(java.awt.event.MouseEvent event) |
void |
mousePressed(java.awt.event.MouseEvent event) |
void |
mouseReleased(java.awt.event.MouseEvent event) |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent event) |
protected void |
notifyZoomListeners() |
protected void |
paintComponent(java.awt.Graphics g) |
void |
removeLastSelection() |
void |
removeZoomListener(ZoomListener zl)
Remove given zoom listener from list of objects to be notified
upon zoom change.
|
void |
repaint() |
void |
resetGraph() |
void |
setGraph(IOPGraph g) |
void |
stateChanged(javax.swing.event.ChangeEvent event) |
java.awt.Point |
transformFromView(java.awt.Point p) |
void |
zoom(double factor)
Apply given factor to current zoom.
|
void |
zoomToFit()
Zoom the size of the graph so that it fits into its parents viewport.
|
void |
zoomToFit(java.awt.Dimension size)
Zoom the size of the graph so that it fits into given dimension
and its size is maximized.
|
void |
zoomToOriginal()
Change the size of graph back to its original size.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, 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
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
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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected IOPGraph graph
protected java.awt.Dimension graphSize
protected java.util.Set<ZoomListener> zoomListeners
protected java.awt.geom.AffineTransform zoomTransform
protected GraphItem lastItem
protected java.awt.Point lastPoint
public IOPGraph getGraph()
public void resetGraph()
public void setGraph(IOPGraph g)
public java.awt.Dimension getGraphSize()
protected void checkSize()
public boolean isEmpty()
public void addZoomListener(ZoomListener zl)
zl
- ZoomListener to be notified upon zoom changepublic void removeZoomListener(ZoomListener zl)
zl
- ZoomListener to be removedprotected void notifyZoomListeners()
public double getZoomScale()
protected java.awt.geom.AffineTransform getInverseZoom()
public void zoom(double factor)
public void zoomToFit(java.awt.Dimension size)
null
does nothing.size
- Dimension, in which the zoomed graph must fit intopublic void zoomToFit()
public void zoomToOriginal()
zoomToOriginal
in interface Zoomer
public void centerOn(java.awt.Rectangle r)
null
.r
- Rectangle to center onpublic void highlight(GraphItem item)
item
- Node or edge to select in graph;
may be NULL if nothing to be selectedpublic void displayMenu(IOPNode node)
node
- Node for which to display context menupublic BaseFrame getFrame()
protected javax.swing.JButton makeCenterOnButton(java.lang.String text, int m_index, GraphItem item)
protected javax.swing.JButton makeG2MaudeButton(java.lang.String text, int m_index, java.lang.String cmd, java.lang.String msg)
protected javax.swing.JButton makeDisplayButton(java.lang.String text, int m_index, IOPNode node)
protected javax.swing.JButton createMenuButton(java.lang.String text, int m_index)
public void removeLastSelection()
public boolean isGlyphishVisible(Glyphish g)
false
if this graph panel is not
embedded into a JViewport.
Returns false
if glyphish is not entirely
inside the currently visible rectangle. If given glyph
is null
returns false.g
- Glyphish thing to test visibility ofpublic java.awt.Point transformFromView(java.awt.Point p)
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void repaint()
repaint
in class java.awt.Component
public void stateChanged(javax.swing.event.ChangeEvent event)
stateChanged
in interface javax.swing.event.ChangeListener
public void mouseWheelMoved(java.awt.event.MouseWheelEvent event)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent event)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent event)
mouseExited
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent event)
mouseMoved
in interface java.awt.event.MouseMotionListener
protected void displayInfo(IOPNode node)
public void mouseClicked(java.awt.event.MouseEvent event, GraphItem item, java.awt.Point p)