| javax.swing.JComponent org.jgraph.JGraph
All known Subclasses: com.jgraph.example.EditorGraph,
JGraph | public class JGraph extends JComponent implements Scrollable,Accessible,Serializable(Code) | | A control that displays a network of related objects using the well-known
paradigm of a graph.
A JGraph object doesn't actually contain your data; it simply provides a view
of the data. Like any non-trivial Swing component, the graph gets data by
querying its data model.
JGraph displays its data by drawing individual elements. Each element
displayed by the graph contains exactly one item of data, which is called a
cell. A cell may either be a vertex or an edge. Vertices may have neighbours
or not, and edges may have source and target vertices or not, depending on
whether they are connected.
Creating a Graph
The following code creates a JGraph object:
JGraph graph = new JGraph();
...
JScrollPane graphLayoutCache = new JScrollPane(graph)
The code creates an instance of JGraph and puts it in a scroll pane. JGraphs
constructor is called with no arguments in this example, which causes the
constructor to create a sample model.
Editing
Outmoved, cloned, resized, and shaped, or connected/disconnected to or from
other cells.
Keyboard Bindings
JGraph defines the following set of keyboard bindings:
- Alt-Click forces marquee selection if over a cell.
- Shift- or Ctrl-Select extends or toggles the selection.
- Shift-Drag constrains the offset to one direction.
- Ctrl-Drag clones the selection.
- Doubleclick/F2 starts editing a cell.
You can change the number of clicks that triggers editing using
setEditClickCount().
Customization
There are a number of additional methods that customize JGraph. For example,
setMinimumMove() defines the minimum amount of pixels before a move operation
is initiated. setSnapSize() defines the maximum distance for a cell to be
selected. setFloatEnabled() enables/disables port floating.
With setDisconnectOnMove() you can indicate if the selected subgraph should
be disconnected from the unselected rest when a move operation is initiated.
setDragEnabled() enables/disables the use of Drag And Drop, and
setDropEnabled() sets if the graph accepts Drops from external sources.
Customizing a graphs display
JGraph performs some look-and-feel specific painting. You can customize this
painting in a limited way. For example, you can modify the grid using
setGridColor() and setGridSize(), and you can change the handle colors using
setHandleColor() and setLockedHandleColor().
If you want finer control over the rendering, you can subclass one of the
default renderers, and extend its paint()-method. A renderer is a
Component-extension that paints a cell based on its attributes. Thus, neither
the JGraph nor its look-and-feel-specific implementation actually contain the
code that paints the cell. Instead, the graph uses the cell renderers
painting code.
Selection
Apart from the single-cell and marquee-selection, JGraphs selection model
also allows to "step-into" groups, and select children. This feature can be
disabled using the setAllowsChildSelection() method of the selection model
instance.
If you are interested in knowing when the selection changes implement the
GraphSelectionListener interface and add the instance using
the method addGraphSelectionListener .
valueChanged will be invoked when the selection changes, that
is if the user clicks twice on the same vertex valueChanged
will only be invoked once.
Change Notification
For detection of double-clicks or when a user clicks on a cell, regardless of
whether or not it was selected, I recommend you implement a MouseListener and
use getFirstCellForLocation .
Undo Support
To enable Undo-Support, a GraphUndoManager must be added using
addGraphSelectionListener . The GraphUndoManager is an
extension of Swing's GraphUndoManager that maintains a command
history in the context of multiple views. In this setup, a cell may have a
set of attributes in each view attached to the model.
For example, consider a position that is stored separately in each view. If a
node is inserted, the change will be visible in all attached views, resulting
in a new node that pops-up at the initial position. If the node is
subsequently moved, say, in view1, this does not constitute a change in
view2. If view2 does an "undo", the move and the insertion must be
undone, whereas an "undo" in view1 will only undo the previous move
operation.
Like all JComponent classes, you can use
javax.swing.InputMap and
javax.swing.ActionMap to associate
an
javax.swing.Action object with a
javax.swing.KeyStroke and
execute the action under specified conditions.
author: Gaudenz Alder version: 2.1 16/03/03 |
Method Summary | |
public void | addGraphSelectionListener(GraphSelectionListener tsl) Adds a listener for GraphSelection events. | public static void | addSampleData(GraphModel model) Creates and returns a sample GraphModel . | public void | addSelectionCell(Object cell) Adds the cell identified by the specified Object to the
current selection. | public void | addSelectionCells(Object[] cells) Adds each cell in the array of cells to the current selection. | public void | cancelEditing() Cancels the current editing session. | public void | clearSelection() Clears the selection. | public Map | cloneCells(Object[] cells) Returns a map of (cell, clone)-pairs for all cells and
their children. | public String | convertValueToString(Object value) Converts the specified value to string. | public static Map | createBounds(AttributeMap map, int x, int y, Color c) Returns an attributeMap for the specified position and color. | protected void | createBufferedImage(int width, int height) | public boolean | drawImage(int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) Utility method to draw the off screen buffer
Parameters: dx1 - the x coordinate of the first corner of thedestination rectangle. Parameters: dy1 - the y coordinate of the first corner of thedestination rectangle. Parameters: dx2 - the x coordinate of the second corner of thedestination rectangle. Parameters: dy2 - the y coordinate of the second corner of thedestination rectangle. Parameters: sx1 - the x coordinate of the first corner of the sourcerectangle. Parameters: sy1 - the y coordinate of the first corner of the sourcerectangle. Parameters: sx2 - the x coordinate of the second corner of the sourcerectangle. Parameters: sy2 - the y coordinate of the second corner of the sourcerectangle. | public boolean | drawImage(Graphics g) | protected void | fireValueChanged(GraphSelectionEvent e) Notifies all listeners that have registered interest for notification on
this event type. | public Point2D | fromScreen(Point2D p) Downscale the given point in place, using the given instance. | public Rectangle2D | fromScreen(Rectangle2D rect) Downscale the given rectangle in place, using the given instance. | public AttributeMap | getAttributes(Object cell) Returns the attributes for the specified cell. | public Component | getBackgroundComponent() | public ImageIcon | getBackgroundImage() Returns the background image. | public Rectangle2D | getCellBounds(Object cell) Returns the bounding rectangle of the specified cell. | public Rectangle2D | getCellBounds(Object[] cells) Returns the bounding rectangle of the specified cells. | public Point2D | getCenterPoint() Returns the center of the component relative to the parent viewport's
position. | public PortView | getDefaultPortForCell(Object cell) Returns the default portview for the specified cell. | public Object[] | getDescendants(Object[] cells) Returns all cells including all descendants in the passed
in order of cells. | public boolean | getEdgeLabelsMovable() Returns true if edge labels may be dragged and dropped. | public int | getEditClickCount() Returns the number of clicks for editing to start. | public Object | getEditingCell() Returns the cell that is currently being edited. | public Object | getFirstCellForLocation(double x, double y) Returns the topmost cell at the specified location. | public GraphLayoutCache | getGraphLayoutCache() Returns the GraphLayoutCache that is providing the
view-data. | public Color | getGridColor() Returns the current grid color. | public int | getGridMode() Returns the current grid view mode. | public double | getGridSize() Returns the size of the grid in pixels. | public Color | getHandleColor() Returns the current handle color. | public int | getHandleSize() Returns the size of the handles. | public Color | getHighlightColor() Returns the current highlight color. | public BufferedImage | getImage(Color bg, int inset) Returns a
BufferedImage for the graph using inset as an empty
border around the cells of the graph. | public boolean | getInvokesStopCellEditing() Returns the indicator that tells what happens when editing is
interrupted. | public CellView | getLeafViewAt(double x, double y) Returns the next view at the specified location wrt. | public Color | getLockedHandleColor() Returns the current second handle color. | public Color | getMarqueeColor() Returns the current marquee color. | public BasicMarqueeHandler | getMarqueeHandler() Returns the MarqueeHandler that will handle marquee
selection. | public int | getMinimumMove() Returns the miminum amount of pixels for a move operation. | public GraphModel | getModel() Returns the GraphModel that is providing the data. | public Object | getNextCellForLocation(Object current, double x, double y) Returns the cell at the specified location that is "behind" the
current cell. | public CellView | getNextSelectableViewAt(CellView current, double x, double y) Note: Arguments are not expected to be scaled (they are scaled in here). | public CellView | getNextViewAt(CellView current, double x, double y) Returns the next view at the specified location wrt. | public CellView | getNextViewAt(CellView current, double x, double y, boolean leafsOnly) Returns the next view at the specified location wrt. | public CellView | getNextViewAt(CellView[] cells, CellView c, double x, double y) Returns the next view at the specified location wrt. | public CellView | getNextViewAt(CellView[] cells, CellView c, double x, double y, boolean leafsOnly) Returns the next view at the specified location wrt. | public Graphics | getOffgraphics() Returns the current double buffering graphics object. | public Image | getOffscreen() | public Point2D | getOffscreenOffset() | public Object | getPortForLocation(double x, double y) Convenience method to return the port at the specified location. | public PortView | getPortViewAt(double x, double y) Returns the portview at the specified location. | public PortView | getPortViewAt(double x, double y, int tolerance) Returns the portview at the specified location. | public Dimension | getPreferredScrollableViewportSize() Returns the preferred display size of a JGraph . | public Object[] | getRoots() Returns all root cells (cells that have no parent) that the model
contains. | public Object[] | getRoots(Rectangle clip) Returns all cells that intersect the given rectangle. | public double | getScale() Returns the current scale. | public int | getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) Returns the amount for a block increment, which is the height or width of
visibleRect , based on orientation .
Parameters: visibleRect - the view area visible within the viewport Parameters: orientation - either SwingConstants.VERTICAL orSwingConstants.HORIZONTAL Parameters: direction - less than zero to scroll up/left, greater than zero fordown/right. | public boolean | getScrollableTracksViewportHeight() Returns false to indicate that the height of the viewport does not
determine the height of the graph, unless the preferred height of the
graph is smaller than the viewports height. | public boolean | getScrollableTracksViewportWidth() Returns false to indicate that the width of the viewport does not
determine the width of the graph, unless the preferred width of the graph
is smaller than the viewports width. | public int | getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) Returns the amount to increment when scrolling. | public Object | getSelectionCell() Returns the first selected cell. | public Object | getSelectionCellAt(Point2D pt) Returns the selection cell at the specified location. | public Object[] | getSelectionCells() Returns all selected cells. | public Object[] | getSelectionCells(Object[] cells) Returns all selected cells in cells . | public int | getSelectionCount() Returns the number of cells selected. | public GraphSelectionModel | getSelectionModel() Returns the model for selections. | public int | getTolerance() Returns the maximum distance between the mousepointer and a cell to be
selected. | public String | getToolTipText(MouseEvent e) Overrides JComponent 'sgetToolTipText
method in order to allow the graph to create a tooltip for the topmost
cell under the mousepointer. | public CellView | getTopmostViewAt(double x, double y, boolean reverse, boolean leafsOnly) Returns the topmost cell view at the specified location using the view's
bounds on non-leafs to check for containment. | public GraphUI | getUI() Returns the L&F object that renders this component. | public String | getUIClassID() Returns the name of the L&F class that renders this component. | public Rectangle2D | getViewPortBounds() Return the bounds of the parent viewport, if one exists. | public void | graphDidChange() Messaged when the graph has changed enough that we need to resize the
bounds, but not enough that we need to remove the cells (e.g cells were
inserted into the graph). | public boolean | isAntiAliased() Returns true if the graph will be anti aliased. | public boolean | isAutoResizeGraph() Returns true if the graph should be automatically resized when cells are
being moved below the bottom right corner. | public boolean | isBackgroundScaled() | public boolean | isBendable() Returns true if the graph allows adding/removing/modifying points. | public boolean | isCellEditable(Object cell) Returns true if the graph and the cell are editable. | public boolean | isCellSelected(Object cell) Returns true if the cell is currently selected. | public boolean | isCloneable() Returns true if cells are cloned on CTRL-Drag operations. | public boolean | isConnectable() Returns true if the graph allows new connections to be established. | public boolean | isDisconnectOnMove() Returns true if selected edges should be disconnected from unselected
vertices when they are moved. | public boolean | isDisconnectable() Returns true if the graph allows existing connections to be removed. | public boolean | isDragEnabled() Returns true if the graph uses Drag-and-Drop to move cells. | public boolean | isDropEnabled() Returns true if the graph accepts drops/pastes from external sources. | public boolean | isEditable() Returns true if the graph is editable (if it allows cells to be edited). | public boolean | isEditing() Returns true if the graph is being edited. | public boolean | isGridEnabled() Returns true if the grid is active. | public boolean | isGridVisible() Returns true if the grid will be visible. | public boolean | isGroupsEditable() | public boolean | isJumpToDefaultPort() Returns true if getPortViewAt should return the default port if no other
port is found. | public boolean | isMoveBelowZero() Returns true if the graph allows to move cells below zero. | public boolean | isMoveBeyondGraphBounds() | public boolean | isMoveIntoGroups() Returns true if cells should be added to groups when moved over the
group's area. | public boolean | isMoveOutOfGroups() Returns true if cells should be removed from groups when removed from the
group's area. | public boolean | isMoveable() | public boolean | isOffscreenValid() | public boolean | isPortsScaled() Returns true if the ports will be scaled. | public boolean | isPortsVisible() Returns true if the ports will be visible. | public boolean | isPreviewInvalidNullPorts() | public boolean | isSelectionEmpty() Returns true if the selection is currently empty. | public boolean | isSelectionEnabled() | public boolean | isSizeable() Returns true if the graph allows cells to be resized. | public boolean | isVolatileOffscreen() | public boolean | isXorEnabled() Returns true if the graph accepts drops/pastes from external sources. | public static void | main(String[] args) | public Object[] | order(Object[] cells) Returns all cells including all descendants ordered using
the current layering data stored by the model. | protected String | paramString() Returns a string representation of this JGraph . | public void | removeGraphSelectionListener(GraphSelectionListener tsl) Removes a GraphSelection listener. | public void | removeSelectionCell(Object cell) Removes the cell identified by the specified Object from the current
selection. | public void | repaint(long tm, int x, int y, int width, int height) You should not call this method directly on a JGraph if you are using
double buffering. | public void | repaint(Rectangle r) | public void | repaint() | public void | repaint(int x, int y, int width, int height) | public void | repaint(long tm) | public void | scrollCellToVisible(Object cell) Scrolls to the specified cell. | public void | scrollPointToVisible(Point2D p) Makes sure the specified point is visible. | public void | setAntiAliased(boolean newValue) Sets antialiasing on or off based on the boolean value. | public void | setAutoResizeGraph(boolean autoResizeGraph) | public void | setBackgroundComponent(Component backgroundComponent) | public void | setBackgroundImage(ImageIcon backgroundImage) Sets the background image. | public void | setBackgroundScaled(boolean backgroundScaled) | public void | setBendable(boolean flag) Sets if the graph allows adding/removing/modifying points. | public void | setCloneable(boolean flag) Sets if cells are cloned on CTRL-Drag operations. | public void | setConnectable(boolean flag) Setse if the graph allows new connections to be established. | public void | setDisconnectOnMove(boolean flag) Sets if selected edges should be disconnected from unselected vertices
when they are moved. | public void | setDisconnectable(boolean flag) Sets if the graph allows existing connections to be removed. | public void | setDragEnabled(boolean flag) Sets if the graph uses Drag-and-Drop to move cells. | public void | setDropEnabled(boolean flag) Sets if the graph accepts drops/pastes from external sources. | public void | setEdgeLabelsMovable(boolean edgeLabelsMovable) Set if edge labels may be moved with the mouse or not. | public void | setEditClickCount(int count) Sets the number of clicks for editing to start. | public void | setEditable(boolean flag) Determines whether the graph is editable. | public void | setGraphLayoutCache(GraphLayoutCache newLayoutCache) Sets the GraphLayoutCache that will provide the view-data. | public void | setGridColor(Color newColor) Sets the current grid color. | public void | setGridEnabled(boolean flag) If set to true, the grid will be active. | public void | setGridMode(int mode) Sets the current grid view mode.
Parameters: mode - The current grid view mode. | public void | setGridSize(double newSize) Sets the size of the grid. | public void | setGridVisible(boolean flag) If set to true, the grid will be visible. | public void | setGroupsEditable(boolean groupsEditable) | public void | setHandleColor(Color newColor) Sets the current handle color. | public void | setHandleSize(int size) Sets the size of the handles. | public void | setHighlightColor(Color newColor) Sets the current selection highlight color. | public void | setInvokesStopCellEditing(boolean newValue) Determines what happens when editing is interrupted by selecting another
cell in the graph, a change in the graph's data, or by some other means. | public void | setJumpToDefaultPort(boolean flag) Sets if getPortViewAt should return the default port if no other port is
found. | public void | setLockedHandleColor(Color newColor) Sets the current second handle color. | public void | setMarqueeColor(Color newColor) Sets the current marquee color. | public void | setMarqueeHandler(BasicMarqueeHandler newMarquee) Sets the MarqueeHandler that will handle marquee
selection. | public void | setMinimumMove(int pixels) Sets the miminum amount of pixels for a move operation. | public void | setModel(GraphModel newModel) Sets the GraphModel that will provide the data. | public void | setMoveBelowZero(boolean moveBelowZero) Sets if the graph should auto resize when cells are being moved below the
bottom right corner. | public void | setMoveBeyondGraphBounds(boolean moveBeyondGraphBounds) | public void | setMoveIntoGroups(boolean flag) Specifies if cells should be added to groups when moved over the group's
area. | public void | setMoveOutOfGroups(boolean flag) Specifies if cells should be removed from groups when removed from the
group's area. | public void | setMoveable(boolean flag) Sets if the graph allows movement of cells. | public void | setOffscreenOffset(Point2D offscreenOffset) | public void | setOffscreenValid(boolean offscreenValid) | public void | setPortsScaled(boolean flag) If set to true, the ports will be scaled. | public void | setPortsVisible(boolean flag) If set to true, the ports will be visible. | public void | setPreviewInvalidNullPorts(boolean flag) | public void | setScale(double newValue) Sets the current scale. | public void | setScale(double newValue, Point2D center) | public void | setSelectionCell(Object cell) Selects the specified cell. | public void | setSelectionCells(Object[] cells) Selects the specified cells. | public void | setSelectionEnabled(boolean flag) Determines whether cell selection is enabled. | public void | setSelectionModel(GraphSelectionModel selectionModel) Sets the graph's selection model. | public void | setSizeable(boolean flag) Sets if the graph allows cells to be resized. | public void | setTolerance(int size) Sets the maximum distance between the mousepointer and a cell to be
selected. | public void | setUI(GraphUI ui) Sets the L&F object that renders this component. | public void | setVolatileOffscreen(boolean volatileOffscreen) | public void | setXorEnabled(boolean flag) Sets if the graph accepts drops/pastes from external sources. | protected void | setupOffScreen(int x, int y, int width, int height, Rectangle2D newOffscreenBuffer) | public Point2D | snap(Point2D p) Returns the given point applied to the grid.
Parameters: p - a point in screen coordinates. | public Rectangle2D | snap(Rectangle2D r) Returns the given rectangle applied to the grid.
Parameters: r - a rectangle in screen coordinates. | public Dimension2D | snap(Dimension2D d) Returns the given dimension applied to the grid.
Parameters: d - a dimension in screen coordinates to snap to. | public void | startEditingAtCell(Object cell) Selects the specified cell and initiates editing. | public boolean | stopEditing() Ends the current editing session. | public Point2D | toScreen(Point2D p) Upscale the given point in place, using the given instance. | public Rectangle2D | toScreen(Rectangle2D rect) Upscale the given rectangle in place, using the given instance. | public void | updateAutoSize(CellView view) Computes and updates the size for view . | public void | updateUI() Notification from the UIManager that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager . |
ANTIALIASED_PROPERTY | final public static String ANTIALIASED_PROPERTY(Code) | | Bound property name for antiAliased .
|
CROSS_GRID_MODE | final public static int CROSS_GRID_MODE(Code) | | |
DOT_GRID_MODE | final public static int DOT_GRID_MODE(Code) | | |
EDITABLE_PROPERTY | final public static String EDITABLE_PROPERTY(Code) | | Bound property name for editable .
|
GRAPH_LAYOUT_CACHE_PROPERTY | final public static String GRAPH_LAYOUT_CACHE_PROPERTY(Code) | | Bound property name for graphModel .
|
GRAPH_MODEL_PROPERTY | final public static String GRAPH_MODEL_PROPERTY(Code) | | Bound property name for graphModel .
|
GRID_COLOR_PROPERTY | final public static String GRID_COLOR_PROPERTY(Code) | | Bound property name for gridColor .
|
GRID_SIZE_PROPERTY | final public static String GRID_SIZE_PROPERTY(Code) | | Bound property name for gridSize .
|
GRID_VISIBLE_PROPERTY | final public static String GRID_VISIBLE_PROPERTY(Code) | | Bound property name for gridVisible .
|
HANDLE_COLOR_PROPERTY | final public static String HANDLE_COLOR_PROPERTY(Code) | | Bound property name for gridColor .
|
HANDLE_SIZE_PROPERTY | final public static String HANDLE_SIZE_PROPERTY(Code) | | Bound property name for gridColor .
|
INVOKES_STOP_CELL_EDITING_PROPERTY | final public static String INVOKES_STOP_CELL_EDITING_PROPERTY(Code) | | Bound property name for messagesStopCellEditing .
|
IS_MAC | public static boolean IS_MAC(Code) | | |
LINE_GRID_MODE | final public static int LINE_GRID_MODE(Code) | | |
LOCKED_HANDLE_COLOR_PROPERTY | final public static String LOCKED_HANDLE_COLOR_PROPERTY(Code) | | Bound property name for gridColor .
|
MARQUEE_HANDLER_PROPERTY | final public static String MARQUEE_HANDLER_PROPERTY(Code) | | Bound property name for graphModel .
|
PORTS_SCALED_PROPERTY | final public static String PORTS_SCALED_PROPERTY(Code) | | Bound property name for portsScaled .
|
PORTS_VISIBLE_PROPERTY | final public static String PORTS_VISIBLE_PROPERTY(Code) | | Bound property name for gridVisible .
|
PROPERTY_BACKGROUNDIMAGE | final public static String PROPERTY_BACKGROUNDIMAGE(Code) | | Bound property name for backgroundImage .
|
SCALE_PROPERTY | final public static String SCALE_PROPERTY(Code) | | Bound property name for scale .
|
SELECTIONENABLED_PROPERTY | final public static String SELECTIONENABLED_PROPERTY(Code) | | Bound property name for selectionEnabled .
|
SELECTION_MODEL_PROPERTY | final public static String SELECTION_MODEL_PROPERTY(Code) | | Bound property name for selectionModel .
|
antiAliased | protected boolean antiAliased(Code) | | True if the graph is anti-aliased. Default is false. Bound property.
|
autoResizeGraph | protected boolean autoResizeGraph(Code) | | True if the graph should be auto resized when cells are moved below the
bottom right corner. Default is true.
|
backgroundComponent | protected Component backgroundComponent(Code) | | A Component responsible for drawing the background image, if any
|
backgroundImage | protected ImageIcon backgroundImage(Code) | | Holds the background image.
|
backgroundScaled | protected boolean backgroundScaled(Code) | | Whether or not the background image is scaled on zooming
|
bendable | protected boolean bendable(Code) | | True if the graph allows points to be modified/added/removed. Default is
true.
|
cloneable | protected boolean cloneable(Code) | | True if the graph allows "ctrl-drag" operations. Default is false.
|
connectable | protected boolean connectable(Code) | | True if the graph allows new connections to be established. Default is
true.
|
disconnectOnMove | protected boolean disconnectOnMove(Code) | | True if selected edges are disconnected from unselected vertices on move.
Default is false.
|
disconnectable | protected boolean disconnectable(Code) | | True if the graph allows existing connections to be removed. Default is
true.
|
dragEnabled | protected boolean dragEnabled(Code) | | True if Drag-and-Drop should be used for move operations. Default is
false due to a JDK bug.
|
dropEnabled | protected boolean dropEnabled(Code) | | True if the graph accepts transfers from other components (graphs). This
also affects the clipboard. Default is true.
|
edgeLabelsMovable | protected boolean edgeLabelsMovable(Code) | | True if the labels on edges may be moved.
|
editClickCount | protected int editClickCount(Code) | | Number of clicks for editing to start. Default is 2 clicks.
|
editable | protected boolean editable(Code) | | True if the graph allows editing the value of a cell. Bound property.
|
enabled | protected boolean enabled(Code) | | True if the graph allows interactions. Default is true.
|
graphLayoutCache | protected transient GraphLayoutCache graphLayoutCache(Code) | | The view that defines the display properties of the model. Bound
property.
|
graphModel | protected transient GraphModel graphModel(Code) | | The model that defines the graph displayed by this object. Bound
property.
|
gridColor | protected Color gridColor(Code) | | The color of the grid. Changes when the Look-and-Feel changes.
|
gridEnabled | protected boolean gridEnabled(Code) | | True if the snap method should be active (snap to grid).
|
gridMode | protected int gridMode(Code) | | The style of the grid. Use one of the _GRID_MODE constants.
|
gridSize | protected double gridSize(Code) | | The size of the grid in points. Default is 10. Bound property.
|
gridVisible | protected boolean gridVisible(Code) | | True if the grid is visible. Bound property.
|
groupsEditable | protected boolean groupsEditable(Code) | | True if the graph allows editing of non-leaf cells. Bound property.
|
handleColorlockedHandleColor | protected Color handleColorlockedHandleColor(Code) | | Color of the handles and locked handles. Changes when the Look-and-Feel
changes.
|
handleSize | protected int handleSize(Code) | | Size of a handle. Default is 3 pixels.
|
highlightColor | protected Color highlightColor(Code) | | Highlight Color. Changes when the Look-and-Feel changes.
|
invokesStopCellEditing | protected boolean invokesStopCellEditing(Code) | | If true, when editing is to be stopped by way of selection changing, data
in graph changing or other means stopCellEditing is
invoked, and changes are saved. If false, cancelCellEditing
is invoked, and changes are discarded.
|
isJumpToDefaultPort | protected boolean isJumpToDefaultPort(Code) | | True if getPortViewAt should return the default port if no other port is
found. Default is false.
|
isMoveIntoGroups | protected boolean isMoveIntoGroups(Code) | | Specifies if cells should be added to a group when moved over the group's
area. Default is false.
|
isMoveOutOfGroups | protected boolean isMoveOutOfGroups(Code) | | Specifies if cells should be removed from groups when removed from the
group area. Default is false.
|
marqueeColor | protected Color marqueeColor(Code) | | Color of the marquee. Changes when the Look-and-Feel changes.
|
minimumMove | protected int minimumMove(Code) | | Minimum amount of pixels to start a move transaction. Default is 5.
|
moveBelowZero | protected boolean moveBelowZero(Code) | | True if the graph allows to move cells below zero.
|
moveBeyondGraphBounds | protected boolean moveBeyondGraphBounds(Code) | | True if the graph allows to move cells beyond the graph bounds
|
moveable | protected boolean moveable(Code) | | True if the graph allows move operations. Default is true.
|
offgraphics | protected transient Graphics offgraphics(Code) | | Graphics object of off screen image
|
offscreen | protected transient Image offscreen(Code) | | Off screen image for double buffering
|
offscreenBounds | protected transient Rectangle2D offscreenBounds(Code) | | The bounds of the offscreen buffer
|
offscreenBuffer | protected transient int offscreenBuffer(Code) | | The buffer around the offscreen graphics object that provides the
specified distance of scrolling before the buffer has to be redrawn.
Increasing the value means fewer redraws but more memory is required.
|
offscreenOffset | protected transient Point2D offscreenOffset(Code) | | The offset of the offscreen buffer
|
offscreenValid | protected transient boolean offscreenValid(Code) | | Whether or not the current background image is correct
|
portsScaled | protected boolean portsScaled(Code) | | True if the ports are scaled. Bound property.
|
portsVisible | protected boolean portsVisible(Code) | | True if the ports are visible. Bound property.
|
previewInvalidNullPorts | protected boolean previewInvalidNullPorts(Code) | | True if the graph allows invalid null ports during previews (aka flip
back edges). Default is true.
|
scale | protected double scale(Code) | | Scale of the graph. Default is 1. Bound property.
|
selectionEnabled | protected boolean selectionEnabled(Code) | | True if the graph allows selection of cells. Note: You must also disable
selectNewCells if you disable this. Bound property.
|
selectionModel | protected transient GraphSelectionModel selectionModel(Code) | | Models the set of selected objects in this graph. Bound property.
|
selectionRedirector | protected transient GraphSelectionRedirector selectionRedirector(Code) | | Creates a new event and passes it off the selectionListeners .
|
sizeable | protected boolean sizeable(Code) | | True if the graph allows cells to be resized. Default is true.
|
tolerance | protected int tolerance(Code) | | Maximum distance between a cell and the mousepointer. Default is 4.
|
volatileOffscreen | protected boolean volatileOffscreen(Code) | | Whether or not to try to use a volatile offscreen buffer for double
buffering. Volatile
|
xorEnabled | protected boolean xorEnabled(Code) | | True if the graph accepts transfers from other components (graphs). This
also affects the clipboard. Default is true.
|
JGraph | public JGraph()(Code) | | Returns a JGraph with a sample model.
|
JGraph | public JGraph(GraphModel model)(Code) | | Returns an instance of JGraph which displays the the
specified data model.
Parameters: model - the GraphModel to use as the data model |
JGraph | public JGraph(GraphLayoutCache cache)(Code) | | Returns an instance of JGraph which displays the data
model using the specified view.
Parameters: cache - the GraphLayoutCache to use as the view |
JGraph | public JGraph(GraphModel model, GraphLayoutCache cache)(Code) | | Returns an instance of JGraph which displays the specified
data model using the specified view.
Parameters: model - the GraphModel to use as the data model Parameters: cache - the GraphLayoutCache to use as the cache |
JGraph | public JGraph(GraphModel model, BasicMarqueeHandler mh)(Code) | | Returns an instance of JGraph which displays the specified
data model and assigns the specified marquee handler
Parameters: model - the GraphModel to use as the data model Parameters: mh - the BasicMarqueeHandler to use as the marqueehandler |
JGraph | public JGraph(GraphModel model, GraphLayoutCache layoutCache, BasicMarqueeHandler mh)(Code) | | Returns an instance of JGraph which displays the specified
data model using the specified view and assigns the specified marquee
handler
Parameters: model - the GraphModel to use as the data model Parameters: layoutCache - the GraphLayoutCache to use as the cache Parameters: mh - the BasicMarqueeHandler to use as the marqueehandler |
addGraphSelectionListener | public void addGraphSelectionListener(GraphSelectionListener tsl)(Code) | | Adds a listener for GraphSelection events.
Parameters: tsl - the GraphSelectionListener that will benotified when a cell is selected or deselected (a "negativeselection") |
addSampleData | public static void addSampleData(GraphModel model)(Code) | | Creates and returns a sample GraphModel . Used primarily
for beanbuilders to show something interesting.
|
addSelectionCell | public void addSelectionCell(Object cell)(Code) | | Adds the cell identified by the specified Object to the
current selection.
Parameters: cell - the cell to be added to the selection |
addSelectionCells | public void addSelectionCells(Object[] cells)(Code) | | Adds each cell in the array of cells to the current selection.
Parameters: cells - an array of objects that specifies the cells to add |
cancelEditing | public void cancelEditing()(Code) | | Cancels the current editing session. Has no effect if the graph isn't
being edited.
|
clearSelection | public void clearSelection()(Code) | | Clears the selection.
|
cloneCells | public Map cloneCells(Object[] cells)(Code) | | Returns a map of (cell, clone)-pairs for all cells and
their children. Special care is taken to replace the anchor references
between ports. (Iterative implementation.)
|
convertValueToString | public String convertValueToString(Object value)(Code) | | Converts the specified value to string. If the value is an instance of
CellView then the corresponding value or cell is used.
|
createBounds | public static Map createBounds(AttributeMap map, int x, int y, Color c)(Code) | | Returns an attributeMap for the specified position and color.
|
createBufferedImage | protected void createBufferedImage(int width, int height)(Code) | | Utility method to create a standard buffered image
Parameters: width - Parameters: height - |
drawImage | public boolean drawImage(int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)(Code) | | Utility method to draw the off screen buffer
Parameters: dx1 - the x coordinate of the first corner of thedestination rectangle. Parameters: dy1 - the y coordinate of the first corner of thedestination rectangle. Parameters: dx2 - the x coordinate of the second corner of thedestination rectangle. Parameters: dy2 - the y coordinate of the second corner of thedestination rectangle. Parameters: sx1 - the x coordinate of the first corner of the sourcerectangle. Parameters: sy1 - the y coordinate of the first corner of the sourcerectangle. Parameters: sx2 - the x coordinate of the second corner of the sourcerectangle. Parameters: sy2 - the y coordinate of the second corner of the sourcerectangle. true if the current output representation iscomplete; false otherwise. |
fireValueChanged | protected void fireValueChanged(GraphSelectionEvent e)(Code) | | Notifies all listeners that have registered interest for notification on
this event type. The event instance is lazily created using the
parameters passed into the fire method.
Parameters: e - the GraphSelectionEvent generated by theGraphSelectionModel when a cell is selected ordeselected See Also: javax.swing.event.EventListenerList |
fromScreen | public Point2D fromScreen(Point2D p)(Code) | | Downscale the given point in place, using the given instance.
Parameters: p - the point to be downscaled the downscaled point instance |
fromScreen | public Rectangle2D fromScreen(Rectangle2D rect)(Code) | | Downscale the given rectangle in place, using the given instance.
Parameters: rect - the rectangle to be downscaled the down-scaled rectangle instance |
getAttributes | public AttributeMap getAttributes(Object cell)(Code) | | Returns the attributes for the specified cell. If the layout cache
returns a view for the cell then this method returns allAttributes,
otherwise the method returns model.getAttributes(cell).
|
getBackgroundComponent | public Component getBackgroundComponent()(Code) | | the backgroundComponent |
getBackgroundImage | public ImageIcon getBackgroundImage()(Code) | | Returns the background image.
Returns the backgroundImage. |
getCellBounds | public Rectangle2D getCellBounds(Object cell)(Code) | | Returns the bounding rectangle of the specified cell.
|
getCellBounds | public Rectangle2D getCellBounds(Object[] cells)(Code) | | Returns the bounding rectangle of the specified cells.
|
getCenterPoint | public Point2D getCenterPoint()(Code) | | Returns the center of the component relative to the parent viewport's
position.
|
getDefaultPortForCell | public PortView getDefaultPortForCell(Object cell)(Code) | | Returns the default portview for the specified cell. The default
implementation returns the first floating port (ie. the first port that
does not define an offset) or the port, if there is only one
port.
Parameters: cell - the cell whose port is to be obtained the port view of the specified cell |
getDescendants | public Object[] getDescendants(Object[] cells)(Code) | | Returns all cells including all descendants in the passed
in order of cells.
|
getEdgeLabelsMovable | public boolean getEdgeLabelsMovable()(Code) | | Returns true if edge labels may be dragged and dropped.
whether edge labels may be dragged and dropped |
getEditClickCount | public int getEditClickCount()(Code) | | Returns the number of clicks for editing to start.
|
getEditingCell | public Object getEditingCell()(Code) | | Returns the cell that is currently being edited.
the cell being edited |
getFirstCellForLocation | public Object getFirstCellForLocation(double x, double y)(Code) | | Returns the topmost cell at the specified location.
Parameters: x - an integer giving the number of pixels horizontally from theleft edge of the display area, minus any left margin Parameters: y - an integer giving the number of pixels vertically from the topof the display area, minus any top margin the topmost cell at the specified location |
getGraphLayoutCache | public GraphLayoutCache getGraphLayoutCache()(Code) | | Returns the GraphLayoutCache that is providing the
view-data.
the view that is providing the view-data |
getGridColor | public Color getGridColor()(Code) | | Returns the current grid color.
|
getGridMode | public int getGridMode()(Code) | | Returns the current grid view mode.
|
getGridSize | public double getGridSize()(Code) | | Returns the size of the grid in pixels.
the size of the grid as an int |
getHandleColor | public Color getHandleColor()(Code) | | Returns the current handle color.
|
getHandleSize | public int getHandleSize()(Code) | | Returns the size of the handles.
|
getHighlightColor | public Color getHighlightColor()(Code) | | Returns the current highlight color.
|
getImage | public BufferedImage getImage(Color bg, int inset)(Code) | | Returns a
BufferedImage for the graph using inset as an empty
border around the cells of the graph. If bg is null then a transparent
background is applied to the image, else the background is filled with
the bg color. Therefore, one should only use a null background if the
fileformat support transparency, eg. GIF and PNG. For JPG, you can use
Color.WHITE for example.
Returns an image of the graph. |
getInvokesStopCellEditing | public boolean getInvokesStopCellEditing()(Code) | | Returns the indicator that tells what happens when editing is
interrupted.
the indicator that tells what happens when editing is interrupted See Also: JGraph.setInvokesStopCellEditing |
getLeafViewAt | public CellView getLeafViewAt(double x, double y)(Code) | | Returns the next view at the specified location wrt. c in
the specified array of views. The views must be in order, as returned,
for example, by GraphLayoutCache.order(Object[]).
|
getLockedHandleColor | public Color getLockedHandleColor()(Code) | | Returns the current second handle color.
|
getMarqueeColor | public Color getMarqueeColor()(Code) | | Returns the current marquee color.
|
getMarqueeHandler | public BasicMarqueeHandler getMarqueeHandler()(Code) | | Returns the MarqueeHandler that will handle marquee
selection.
|
getMinimumMove | public int getMinimumMove()(Code) | | Returns the miminum amount of pixels for a move operation.
|
getModel | public GraphModel getModel()(Code) | | Returns the GraphModel that is providing the data.
the model that is providing the data |
getNextCellForLocation | public Object getNextCellForLocation(Object current, double x, double y)(Code) | | Returns the cell at the specified location that is "behind" the
current cell. Returns the topmost cell if there are no
more cells behind current . Note: This does only return
visible cells.
|
getNextSelectableViewAt | public CellView getNextSelectableViewAt(CellView current, double x, double y)(Code) | | Note: Arguments are not expected to be scaled (they are scaled in here).
|
getNextViewAt | public CellView getNextViewAt(CellView current, double x, double y)(Code) | | Returns the next view at the specified location wrt. current .
This is used to iterate overlapping cells, and cells that are grouped.
The current selection affects this method.
Note: This returns the next selectable view.
Note: Arguments are not expected to be scaled (they are scaled in here).
|
getNextViewAt | public CellView getNextViewAt(CellView current, double x, double y, boolean leafsOnly)(Code) | | Returns the next view at the specified location wrt. current .
This is used to iterate overlapping cells, and cells that are grouped.
The current selection affects this method.
Note: This returns the next selectable view.
Note: Arguments are not expected to be scaled (they are scaled in here).
|
getNextViewAt | public CellView getNextViewAt(CellView[] cells, CellView c, double x, double y)(Code) | | Returns the next view at the specified location wrt. c in
the specified array of views. The views must be in order, as returned,
for example, by GraphLayoutCache.order(Object[]).
|
getNextViewAt | public CellView getNextViewAt(CellView[] cells, CellView c, double x, double y, boolean leafsOnly)(Code) | | Returns the next view at the specified location wrt. c in
the specified array of views. The views must be in order, as returned,
for example, by GraphLayoutCache.order(Object[]).
|
getOffgraphics | public Graphics getOffgraphics()(Code) | | Returns the current double buffering graphics object. Checks to see if
the graph bounds has changed since the last time the off screen image was
created and if so, creates a new image.
the off screen graphics |
getOffscreen | public Image getOffscreen()(Code) | | the offscreen |
getOffscreenOffset | public Point2D getOffscreenOffset()(Code) | | the offscreenOffset |
getPortForLocation | public Object getPortForLocation(double x, double y)(Code) | | Convenience method to return the port at the specified location.
|
getPortViewAt | public PortView getPortViewAt(double x, double y)(Code) | | Returns the portview at the specified location.
Note: Arguments are not expected to be scaled (they are scaled in here).
|
getPortViewAt | public PortView getPortViewAt(double x, double y, int tolerance)(Code) | | Returns the portview at the specified location.
Note: Arguments are not expected to be scaled (they are scaled in here).
|
getPreferredScrollableViewportSize | public Dimension getPreferredScrollableViewportSize()(Code) | | Returns the preferred display size of a JGraph . The
height is determined from getPreferredWidth .
the graph's preferred size |
getRoots | public Object[] getRoots()(Code) | | Returns all root cells (cells that have no parent) that the model
contains.
|
getRoots | public Object[] getRoots(Rectangle clip)(Code) | | Returns all cells that intersect the given rectangle.
|
getScale | public double getScale()(Code) | | Returns the current scale.
the current scale as a double |
getScrollableBlockIncrement | public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)(Code) | | Returns the amount for a block increment, which is the height or width of
visibleRect , based on orientation .
Parameters: visibleRect - the view area visible within the viewport Parameters: orientation - either SwingConstants.VERTICAL orSwingConstants.HORIZONTAL Parameters: direction - less than zero to scroll up/left, greater than zero fordown/right. the "block" increment for scrolling in the specified direction See Also: javax.swing.JScrollBar.setBlockIncrement(int) |
getScrollableTracksViewportHeight | public boolean getScrollableTracksViewportHeight()(Code) | | Returns false to indicate that the height of the viewport does not
determine the height of the graph, unless the preferred height of the
graph is smaller than the viewports height. In other words: ensure that
the graph is never smaller than its viewport.
false See Also: Scrollable.getScrollableTracksViewportHeight |
getScrollableTracksViewportWidth | public boolean getScrollableTracksViewportWidth()(Code) | | Returns false to indicate that the width of the viewport does not
determine the width of the graph, unless the preferred width of the graph
is smaller than the viewports width. In other words: ensure that the
graph is never smaller than its viewport.
false See Also: Scrollable.getScrollableTracksViewportWidth |
getScrollableUnitIncrement | public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)(Code) | | Returns the amount to increment when scrolling. The amount is 4.
Parameters: visibleRect - the view area visible within the viewport Parameters: orientation - either SwingConstants.VERTICAL orSwingConstants.HORIZONTAL Parameters: direction - less than zero to scroll up/left, greater than zero fordown/right the "unit" increment for scrolling in the specified direction See Also: javax.swing.JScrollBar.setUnitIncrement(int) |
getSelectionCell | public Object getSelectionCell()(Code) | | Returns the first selected cell.
the Object for the first selected cell, ornull if nothing is currently selected |
getSelectionCellAt | public Object getSelectionCellAt(Point2D pt)(Code) | | Returns the selection cell at the specified location.
Returns the selection cell for pt . |
getSelectionCells | public Object[] getSelectionCells()(Code) | | Returns all selected cells.
an array of objects representing the selected cells, ornull if nothing is currently selected |
getSelectionCells | public Object[] getSelectionCells(Object[] cells)(Code) | | Returns all selected cells in cells .
|
getSelectionCount | public int getSelectionCount()(Code) | | Returns the number of cells selected.
the number of cells selected |
getSelectionModel | public GraphSelectionModel getSelectionModel()(Code) | | Returns the model for selections. This should always return a non-
null value. If you don't want to allow anything to be
selected set the selection model to null , which forces an
empty selection model to be used.
the current selection model See Also: JGraph.setSelectionModel |
getTolerance | public int getTolerance()(Code) | | Returns the maximum distance between the mousepointer and a cell to be
selected.
|
getToolTipText | public String getToolTipText(MouseEvent e)(Code) | | Overrides JComponent 'sgetToolTipText
method in order to allow the graph to create a tooltip for the topmost
cell under the mousepointer. This differs from JTree where the renderers
tooltip is used.
NOTE: For JGraph to properly display tooltips of its
renderers, JGraph must be a registered component with the
ToolTipManager . This can be done by invoking
ToolTipManager.sharedInstance().registerComponent(graph) .
This is not done automatically!
Parameters: e - the MouseEvent that initiated theToolTip display a string containing the tooltip or null ifevent is null |
getTopmostViewAt | public CellView getTopmostViewAt(double x, double y, boolean reverse, boolean leafsOnly)(Code) | | Returns the topmost cell view at the specified location using the view's
bounds on non-leafs to check for containment. If reverse is true this
will return the innermost view.
|
getUI | public GraphUI getUI()(Code) | | Returns the L&F object that renders this component.
the GraphUI object that renders this component |
getViewPortBounds | public Rectangle2D getViewPortBounds()(Code) | | Return the bounds of the parent viewport, if one exists. If one does not
exist, null is returned
the bounds of the parent viewport |
graphDidChange | public void graphDidChange()(Code) | | Messaged when the graph has changed enough that we need to resize the
bounds, but not enough that we need to remove the cells (e.g cells were
inserted into the graph). You should never have to invoke this, the UI
will invoke this as it needs to. (Note: This is invoked by GraphUI, eg.
after moving.)
|
isAntiAliased | public boolean isAntiAliased()(Code) | | Returns true if the graph will be anti aliased.
true if the graph is anti aliased |
isAutoResizeGraph | public boolean isAutoResizeGraph()(Code) | | Returns true if the graph should be automatically resized when cells are
being moved below the bottom right corner. Note if the value of
moveBeyondGraphBounds if false auto resizing
is automatically disabled
|
isBackgroundScaled | public boolean isBackgroundScaled()(Code) | | the backgroundScaled |
isBendable | public boolean isBendable()(Code) | | Returns true if the graph allows adding/removing/modifying points.
|
isCellEditable | public boolean isCellEditable(Object cell)(Code) | | Returns true if the graph and the cell are editable. This
is invoked from the UI before editing begins to ensure that the given
cell can be edited.
true if the specified cell is editable See Also: JGraph.isEditable |
isCellSelected | public boolean isCellSelected(Object cell)(Code) | | Returns true if the cell is currently selected.
Parameters: cell - an object identifying a cell true if the cell is selected |
isCloneable | public boolean isCloneable()(Code) | | Returns true if cells are cloned on CTRL-Drag operations.
|
isConnectable | public boolean isConnectable()(Code) | | Returns true if the graph allows new connections to be established.
|
isDisconnectOnMove | public boolean isDisconnectOnMove()(Code) | | Returns true if selected edges should be disconnected from unselected
vertices when they are moved.
|
isDisconnectable | public boolean isDisconnectable()(Code) | | Returns true if the graph allows existing connections to be removed.
|
isDragEnabled | public boolean isDragEnabled()(Code) | | Returns true if the graph uses Drag-and-Drop to move cells.
|
isDropEnabled | public boolean isDropEnabled()(Code) | | Returns true if the graph accepts drops/pastes from external sources.
|
isEditable | public boolean isEditable()(Code) | | Returns true if the graph is editable (if it allows cells to be edited).
true if the graph is editable |
isEditing | public boolean isEditing()(Code) | | Returns true if the graph is being edited. The item that is being edited
can be obtained using getEditingCell .
true if the user is currently editing a cell See Also: JGraph.getSelectionCell |
isGridVisible | public boolean isGridVisible()(Code) | | Returns true if the grid will be visible.
true if the grid is visible |
isGroupsEditable | public boolean isGroupsEditable()(Code) | | the groupsEditable |
isJumpToDefaultPort | public boolean isJumpToDefaultPort()(Code) | | Returns true if getPortViewAt should return the default port if no other
port is found.
|
isMoveBelowZero | public boolean isMoveBelowZero()(Code) | | Returns true if the graph allows to move cells below zero.
|
isMoveBeyondGraphBounds | public boolean isMoveBeyondGraphBounds()(Code) | | the moveBeyondGraphBounds |
isMoveIntoGroups | public boolean isMoveIntoGroups()(Code) | | Returns true if cells should be added to groups when moved over the
group's area.
|
isMoveOutOfGroups | public boolean isMoveOutOfGroups()(Code) | | Returns true if cells should be removed from groups when removed from the
group's area.
|
isMoveable | public boolean isMoveable()(Code) | | |
isOffscreenValid | public boolean isOffscreenValid()(Code) | | the offscreenValid |
isPortsScaled | public boolean isPortsScaled()(Code) | | Returns true if the ports will be scaled.
true if the ports are visible |
isPortsVisible | public boolean isPortsVisible()(Code) | | Returns true if the ports will be visible.
true if the ports are visible |
isPreviewInvalidNullPorts | public boolean isPreviewInvalidNullPorts()(Code) | | Returns true if graph allows invalid null ports during previews
true if the graph allows invalid null ports during previews |
isSelectionEmpty | public boolean isSelectionEmpty()(Code) | | Returns true if the selection is currently empty.
true if the selection is currently empty |
isSelectionEnabled | public boolean isSelectionEnabled()(Code) | | Returns true if the cell selection is enabled
true if the cell selection is enabled |
isSizeable | public boolean isSizeable()(Code) | | Returns true if the graph allows cells to be resized.
|
isVolatileOffscreen | public boolean isVolatileOffscreen()(Code) | | the volatileOffscreen |
isXorEnabled | public boolean isXorEnabled()(Code) | | Returns true if the graph accepts drops/pastes from external sources.
|
order | public Object[] order(Object[] cells)(Code) | | Returns all cells including all descendants ordered using
the current layering data stored by the model.
|
paramString | protected String paramString()(Code) | | Returns a string representation of this JGraph . This
method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not be
null .
a string representation of this JGraph . |
removeGraphSelectionListener | public void removeGraphSelectionListener(GraphSelectionListener tsl)(Code) | | Removes a GraphSelection listener.
Parameters: tsl - the GraphSelectionListener to remove |
removeSelectionCell | public void removeSelectionCell(Object cell)(Code) | | Removes the cell identified by the specified Object from the current
selection.
Parameters: cell - the cell to be removed from the selection |
repaint | public void repaint()(Code) | | |
repaint | public void repaint(int x, int y, int width, int height)(Code) | | |
repaint | public void repaint(long tm)(Code) | | |
scrollCellToVisible | public void scrollCellToVisible(Object cell)(Code) | | Scrolls to the specified cell. Only works when this JGraph
is contained in a JScrollPane .
Parameters: cell - the object identifying the cell to bring into view |
scrollPointToVisible | public void scrollPointToVisible(Point2D p)(Code) | | Makes sure the specified point is visible.
Parameters: p - the point that should be visible |
setAntiAliased | public void setAntiAliased(boolean newValue)(Code) | | Sets antialiasing on or off based on the boolean value.
Fires a property change for the ANTIALIASED_PROPERTY.
Parameters: newValue - whether to turn antialiasing on or off |
setAutoResizeGraph | public void setAutoResizeGraph(boolean autoResizeGraph)(Code) | | Sets whether or not the graph should be automatically resize when cells
are being moved below the bottom right corner
|
setBackgroundComponent | public void setBackgroundComponent(Component backgroundComponent)(Code) | | Parameters: backgroundComponent - the backgroundComponent to set |
setBackgroundImage | public void setBackgroundImage(ImageIcon backgroundImage)(Code) | | Sets the background image. Fires a property change event for
JGraph.PROPERTY_BACKGROUNDIMAGE .
Parameters: backgroundImage - The backgroundImage to set. |
setBackgroundScaled | public void setBackgroundScaled(boolean backgroundScaled)(Code) | | Parameters: backgroundScaled - the backgroundScaled to set |
setBendable | public void setBendable(boolean flag)(Code) | | Sets if the graph allows adding/removing/modifying points.
|
setCloneable | public void setCloneable(boolean flag)(Code) | | Sets if cells are cloned on CTRL-Drag operations.
|
setConnectable | public void setConnectable(boolean flag)(Code) | | Setse if the graph allows new connections to be established.
|
setDisconnectOnMove | public void setDisconnectOnMove(boolean flag)(Code) | | Sets if selected edges should be disconnected from unselected vertices
when they are moved.
|
setDisconnectable | public void setDisconnectable(boolean flag)(Code) | | Sets if the graph allows existing connections to be removed.
|
setDragEnabled | public void setDragEnabled(boolean flag)(Code) | | Sets if the graph uses Drag-and-Drop to move cells.
|
setDropEnabled | public void setDropEnabled(boolean flag)(Code) | | Sets if the graph accepts drops/pastes from external sources.
|
setEdgeLabelsMovable | public void setEdgeLabelsMovable(boolean edgeLabelsMovable)(Code) | | Set if edge labels may be moved with the mouse or not.
Parameters: edgeLabelsMovable - true if edge labels may be dragged |
setEditClickCount | public void setEditClickCount(int count)(Code) | | Sets the number of clicks for editing to start.
|
setEditable | public void setEditable(boolean flag)(Code) | | Determines whether the graph is editable. Fires a property change event
if the new setting is different from the existing setting.
Note: Editable determines whether the graph allows editing. This is not
to be confused with enabled, which allows the graph to handle mouse
events (including editing).
Parameters: flag - a boolean value, true if the graph is editable |
setGraphLayoutCache | public void setGraphLayoutCache(GraphLayoutCache newLayoutCache)(Code) | | Sets the GraphLayoutCache that will provide the view-data.
Note: Updates the graphs's model using using the model from the layout
cache.
Fires a property change for the GRAPH_LAYOUT_CACHE_PROPERTY.
Parameters: newLayoutCache - the GraphLayoutCache that is to provide theview-data |
setGridColor | public void setGridColor(Color newColor)(Code) | | Sets the current grid color.
|
setGridEnabled | public void setGridEnabled(boolean flag)(Code) | | If set to true, the grid will be active.
See Also: JGraph.snap(Point2D) |
setGridMode | public void setGridMode(int mode)(Code) | | Sets the current grid view mode.
Parameters: mode - The current grid view mode. Valid values are DOT_GRID_MODE ,CROSS_GRID_MODE , andLINE_GRID_MODE . |
setGridSize | public void setGridSize(double newSize)(Code) | | Sets the size of the grid.
Fires a property change for the GRID_SIZE_PROPERTY.
Parameters: newSize - the new size of the grid in pixels |
setGridVisible | public void setGridVisible(boolean flag)(Code) | | If set to true, the grid will be visible.
Fires a property change for the GRID_VISIBLE_PROPERTY.
|
setGroupsEditable | public void setGroupsEditable(boolean groupsEditable)(Code) | | Parameters: groupsEditable - the groupsEditable to set |
setHandleColor | public void setHandleColor(Color newColor)(Code) | | Sets the current handle color.
|
setHandleSize | public void setHandleSize(int size)(Code) | | Sets the size of the handles.
|
setHighlightColor | public void setHighlightColor(Color newColor)(Code) | | Sets the current selection highlight color.
|
setInvokesStopCellEditing | public void setInvokesStopCellEditing(boolean newValue)(Code) | | Determines what happens when editing is interrupted by selecting another
cell in the graph, a change in the graph's data, or by some other means.
Setting this property to true causes the changes to be
automatically saved when editing is interrupted.
Fires a property change for the INVOKES_STOP_CELL_EDITING_PROPERTY.
Parameters: newValue - true means that stopCellEditing is invoked whenediting is interruped, and data is saved; false means thatcancelCellEditing is invoked, and changes arelost |
setJumpToDefaultPort | public void setJumpToDefaultPort(boolean flag)(Code) | | Sets if getPortViewAt should return the default port if no other port is
found.
|
setLockedHandleColor | public void setLockedHandleColor(Color newColor)(Code) | | Sets the current second handle color.
|
setMarqueeColor | public void setMarqueeColor(Color newColor)(Code) | | Sets the current marquee color.
|
setMarqueeHandler | public void setMarqueeHandler(BasicMarqueeHandler newMarquee)(Code) | | Sets the MarqueeHandler that will handle marquee
selection.
Parameters: newMarquee - the BasicMarqueeHandler that is to providemarquee handling |
setMinimumMove | public void setMinimumMove(int pixels)(Code) | | Sets the miminum amount of pixels for a move operation.
|
setModel | public void setModel(GraphModel newModel)(Code) | | Sets the GraphModel that will provide the data. Note:
Updates the current GraphLayoutCache's model using setModel if the
GraphLayoutCache points to a different model.
Fires a property change for the GRAPH_MODEL_PROPERTY.
Parameters: newModel - the GraphModel that is to provide the data |
setMoveBelowZero | public void setMoveBelowZero(boolean moveBelowZero)(Code) | | Sets if the graph should auto resize when cells are being moved below the
bottom right corner.
|
setMoveBeyondGraphBounds | public void setMoveBeyondGraphBounds(boolean moveBeyondGraphBounds)(Code) | | Parameters: moveBeyondGraphBounds - the moveBeyondGraphBounds to set |
setMoveIntoGroups | public void setMoveIntoGroups(boolean flag)(Code) | | Specifies if cells should be added to groups when moved over the group's
area.
|
setMoveOutOfGroups | public void setMoveOutOfGroups(boolean flag)(Code) | | Specifies if cells should be removed from groups when removed from the
group's area.
|
setMoveable | public void setMoveable(boolean flag)(Code) | | Sets if the graph allows movement of cells.
|
setOffscreenOffset | public void setOffscreenOffset(Point2D offscreenOffset)(Code) | | Parameters: offscreenOffset - the offscreenOffset to set |
setOffscreenValid | public void setOffscreenValid(boolean offscreenValid)(Code) | | Parameters: offscreenValid - the offscreenValid to set |
setPortsScaled | public void setPortsScaled(boolean flag)(Code) | | If set to true, the ports will be scaled.
Fires a property change for the PORTS_SCALED_PROPERTY.
|
setPortsVisible | public void setPortsVisible(boolean flag)(Code) | | If set to true, the ports will be visible.
Fires a property change for the PORTS_VISIBLE_PROPERTY.
|
setPreviewInvalidNullPorts | public void setPreviewInvalidNullPorts(boolean flag)(Code) | | Determines whether the graph allows invalid null ports during previews
Parameters: flag - a boolean value, true if the graph allows invalid null portsduring previews |
setScale | public void setScale(double newValue)(Code) | | Sets the current scale.
Fires a property change for the SCALE_PROPERTY.
Parameters: newValue - the new scale |
setScale | public void setScale(double newValue, Point2D center)(Code) | | Sets the current scale and centers the graph to the specified point
Parameters: newValue - the new scale Parameters: center - the center of the graph |
setSelectionCell | public void setSelectionCell(Object cell)(Code) | | Selects the specified cell.
Parameters: cell - the Object specifying the cell to select |
setSelectionCells | public void setSelectionCells(Object[] cells)(Code) | | Selects the specified cells.
Parameters: cells - an array of objects that specifies the cells to select |
setSelectionEnabled | public void setSelectionEnabled(boolean flag)(Code) | | Determines whether cell selection is enabled. Fires a property change
event if the new setting is different from the existing setting.
Parameters: flag - a boolean value, true if cell selection is enabled |
setSelectionModel | public void setSelectionModel(GraphSelectionModel selectionModel)(Code) | | Sets the graph's selection model. When a null value is
specified an emtpy selectionModel is used, which does not
allow selections.
Parameters: selectionModel - the GraphSelectionModel to use, ornull to disable selections See Also: GraphSelectionModel |
setSizeable | public void setSizeable(boolean flag)(Code) | | Sets if the graph allows cells to be resized.
|
setTolerance | public void setTolerance(int size)(Code) | | Sets the maximum distance between the mousepointer and a cell to be
selected.
|
setVolatileOffscreen | public void setVolatileOffscreen(boolean volatileOffscreen)(Code) | | Parameters: volatileOffscreen - the volatileOffscreen to set |
setXorEnabled | public void setXorEnabled(boolean flag)(Code) | | Sets if the graph accepts drops/pastes from external sources.
|
setupOffScreen | protected void setupOffScreen(int x, int y, int width, int height, Rectangle2D newOffscreenBuffer)(Code) | | Utility method that initialises the offscreen graphics area
Parameters: x - Parameters: y - Parameters: width - Parameters: height - Parameters: newOffscreenBuffer - |
snap | public Point2D snap(Point2D p)(Code) | | Returns the given point applied to the grid.
Parameters: p - a point in screen coordinates. the same point applied to the grid. |
snap | public Rectangle2D snap(Rectangle2D r)(Code) | | Returns the given rectangle applied to the grid.
Parameters: r - a rectangle in screen coordinates. the same rectangle applied to the grid. |
snap | public Dimension2D snap(Dimension2D d)(Code) | | Returns the given dimension applied to the grid.
Parameters: d - a dimension in screen coordinates to snap to. the same dimension applied to the grid. |
startEditingAtCell | public void startEditingAtCell(Object cell)(Code) | | Selects the specified cell and initiates editing. The edit-attempt fails
if the CellEditor does not allow editing for the specified
item.
|
stopEditing | public boolean stopEditing()(Code) | | Ends the current editing session. (The
DefaultGraphCellEditor object saves any edits that are
currently in progress on a cell. Other implementations may operate
differently.) Has no effect if the tree isn't being edited.
Note:
To make edit-saves automatic whenever the user changes their position in
the graph, use
JGraph.setInvokesStopCellEditing .
true if editing was in progress and is now stopped, false ifediting was not in progress |
toScreen | public Point2D toScreen(Point2D p)(Code) | | Upscale the given point in place, using the given instance.
Parameters: p - the point to be upscaled the upscaled point instance |
toScreen | public Rectangle2D toScreen(Rectangle2D rect)(Code) | | Upscale the given rectangle in place, using the given instance.
Parameters: rect - the rectangle to be upscaled the upscaled rectangle instance |
updateAutoSize | public void updateAutoSize(CellView view)(Code) | | Computes and updates the size for view .
|
updateUI | public void updateUI()(Code) | | Notification from the UIManager that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager . Subclassers can override this to support
different GraphUIs.
See Also: JComponent.updateUI |
Methods inherited from javax.swing.JComponent | public void addAncestorListener(AncestorListener listener)(Code)(Java Doc) public void addNotify()(Code)(Java Doc) public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void computeVisibleRect(Rectangle visibleRect)(Code)(Java Doc) public boolean contains(int x, int y)(Code)(Java Doc) public JToolTip createToolTip()(Code)(Java Doc) public void disable()(Code)(Java Doc) public void enable()(Code)(Java Doc) public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc) public void firePropertyChange(String propertyName, char oldValue, char newValue)(Code)(Java Doc) protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException(Code)(Java Doc) public AccessibleContext getAccessibleContext()(Code)(Java Doc) public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) final public ActionMap getActionMap()(Code)(Java Doc) public float getAlignmentX()(Code)(Java Doc) public float getAlignmentY()(Code)(Java Doc) public AncestorListener[] getAncestorListeners()(Code)(Java Doc) public boolean getAutoscrolls()(Code)(Java Doc) public int getBaseline(int width, int height)(Code)(Java Doc) public BaselineResizeBehavior getBaselineResizeBehavior()(Code)(Java Doc) public Border getBorder()(Code)(Java Doc) public Rectangle getBounds(Rectangle rv)(Code)(Java Doc) final public Object getClientProperty(Object key)(Code)(Java Doc) protected Graphics getComponentGraphics(Graphics g)(Code)(Java Doc) public JPopupMenu getComponentPopupMenu()(Code)(Java Doc) public int getConditionForKeyStroke(KeyStroke aKeyStroke)(Code)(Java Doc) public int getDebugGraphicsOptions()(Code)(Java Doc) public static Locale getDefaultLocale()(Code)(Java Doc) public FontMetrics getFontMetrics(Font font)(Code)(Java Doc) public Graphics getGraphics()(Code)(Java Doc) public int getHeight()(Code)(Java Doc) public boolean getInheritsPopupMenu()(Code)(Java Doc) final public InputMap getInputMap(int condition)(Code)(Java Doc) final public InputMap getInputMap()(Code)(Java Doc) public InputVerifier getInputVerifier()(Code)(Java Doc) public Insets getInsets()(Code)(Java Doc) public Insets getInsets(Insets insets)(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) public Point getLocation(Point rv)(Code)(Java Doc) public Dimension getMaximumSize()(Code)(Java Doc) public Dimension getMinimumSize()(Code)(Java Doc) public Component getNextFocusableComponent()(Code)(Java Doc) public Point getPopupLocation(MouseEvent event)(Code)(Java Doc) public Dimension getPreferredSize()(Code)(Java Doc) public KeyStroke[] getRegisteredKeyStrokes()(Code)(Java Doc) public JRootPane getRootPane()(Code)(Java Doc) public Dimension getSize(Dimension rv)(Code)(Java Doc) public Point getToolTipLocation(MouseEvent event)(Code)(Java Doc) public String getToolTipText()(Code)(Java Doc) public String getToolTipText(MouseEvent event)(Code)(Java Doc) public Container getTopLevelAncestor()(Code)(Java Doc) public TransferHandler getTransferHandler()(Code)(Java Doc) public String getUIClassID()(Code)(Java Doc) public boolean getVerifyInputWhenFocusTarget()(Code)(Java Doc) public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc) public Rectangle getVisibleRect()(Code)(Java Doc) public int getWidth()(Code)(Java Doc) public int getX()(Code)(Java Doc) public int getY()(Code)(Java Doc) public void grabFocus()(Code)(Java Doc) public boolean isDoubleBuffered()(Code)(Java Doc) public static boolean isLightweightComponent(Component c)(Code)(Java Doc) public boolean isManagingFocus()(Code)(Java Doc) public boolean isOpaque()(Code)(Java Doc) public boolean isOptimizedDrawingEnabled()(Code)(Java Doc) final public boolean isPaintingForPrint()(Code)(Java Doc) public boolean isPaintingTile()(Code)(Java Doc) public boolean isRequestFocusEnabled()(Code)(Java Doc) public boolean isValidateRoot()(Code)(Java Doc) public void paint(Graphics g)(Code)(Java Doc) protected void paintBorder(Graphics g)(Code)(Java Doc) protected void paintChildren(Graphics g)(Code)(Java Doc) protected void paintComponent(Graphics g)(Code)(Java Doc) public void paintImmediately(int x, int y, int w, int h)(Code)(Java Doc) public void paintImmediately(Rectangle r)(Code)(Java Doc) protected String paramString()(Code)(Java Doc) public void print(Graphics g)(Code)(Java Doc) public void printAll(Graphics g)(Code)(Java Doc) protected void printBorder(Graphics g)(Code)(Java Doc) protected void printChildren(Graphics g)(Code)(Java Doc) protected void printComponent(Graphics g)(Code)(Java Doc) protected void processComponentKeyEvent(KeyEvent e)(Code)(Java Doc) protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)(Code)(Java Doc) protected void processKeyEvent(KeyEvent e)(Code)(Java Doc) protected void processMouseEvent(MouseEvent e)(Code)(Java Doc) protected void processMouseMotionEvent(MouseEvent e)(Code)(Java Doc) final public void putClientProperty(Object key, Object value)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void registerKeyboardAction(ActionListener anAction, KeyStroke aKeyStroke, int aCondition)(Code)(Java Doc) public void removeAncestorListener(AncestorListener listener)(Code)(Java Doc) public void removeNotify()(Code)(Java Doc) public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc) public void repaint(long tm, int x, int y, int width, int height)(Code)(Java Doc) public void repaint(Rectangle r)(Code)(Java Doc) public boolean requestDefaultFocus()(Code)(Java Doc) public void requestFocus()(Code)(Java Doc) public boolean requestFocus(boolean temporary)(Code)(Java Doc) public boolean requestFocusInWindow()(Code)(Java Doc) protected boolean requestFocusInWindow(boolean temporary)(Code)(Java Doc) public void resetKeyboardActions()(Code)(Java Doc) public void reshape(int x, int y, int w, int h)(Code)(Java Doc) public void revalidate()(Code)(Java Doc) public void scrollRectToVisible(Rectangle aRect)(Code)(Java Doc) final public void setActionMap(ActionMap am)(Code)(Java Doc) public void setAlignmentX(float alignmentX)(Code)(Java Doc) public void setAlignmentY(float alignmentY)(Code)(Java Doc) public void setAutoscrolls(boolean autoscrolls)(Code)(Java Doc) public void setBackground(Color bg)(Code)(Java Doc) public void setBorder(Border border)(Code)(Java Doc) public void setComponentPopupMenu(JPopupMenu popup)(Code)(Java Doc) public void setDebugGraphicsOptions(int debugOptions)(Code)(Java Doc) public static void setDefaultLocale(Locale l)(Code)(Java Doc) public void setDoubleBuffered(boolean aFlag)(Code)(Java Doc) public void setEnabled(boolean enabled)(Code)(Java Doc) public void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)(Code)(Java Doc) public void setFont(Font font)(Code)(Java Doc) public void setForeground(Color fg)(Code)(Java Doc) public void setInheritsPopupMenu(boolean value)(Code)(Java Doc) final public void setInputMap(int condition, InputMap map)(Code)(Java Doc) public void setInputVerifier(InputVerifier inputVerifier)(Code)(Java Doc) public void setMaximumSize(Dimension maximumSize)(Code)(Java Doc) public void setMinimumSize(Dimension minimumSize)(Code)(Java Doc) public void setNextFocusableComponent(Component aComponent)(Code)(Java Doc) public void setOpaque(boolean isOpaque)(Code)(Java Doc) public void setPreferredSize(Dimension preferredSize)(Code)(Java Doc) public void setRequestFocusEnabled(boolean requestFocusEnabled)(Code)(Java Doc) public void setToolTipText(String text)(Code)(Java Doc) public void setTransferHandler(TransferHandler newHandler)(Code)(Java Doc) protected void setUI(ComponentUI newUI)(Code)(Java Doc) public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)(Code)(Java Doc) public void setVisible(boolean aFlag)(Code)(Java Doc) public void unregisterKeyboardAction(KeyStroke aKeyStroke)(Code)(Java Doc) public void update(Graphics g)(Code)(Java Doc) public void updateUI()(Code)(Java Doc)
|
|
|