org.graphstream.ui.swingViewer
Class View
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.graphstream.ui.swingViewer.View
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
- DefaultView
public abstract class View
- extends JPanel
A view on a graphic graph.
Basically a view is a Swing panel where a GraphRenderer
renders the
graphic graph. If you are in the Swing thread, you can change the view on the
graphic graph using methods to translate, zoom and rotate the view.
- See Also:
- Serialized Form
Constructor Summary |
View(String identifier)
New view. |
Method Summary |
abstract ArrayList<GraphicElement> |
allNodesOrSpritesIn(double x1,
double y1,
double x2,
double y2)
Search for all the nodes and sprites contained inside the rectangle
(x1,y1)-(x2,y2). |
abstract void |
beginSelectionAt(double x1,
double y1)
Called by the mouse manager to specify where a node and sprite selection
started. |
abstract void |
close(GraphicGraph graph)
Close definitively this view. |
abstract void |
display(GraphicGraph graph,
boolean graphChanged)
Redisplay or update the view contents. |
abstract void |
endSelectionAt(double x2,
double y2)
Called by the mouse manager to specify where a node and spite selection
stopped. |
abstract GraphicElement |
findNodeOrSpriteAt(double x,
double y)
Search for the first node or sprite (in that order) that contains the
point at coordinates (x, y). |
abstract Camera |
getCamera()
Get a camera object to provide control commands on the view. |
String |
getId()
|
abstract void |
moveElementAtPx(GraphicElement element,
double x,
double y)
Force an element to move at the given location in pixels. |
abstract void |
openInAFrame(boolean on)
Open this view JPanel in a frame. |
abstract void |
resizeFrame(int width,
int height)
Set the size of the view frame, if any. |
abstract void |
selectionGrowsAt(double x,
double y)
The selection already started grows toward position (x, y). |
abstract void |
setBackLayerRenderer(LayerRenderer renderer)
Set a layer renderer that will be called each time the graph needs to be
redrawn before the graph is rendered. |
abstract void |
setForeLayoutRenderer(LayerRenderer renderer)
Set a layer renderer that will be called each time the graph needs to be
redrawn after the graph is rendered. |
Methods inherited from class javax.swing.JComponent |
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, 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 |
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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
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, 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, 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 |
View
public View(String identifier)
- New view.
- Parameters:
identifier
- The view unique identifier.
getId
public String getId()
getCamera
public abstract Camera getCamera()
- Get a camera object to provide control commands on the view.
- Returns:
- a Camera instance
findNodeOrSpriteAt
public abstract GraphicElement findNodeOrSpriteAt(double x,
double y)
- Search for the first node or sprite (in that order) that contains the
point at coordinates (x, y).
- Parameters:
x
- The point abscissa.y
- The point ordinate.
- Returns:
- The first node or sprite at the given coordinates or null if
nothing found.
allNodesOrSpritesIn
public abstract ArrayList<GraphicElement> allNodesOrSpritesIn(double x1,
double y1,
double x2,
double y2)
- Search for all the nodes and sprites contained inside the rectangle
(x1,y1)-(x2,y2).
- Parameters:
x1
- The rectangle lowest point abscissa.y1
- The rectangle lowest point ordinate.x2
- The rectangle highest point abscissa.y2
- The rectangle highest point ordinate.
- Returns:
- The set of sprites and nodes in the given rectangle.
display
public abstract void display(GraphicGraph graph,
boolean graphChanged)
- Redisplay or update the view contents. Called by the Viewer.
- Parameters:
graph
- The graphic graph to represent.graphChanged
- True if the graph changed since the last call to this method.
close
public abstract void close(GraphicGraph graph)
- Close definitively this view. Called by the Viewer.
- Parameters:
graph
- The graphic graph.
openInAFrame
public abstract void openInAFrame(boolean on)
- Open this view JPanel in a frame. The argument allows to put the panel in
a new frame or to remove it from the frame (if it already exists). Called
by the Viewer.
- Parameters:
on
- Add the panel in its own frame or remove it if it already was
in its own frame.
resizeFrame
public abstract void resizeFrame(int width,
int height)
- Set the size of the view frame, if any. If this view has been open in a frame, this changes
the size of the frame containing it.
- Parameters:
width
- The new width.height
- The new height.
beginSelectionAt
public abstract void beginSelectionAt(double x1,
double y1)
- Called by the mouse manager to specify where a node and sprite selection
started.
- Parameters:
x1
- The selection start abscissa.y1
- The selection start ordinate.
selectionGrowsAt
public abstract void selectionGrowsAt(double x,
double y)
- The selection already started grows toward position (x, y).
- Parameters:
x
- The new end selection abscissa.y
- The new end selection ordinate.
endSelectionAt
public abstract void endSelectionAt(double x2,
double y2)
- Called by the mouse manager to specify where a node and spite selection
stopped.
- Parameters:
x2
- The selection stop abscissa.y2
- The selection stop ordinate.
moveElementAtPx
public abstract void moveElementAtPx(GraphicElement element,
double x,
double y)
- Force an element to move at the given location in pixels.
- Parameters:
element
- The element.x
- The requested position abscissa in pixels.y
- The requested position ordinate in pixels.
setBackLayerRenderer
public abstract void setBackLayerRenderer(LayerRenderer renderer)
- Set a layer renderer that will be called each time the graph needs to be
redrawn before the graph is rendered. Pass "null" to remove the layer
renderer.
- Parameters:
renderer
- The renderer (or null to remove it).
setForeLayoutRenderer
public abstract void setForeLayoutRenderer(LayerRenderer renderer)
- Set a layer renderer that will be called each time the graph needs to be
redrawn after the graph is rendered. Pass "null" to remove the layer
renderer.
- Parameters:
renderer
- The renderer (or null to remove it).
Copyright © 2011. All Rights Reserved.