|
|||||||||
| 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
javax.swing.JPanel
org.ceryle.graph.GraphLayoutPanel
public class GraphLayoutPanel
GraphLayoutPanel extends JPanel in providing support for a TouchGraph
implementation, an analogue to TG's GLPanel
(i.e., its demo panel). It also provides methods for navigating and manipulating
nodes and edges and an improved tool bar over GLPanel.
NOTE: after calling its constructor, initialize() must be called to establish the graph engine and its GUI support.
| Nested Class Summary | |
|---|---|
class |
GraphLayoutPanel.ButtonListener
The listener class to handle button events. |
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| 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 | |
|---|---|
protected JRadioButton |
btn_hyper
|
protected JButton |
btn_infinity
|
protected JRadioButton |
btn_locality
|
protected JRadioButton |
btn_rotate
|
protected JRadioButton |
btn_sequence
|
protected JRadioButton |
btn_zoom
|
static int |
DEFAULT_HYPERBOLIC
An int value indicating the default setting (default=0) of the Hyperbolic distortion scroll bar. |
static int |
DEFAULT_LOCALITY
An int value indicating the default setting (default=4) of the Locality scroll bar. |
static int |
DEFAULT_SEQUENCE
An int value indicating the default setting (default=0) of the Sequence scroll bar. |
protected static Color |
defaultColor
|
protected GLEditUI |
editUI
|
protected GraphPanel |
gp
|
protected GraphPopupMenu |
gPopupMenu
|
protected HVScroll |
hvScroll
|
static int |
HYPER_SCROLL
An enumerated int value indicating the Hyperbolic scroll bar. |
protected JScrollBar |
hyperSB
|
protected HyperScroll |
hyperScroll
|
static boolean |
includeEdit
If true, include the "Edit" checkbox. |
static int |
INFINITE_LOCALITY
An int constant indicating infinite locality, derived from LocalityUtils. |
protected Point2D.Double |
lastClick
|
static int |
LOCALITY_SCROLL
An enumerated int value indicating the Locality scroll bar. |
protected JScrollBar |
localitySB
|
protected GraphLocalityScroll |
localityScroll
|
protected Desktop |
m_desktop
|
protected JComponent |
m_graphContainer
|
protected JPanel |
m_legendPanel
|
protected boolean |
m_localityEnabled
Allows the locality scroll bar to be disabled. |
protected MouseWheelListener |
m_mouseWheelListener
|
protected JScrollBar |
m_selectedSB
|
protected boolean |
m_verbose
|
protected View |
m_view
|
static int |
MAXIMUM_LOCALITY
An int value indicating the maximum setting (default=20) of the Locality scroll bar. |
protected MessageHandler |
mh
|
protected JCheckBox |
modeSelect
|
protected GraphNavigateUI |
navigateUI
|
protected PropertyManager |
pm
|
protected JPanel |
popPanel
|
static int |
ROTATE_SCROLL
An enumerated int value indicating the Rotate scroll bar. |
protected JScrollBar |
rotateSB
|
protected RotateScroll |
rotateScroll
|
protected JPanel |
scrollPanel
|
static int |
SEQUENCE_SCROLL
An enumerated int value indicating the Sequence scroll bar. |
protected JScrollBar |
sequenceSB
|
protected SequenceScroll |
sequenceScroll
|
protected Services |
srvs
|
protected TGLensSet |
tgLensSet
|
protected TGUIManager |
tgUIManager
|
static int |
UI_EDIT
An enumerated int value indicating the Edit UI manager. |
static int |
UI_NAVIGATE
An enumerated int value indicating the Navigate UI manager. |
static int |
UI_ROTATEDRAG
An enumerated int value indicating the RotateDrag UI manager. |
static Point2D.Double |
zero
|
static int |
ZOOM_SCROLL
An enumerated int value indicating the Zoom scroll bar. |
protected JScrollBar |
zoomSB
|
protected ZoomScroll |
zoomScroll
|
| 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
GraphLayoutPanel(View view)
Constructor provided a reference to the parent view. |
|
| Method Summary | |
|---|---|
void |
activateUI(int ui)
Activates the indicated UI manager. |
protected GraphEdge |
addEdge(GraphNode node1,
GraphNode node2,
int length,
int directed)
Creates an edge between GraphNode node and node2 with a length of length, and edge direction of int directed (whose values may be GraphEdge.UNDIRECTED, GraphEdge.DIRECTED_TO, or GraphEdge.DIRECTED_FROM). |
protected void |
addGraphPanel(GraphPanel graphpanel)
Adds the provided GraphPanel to this GraphLayoutPanel. |
protected void |
addUIs()
|
protected void |
buildLens()
Builds the set of lenses. |
protected void |
buildScrollBars()
Builds the set of lenses. |
protected void |
buildScrollPanel()
Adds the Zoom, Rotate and Locality scroll bars to the graph tool bar and creates the TouchGraph panel. |
void |
centerNode(GraphNode node)
Quickly centers GraphNode node. |
void |
centerSelectedNode()
Quickly centers the selected node. |
void |
centerSelectedNode(boolean fast)
Centers the selected node, faster if the boolean is true. |
void |
clearGraph()
Clears the graph area. |
void |
defloat(boolean shifted)
Clusters all floating (unfixed), unattached GraphNodes around the selected node. |
boolean |
deleteNode(GraphNode node,
boolean confirm)
Deletes the GraphNode node, what happens depends on its type. |
boolean |
deleteSelected(boolean confirm)
Deletes the selected nodes, depending on the number of type. |
Node |
findNode(String id)
A convenience method that calls findNode(id,true) (searching the entire graph). |
Node |
findNode(String id,
boolean searchAll)
Returns the Node whose ID is the String id. |
Iterator |
getAllEdges()
Returns all Edges in the graph as an Iterator, null if it is empty. |
GraphPanel |
getGraphPanel()
Return a lazily-created GraphPanel used with this GraphLayoutPanel. |
GraphView |
getGraphView()
Returns the parent GraphView of this GraphLayoutPanel. |
HVScroll |
getHVScroll()
Return the HVScroll used with this GraphLayoutPanel. |
int |
getHyperbolicDistortion()
Return the hyperbolic distortion of this GraphLayoutPanel. |
int |
getHyperRadius()
Returns the radius of the circle at which points stay a constant distance away from the center despite the hyperbolic (fisheye) effect. |
HyperScroll |
getHyperScroll()
Return the HyperScroll used with this GraphLayoutPanel. |
Point2D.Double |
getLastClickPoint()
Returns the stored last-clicked point. |
double |
getLeftOf(GraphNode node)
Returns a value corresponding to the X value of the left edge of GraphNode node. |
JPanel |
getLegend()
Lazily-created east panel (uses a Y Box layout), used for legends. |
int |
getLocalityRadius()
Return the locality radius of this GraphLayoutPanel. |
LocalityScroll |
getLocalityScroll()
Return the LocalityScroll used with this GraphLayoutPanel. |
int |
getNodeCount()
A convenience method; returns the number of nodes in the current graph. |
Font |
getNodeFont()
Returns the font of the node text. |
Point |
getOffset()
Return the viewport's horizontal and vertical offset position as a Point. |
JPanel |
getPopPanel()
Returns the unused panel located to the left of the radio buttons. |
JPopupMenu |
getPopupMenu()
Return the JPopupMenu used (actually, a GraphPopupMenu). |
protected Integer |
getPosition(boolean horiz,
GraphNode node)
Returns an Integer corresponding to the X (horiz==true) or Y position of GraphNode node. |
Point |
getPosition(GraphNode node)
Return the GraphNode position as a Point, adjusted to take into account all active lenses. |
RotateScroll |
getRotateScroll()
Return the RotateScroll used with this GraphLayoutPanel. |
int |
getRotationAngle()
Return the rotation angle of this GraphLayoutPanel. |
JPanel |
getScrollPanel()
Returns the graph's scroll panel. |
int |
getSelectedCount()
Returns the number of selected GraphNodes. |
Point |
getSelectedLocation()
Returns a Point containing the location of the selected Node, null if unavailable. |
GraphNode |
getSelectedNode()
Returns the selected GraphNode, null if unavailable. |
int |
getSequenceDistortion()
Return the sequence distortion of this GraphLayoutPanel. |
SequenceScroll |
getSequenceScroll()
Return the SequenceScroll used with this GraphLayoutPanel. |
TGPanel |
getTGPanel()
Return the TGPanel used with this GraphLayoutPanel. |
double |
getTopOf(GraphNode node)
Returns a value corresponding to the Y value of the top edge of GraphNode node. |
View |
getView()
Returns the parent View of this GraphLayoutPanel. |
ZoomScroll |
getZoomScroll()
Return the ZoomScroll used with this GraphLayoutPanel. |
int |
getZoomValue()
Return the zoom value of this GraphLayoutPanel. |
int[] |
graphStatus()
Returns some status info as an int array. |
void |
hideNode(Node node)
Hides the Node node, unless it is the first node. |
void |
initialize()
Initializes the panel, tool bar and lens. |
void |
initialize(GraphPanel graphpanel)
Initializes the panel, tool bar and lens, using the supplied GraphPanel. |
boolean |
isEditActive()
Return true if the GLEditUI considers the graph active. |
boolean |
isEmpty()
A convenience method that returns true if the graph is empty (i.e., it contains no nodes). |
boolean |
isLocalityEnabled()
Returns true if the locality scrollbar is enabled. |
void |
keyPressed(KeyEvent ke)
Responds to KeyEvents sent to the GraphPanel's GraphKeyListener. |
void |
nodeClicked(Node node,
MouseEvent e)
An action method that indicates that the Node node has been clicked. |
void |
nodeDoubleClicked(Node node,
MouseEvent e)
An action method that indicates that the Node node has been double-clicked. |
GraphPanel |
releaseGraphPanel()
Releases use of the current GraphPanel, effectively disabling this GraphLayoutPanel. |
void |
repaintNode(GraphNode node)
Repaints the GraphNode node by jubbling it. |
void |
reset()
Resets the display damper, making the graph slowly move again. |
void |
selectAll(boolean unfiltered)
Selects all of the graph nodes. |
void |
selectFirstNode()
Selects the first node, triggering locality. |
void |
selectFirstNode(int r)
Selects the first node, triggering locality at a radius of r. |
boolean |
selectNode(Node node)
Selects the Node node. |
boolean |
selectNode(String id)
Selects the Node whose ID is the String id. |
void |
selectSB(int scroll)
Shows the indicated scroll bar. |
protected void |
setDefaultStylesheet()
Sets the default colors for this GraphLayoutPanel. |
void |
setFixedSelectedNode(boolean fixed)
Sets the fixed state of the selected Node or Nodes. |
void |
setGraphPriority(boolean hasPriority)
Checks the priority of current Threads in this ThreadGroup. |
void |
setGraphPriority(int priority)
Sets the priority of current Threads in this ThreadGroup to priority. |
void |
setHyperbolicDistortion(int value)
Set the hyperbolic distortion of this TGScrollPane (allowable values between 0 to 108). |
protected void |
setHyperRadius(int radius)
Sets the radius of the circle at which points stay a constant distance away from the center despite the hyperbolic (fisheye) effect. |
void |
setLastClickPoint(Point2D.Double p)
Sets the stored last-clicked point to p. |
void |
setLocalityEnabled(boolean enabled)
Sets the enabled status of the locality scrollbar. |
void |
setLocalityRadius(int radius)
Set the locality radius of this TGScrollPane. |
void |
setNavigateVerbosity(boolean verbose)
Set the verbosity of the GraphNavigateUI, which displays clicked locations when verbose. |
void |
setNodeFont(Font font)
Sets the font of the node text to the Font font. |
void |
setOffset(Point p)
Sets the horizontal offset of the viewport to p.x, the vertical offset to p.y, given Point p. |
void |
setPosition(int x,
int y)
Relocation the graph to the position x,y. |
void |
setRotationAngle(int angle)
Set the rotation angle of this GraphLayoutPanel (allowable values between 0 to 359). |
void |
setScrollBarsEnabled(boolean enabled)
Enables or disables the selector buttons for the scroll bars. |
void |
setScrollPanelVisibility(boolean visible)
Sets the visibility of the graph's scroll panel to the boolean visible. |
void |
setSequenceDistortion(int value)
Set the sequence distortion of this TGScrollPane (allowable values between 0 to 100). |
void |
setStylesheet(String filename)
Sets the graph color "stylesheet" according to the properties found in file filename, which is an XML properties file in the same notation as the Ceryle property file (".ceryle.prop"). |
void |
setToolVisibility(boolean visible)
Sets the visibility of the graph tools according to the value of the boolean visible. |
void |
setZoomValue(int zoomValue)
Set the zoom value of this GraphLayoutPanel (allowable values between -100 to 100). |
void |
update()
Updates the display. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int INFINITE_LOCALITY
public static final int ZOOM_SCROLL
public static final int ROTATE_SCROLL
public static final int LOCALITY_SCROLL
public static final int HYPER_SCROLL
public static final int SEQUENCE_SCROLL
public static final int UI_EDIT
public static final int UI_NAVIGATE
public static final int UI_ROTATEDRAG
public static int DEFAULT_LOCALITY
public static int MAXIMUM_LOCALITY
public static int DEFAULT_HYPERBOLIC
public static int DEFAULT_SEQUENCE
public static boolean includeEdit
protected boolean m_localityEnabled
protected GraphPanel gp
protected View m_view
protected JPanel popPanel
protected TGUIManager tgUIManager
protected GraphNavigateUI navigateUI
protected GraphPopupMenu gPopupMenu
protected JScrollBar m_selectedSB
protected JScrollBar zoomSB
protected JScrollBar rotateSB
protected JScrollBar localitySB
protected JScrollBar hyperSB
protected JScrollBar sequenceSB
protected JButton btn_infinity
protected MouseWheelListener m_mouseWheelListener
protected static Color defaultColor
protected Desktop m_desktop
protected Services srvs
protected MessageHandler mh
protected PropertyManager pm
protected boolean m_verbose
protected JPanel m_legendPanel
protected Point2D.Double lastClick
protected TGLensSet tgLensSet
protected JCheckBox modeSelect
protected JPanel scrollPanel
protected JComponent m_graphContainer
protected ZoomScroll zoomScroll
protected RotateScroll rotateScroll
protected GraphLocalityScroll localityScroll
protected HyperScroll hyperScroll
protected SequenceScroll sequenceScroll
protected HVScroll hvScroll
protected GLEditUI editUI
protected JRadioButton btn_zoom
protected JRadioButton btn_rotate
protected JRadioButton btn_locality
protected JRadioButton btn_hyper
protected JRadioButton btn_sequence
public static final Point2D.Double zero
| Constructor Detail |
|---|
public GraphLayoutPanel(View view)
| Method Detail |
|---|
public void initialize()
public void initialize(GraphPanel graphpanel)
public void setGraphPriority(boolean hasPriority)
public void setGraphPriority(int priority)
protected void setDefaultStylesheet()
public void setStylesheet(String filename)
public GraphPanel releaseGraphPanel()
public View getView()
public GraphView getGraphView()
public int getNodeCount()
public void centerSelectedNode()
public void centerSelectedNode(boolean fast)
public void centerNode(GraphNode node)
public void setLastClickPoint(Point2D.Double p)
public Point2D.Double getLastClickPoint()
protected void buildScrollBars()
public JPanel getPopPanel()
public JPopupMenu getPopupMenu()
getPopupMenu in interface TGScrollPaneprotected void setHyperRadius(int radius)
public int getHyperRadius()
protected void buildScrollPanel()
protected void addGraphPanel(GraphPanel graphpanel)
public JPanel getLegend()
public void setToolVisibility(boolean visible)
protected void buildLens()
protected GraphEdge addEdge(GraphNode node1,
GraphNode node2,
int length,
int directed)
Edge length is usually some fraction or multiple of Edge.DEFAULT_LENGTH.
public void keyPressed(KeyEvent ke)
keyPressed in interface TGScrollPane
public void nodeClicked(Node node,
MouseEvent e)
nodeClicked in interface TGScrollPane
public void nodeDoubleClicked(Node node,
MouseEvent e)
nodeDoubleClicked in interface TGScrollPanepublic boolean deleteSelected(boolean confirm)
Currently unsupported in this class.
public boolean deleteNode(GraphNode node,
boolean confirm)
Currently unsupported in this class.
public Font getNodeFont()
public void setNodeFont(Font font)
public void setScrollPanelVisibility(boolean visible)
public JPanel getScrollPanel()
public void update()
public boolean isEmpty()
public void reset()
public void setScrollBarsEnabled(boolean enabled)
public void activateUI(int ui)
UI_EDIT,
UI_NAVIGATE,
UI_ROTATEDRAGpublic void selectSB(int scroll)
ZOOM_SCROLL,
ROTATE_SCROLL,
LOCALITY_SCROLL,
HYPER_SCROLL,
SEQUENCE_SCROLLprotected void addUIs()
public void setNavigateVerbosity(boolean verbose)
public boolean isEditActive()
public GraphPanel getGraphPanel()
getTGPanel().
public TGPanel getTGPanel()
GraphPanel.
getTGPanel in interface TGScrollPanepublic void setOffset(Point p)
setOffset in interface TGScrollPanepublic Point getOffset()
getOffset in interface TGScrollPanepublic HVScroll getHVScroll()
getHVScroll in interface TGScrollPane
public void setPosition(int x,
int y)
public Point getPosition(GraphNode node)
protected Integer getPosition(boolean horiz,
GraphNode node)
public double getLeftOf(GraphNode node)
public double getTopOf(GraphNode node)
public ZoomScroll getZoomScroll()
getZoomScroll in interface TGScrollPanepublic void setZoomValue(int zoomValue)
setZoomValue in interface TGScrollPanepublic int getZoomValue()
getZoomValue in interface TGScrollPanepublic void setRotationAngle(int angle)
setRotationAngle in interface TGScrollPanepublic int getRotationAngle()
getRotationAngle in interface TGScrollPanepublic RotateScroll getRotateScroll()
getRotateScroll in interface TGScrollPanepublic void setLocalityEnabled(boolean enabled)
public boolean isLocalityEnabled()
public LocalityScroll getLocalityScroll()
getLocalityScroll in interface TGScrollPanepublic void setLocalityRadius(int radius)
INFINITE_LOCALITY.
setLocalityRadius in interface TGScrollPanepublic int getLocalityRadius()
getLocalityRadius in interface TGScrollPanepublic HyperScroll getHyperScroll()
getHyperScroll in interface TGScrollPanepublic void setHyperbolicDistortion(int value)
setHyperbolicDistortion in interface TGScrollPanepublic int getHyperbolicDistortion()
getHyperbolicDistortion in interface TGScrollPanepublic SequenceScroll getSequenceScroll()
public void setSequenceDistortion(int value)
public int getSequenceDistortion()
public void clearGraph()
public int getSelectedCount()
SelectionManagerpublic void selectFirstNode()
public void selectFirstNode(int r)
public void setFixedSelectedNode(boolean fixed)
public void selectAll(boolean unfiltered)
public void defloat(boolean shifted)
If there is no selected node or the selected node is offscreen, the center of the screen is used. This also sets the locality radius to infinity, as unattached nodes are only all displayed in that locality. The boolean shifted does not affect anything in this method's implementation, and is provided to optionally alter the behaviour in any subclasses.
public Point getSelectedLocation()
public GraphNode getSelectedNode()
throws GraphException
NOTE:
Various incarnations of this method have either returned null or thrown a
GraphException if there is no selected node, there is more than one selected
node, or if the selected node is not an instance of a GraphNode (or one of
its subclasses). The current incarnation only throws an exception when the
selected node is not a GraphNode (or one of its subclasses), as there ended
being too much exception handling for this common situation.
org.ceryle.util.GraphException
GraphExceptionpublic void repaintNode(GraphNode node)
public int[] graphStatus()
public boolean selectNode(String id)
public boolean selectNode(Node node)
public Node findNode(String id)
public Node findNode(String id,
boolean searchAll)
public void hideNode(Node node)
public Iterator getAllEdges()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||