|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
y.view.Graph2DView
public class Graph2DView
This is a powerful component to view graphs in 2-dimensional space.
It displays a Graph2D object. The same Graph2D object can be
displayed at different zoom levels in different views.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static byte |
BG_LAYER
Background layer constant. |
static int |
CONTENT_POLICY_BACKGROUND_DRAWABLES
Content policy constant that includes the current background drawables (i.e. all Drawable instances registered via the
addBackgroundDrawable(Drawable) method) in the calculation of the
content bounding box. |
static int |
CONTENT_POLICY_FOREGROUND_DRAWABLES
Content policy constant that includes the current foreground drawables (i.e. all Drawable instances registered via the
addDrawable(Drawable) method) in the calculation of the content
bounding box. |
static int |
CONTENT_POLICY_GRAPH
Content policy constant that includes the current graph in the calculation of the content bounding box. |
static int |
CONTENT_POLICY_GRAPH_DRAWABLES
Content policy constant that includes the current graph drawables (i.e. all Drawable instances registered via the
Graph2D.addDrawable(Drawable) method) in the calculation of
the content bounding box. |
static byte |
FG_LAYER
Foreground layer constant. |
static int |
LAYER_MODE
Drawing mode constant. |
static int |
MOVE_SELECTION_MODE
Drawing mode constant. |
static int |
NORMAL_MODE
Drawing mode constant. |
static int |
SELECTION_BOX_MODE
Drawing mode constant. |
static int |
UNBUFFERED_MODE
Drawing mode constant. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, 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 |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface y.view.View2DConstants |
|---|
GRID_CROSS, GRID_LINES, GRID_NONE, GRID_POINTS |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
Graph2DView()
Creates a new Graph2DView containing an empty graph. |
|
Graph2DView(Graph2D graph)
Creates a new Graph2DView for a given graph. |
|
Graph2DView(Graph2D graph,
ViewControl vc)
Creates a new Graph2DView for a given graph and viewcontrol. |
|
| Method Summary | |
|---|---|
void |
addBackgroundDrawable(Drawable d)
Adds a background drawable to this view. |
void |
addDrawable(Drawable d)
Adds a drawable to this view. |
void |
addViewChangeListener(ViewChangeListener l)
View can not change, so this method does nothing. |
void |
addViewMode(ViewMode vm)
Adds a view mode to this Graph2DView. |
boolean |
adjustScrollBarVisibility()
Updates scrollbar visibility and adjustment for this view . |
void |
animationPerformed(AnimationEvent e)
AnimationListener implementation. |
Rectangle |
calculateContentBounds()
Calculates the bounding box of this view's current content. |
protected GraphicsContext |
createGraphicsContext()
Factory method that creates the GraphicsContext for the subsequent rendering. |
void |
fitContent()
Fits the contents inside this view. |
void |
fitContent(boolean animated)
Fits the contents inside this view. |
void |
fitRectangle(Rectangle r)
Fits the given rectangle inside this view. |
void |
fitWorldRect()
Sets the size and offset of the displayed document's world rectangle to the size and offset of this view. |
void |
focusView(double newZoom,
Point2D newCenter,
boolean animated)
|
Collection |
getBackgroundDrawables()
Returns a collection of background Drawables associated with this view. |
BackgroundRenderer |
getBackgroundRenderer()
Returns the current BackgroundRenderer of this view. |
JComponent |
getCanvasComponent()
Returns the component that displays the contents of this view. |
Dimension |
getCanvasSize()
Returns the size of the canvas part of this component. |
Point2D |
getCenter()
Returns the world coordinate that is displayed in the center of this view. |
Component |
getComponent()
Returns this. |
int |
getContentPolicy()
Returns the policy used in the calculation of the content bounding box. |
View |
getCurrentView()
Returns this View. |
Collection |
getDrawables()
Returns a collection of Drawables currently associated with this view |
boolean |
getFitContentOnResize()
Whether or not the fitContentOnResize feature
is enabled. |
Frame |
getFrame()
Returns the frame this components belongs to. |
JPanel |
getGlassPane()
Returns a glass pane of this view. |
Graph2D |
getGraph2D()
Returns the graph that this view displays. |
Graph2DRenderer |
getGraph2DRenderer()
Returns the renderer used to render the bound Graph2D. |
Color |
getGridColor()
Returns the currently set grid color |
boolean |
getGridMode()
Asks if grid is on or off on the view. |
double |
getGridResolution()
Get resolution of grid. |
int |
getGridType()
Get type of grid. |
int |
getHorizontalScrollBarPolicy()
Returns the scroll bar policy for the horizontal scroll bar. |
Image |
getImage()
Deprecated. Use paintVisibleContent(Graphics2D) with a
graphics context of an appropriate image type instead. |
double |
getPaintDetailThreshold()
Returns the scale threshold after that less detailed versions of the graph are displayed |
int |
getVerticalScrollBarPolicy()
Returns the scroll bar policy for the vertical scroll bar. |
ViewControl |
getViewControl()
Returns the view control of this view. |
Cursor |
getViewCursor()
Returns the cursor that is displayed when the mouse is over this view. |
Iterator |
getViewModes()
Returns an iterator over an unmodifiable Collection of the currently installed ViewModes. |
Point |
getViewPoint()
Returns the world coordinate this view displays at its the upper left corner. |
Point2D |
getViewPoint2D()
Returns the world coordinate this view displays at its the upper left corner. |
Dimension |
getViewSize()
Returns the size of the drawing canvas. |
Rectangle |
getVisibleRect()
Returns the visible part of the world rectangle. |
Rectangle |
getWorldRect()
Returns the world rectangle defined for this view. |
double |
getZoom()
Returns the current zoom level of this view. |
void |
gridCursorActive(boolean active)
Activates/deactivates the grid cursor. |
boolean |
isAntialiasedPainting()
Getter for property antialiasedPainting. |
boolean |
isFocusTraversable()
|
boolean |
isGridVisible()
Asks if grid is visible in the view. |
boolean |
isOptimizedDrawingEnabled()
|
boolean |
isValidateRoot()
Returns false. |
void |
openLabelEditor(YLabel label,
double x,
double y)
Same as openLabelEditor(YLabel,double,double,PropertyChangeListener). |
void |
openLabelEditor(YLabel label,
double x,
double y,
PropertyChangeListener listener)
Same as openLabelEditor(YLabel,double,double,PropertyChangeListener,boolean)
but uses single-line mode by default. |
void |
openLabelEditor(YLabel label,
double x,
double y,
PropertyChangeListener listener,
boolean useSingleLineMode)
Opens a label editor for the given label at world coordinate (x,y). |
protected void |
paintSelectionBox(Graphics2D gfx,
Rectangle2D box)
Paints a selection box on the given graphics context. |
void |
paintVisibleContent(Graphics2D gfx)
Paints the visible part of this view's content on the given graphics context. |
void |
print(Graphics g)
Prints the currently displayed contents of this view to the given graphics context. |
void |
registerKeyboardAction(ActionListener anAction,
KeyStroke aKeyStroke,
int aCondition)
Registers a keyboard action for this view. |
void |
registerKeyboardAction(ActionListener anAction,
String aCommand,
KeyStroke aKeyStroke,
int aCondition)
Registers a keyboard action for this view. |
void |
removeBackgroundDrawable(Drawable d)
Removes a background drawable from this view. |
void |
removeDrawable(Drawable d)
Removes a drawable from this view. |
void |
removeViewMode(ViewMode vm)
Remove a view mode from this Graph2DView. |
void |
requestFocus()
|
void |
setAntialiasedPainting(boolean antialiasedPainting)
Setter for property antialiasedPainting. |
void |
setBackgroundRenderer(BackgroundRenderer renderer)
Sets the BackgroundRenderer of this view. |
void |
setBounds(int x,
int y,
int w,
int h)
Sets the bounds of this component. |
void |
setCenter(double x,
double y)
Sets the world coordinate that should be displayed in the center of this view. |
void |
setContentPolicy(int policy)
Specifies the policy for the calculation of the content bounding box. |
void |
setDrawingMode(int mode)
Sets the drawing mode for this view. |
void |
setFitContentOnResize(boolean b)
Specifies whether or not to fit the content inside the view automatically whenever this component changes it's size. |
void |
setGraph2D(Graph2D graph)
Sets the graph that this view displays. |
void |
setGraph2DRenderer(Graph2DRenderer renderer)
Sets the renderer used to render the bound Graph2D. |
void |
setGridColor(Color color)
Sets the color of the grid By default the grid is painted in gray. |
void |
setGridCursorPosition(double x,
double y)
Sets the position of the grid cursor. |
void |
setGridMode(boolean b)
Turns grid on or off on the view. |
void |
setGridResolution(double res)
Sets resolution of the grid. |
void |
setGridType(int type)
Sets type of the grid. |
void |
setGridVisible(boolean b)
Turns grid's visibility on or off on the view. |
void |
setHorizontalScrollBarPolicy(int policy)
Sets the scroll bar policy for the horizontal scroll bar. |
void |
setPaintDetailThreshold(double thresh)
Sets the scale threshold after that less detailed versions of the graphs are displayed. |
void |
setScrollBarPolicy(int vsbp,
int hsbp)
Sets the scroll bar policy for the scroll bars. |
void |
setSecureDrawingMode(boolean b)
If set to true, all drawing optimizations will be
disabled. |
void |
setSelectionBoxBounds(Rectangle r)
Sets the bounds of the selection box being displayed while in SELECTION_BOX_MODE. |
void |
setSelectionBoxBounds2D(Rectangle2D r)
Sets the bounds of the selection box being displayed while in SELECTION_BOX_MODE. |
void |
setToolTipText(String text)
Sets the tool tip text. this method can be used in a view mode to show tip texts to show context sensitive tips over nodes, etc. |
void |
setVerticalScrollBarPolicy(int policy)
Sets the scroll bar policy for the vertical scroll bar. |
void |
setViewControl(ViewControl vc)
Sets the view control for this view. |
void |
setViewCursor(Cursor c)
Sets the cursor that is displayed when the mouse is over this view. |
void |
setViewPoint(int x,
int y)
Sets the world coordinate that is being displayed at the upper left corner of this view. |
void |
setViewPoint2D(double x,
double y)
Sets the world coordinate that is being displayed at the upper left corner of this view. |
void |
setWorldRect(int x,
int y,
int w,
int h)
Sets the bounds of the world rectangle. |
void |
setZoom(double zoom)
Sets the current zoom level that will be used to display the contents. |
void |
showPopup(JPopupMenu popup,
double x,
double y)
Displays the given popup menu at world coordinate (x,y). |
int |
toViewCoordX(double x)
Transforms a x world-coordinate to a x view-coordinate. |
int |
toViewCoordY(double y)
Transforms a y world-coordinate to a y view-coordinate. |
double |
toWorldCoordX(int x)
Transforms a x view-coordinate to a x world-coordinate. |
double |
toWorldCoordY(int y)
Transforms a y view-coordinate to a y world-coordinate. |
void |
unregisterKeyboardAction(KeyStroke aKeyStroke)
Unregisters a keyboard action for this view. |
void |
updateView()
Forces this view to repaint its contents. |
void |
updateView(double x,
double y,
double w,
double h)
Forces this view to repaint its contents for the given world coordinate rectangle. |
void |
updateView(Rectangle2D bounds)
Forces this view to repaint its contents for the given world coordinate rectangle. |
void |
updateWorldRect()
Updates the current world rectangle. |
void |
zoomToArea(double x,
double y,
double width,
double height)
Adjusts the zoom level and view point of this view such that the given bounds are visible in this view. |