|
|||||||||
| 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
com.touchgraph.graphlayout.TGPanel
org.ceryle.graph.GraphPanel
public class GraphPanel
GraphPanel extends TouchGraph's TGPanel,
providing additional features used in the Ceryle application.
TGPanel,
Serialized Form| Nested Class Summary | |
|---|---|
class |
GraphPanel.ExtendedMouseMotionListener
|
class |
GraphPanel.GraphKeyListener
Internal class implements KeyAdapter to capture key events. |
class |
GraphPanel.SwitchSelectUI
|
| Nested classes/interfaces inherited from class com.touchgraph.graphlayout.TGPanel |
|---|
TGPanel.AdjustOriginLens, TGPanel.BasicMouseListener, TGPanel.BasicMouseMotionListener |
| 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 | |
|---|---|
static boolean |
autoCenter
Flag enabling auto-centering. |
static int |
BIT_hgrid
Bitwise Variable indicating the horizontal grid lines should be drawn. |
static int |
BIT_vgrid
Bitwise Variable indicating the vertical grid lines should be drawn. |
Color |
COLOR_BACKGROUND
The background color of this GraphPanel. |
static Color |
COLOR_EMPTY_GRAPH
The background color of empty GraphPanels. |
static Color |
COLOR_TEXT_FOREGROUND
|
protected StackSet |
connected
|
static boolean |
fasterDraw
A variable that when true indicates that a faster drawing mode is enabled (which likely simplifies the graph correspondingly, such as using non-directed edges rather than calculating small triangles). |
protected GraphNode |
hilighted
|
protected ImageIcon |
m_bgimage
|
protected URL |
m_bgimageURL
|
int |
m_gridMode
|
protected SelectionManager |
m_selmgr
|
static boolean |
magneticMouse
Flag enabling magnetic mouse. |
protected MessageHandler |
mh
|
protected boolean |
mouseIsDragging
|
protected GraphNode |
outlined
|
protected HashSet |
previouslySelectedNodes
|
Node |
provisionalNode
|
protected boolean |
scrolling
|
static int |
skew
The skew angle used for key navigating. |
static BasicStroke |
STROKE_DOTTED
The stroke used to draw the grid axis. |
protected TGScrollPane |
tgsp
|
| Fields inherited from class com.touchgraph.graphlayout.TGPanel |
|---|
BACK_COLOR, basicMML, bottomRightDraw, completeEltSet, dragNode, fixedIsPinned, graphListeners, handCursor, localityUtils, maintainMouseOver, mouseOverE, mouseOverN, mousePos, moveCursor, offgraphics, offscreen, offscreensize, paintListeners, select, TG_THREADGROUP_ID, tgLayout, threadgroup, topLeftDraw, visibleLocality |
| 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 | |
|---|---|
GraphPanel()
Default constructor for a GraphPanel. |
|
GraphPanel(TGScrollPane tgScrollPane)
Constructor for a GraphPanel with a TGScrollPane tgScrollPane. |
|
| Method Summary | |
|---|---|
protected boolean |
acceptDroppedString(String uri,
Point p)
Receive a drag and dropped URI, returning true if accepted at the given Point. |
protected void |
activateMMListener(boolean activate)
Activates or deactivate the ExtendedMouseMotionListener. |
void |
addEnMasse(Set nodes)
Adds the Set of nodes all at once (en masse). |
void |
addSelectionListener(ListDataListener listener)
Adds a ListDataListener to the SelectionManager to monitor the selection. |
boolean |
addToSelection(GraphNode node)
Adds the GraphNode node to the selection, if it is not already part of the Set. |
void |
beginMultiSelect(MouseEvent e)
Receives notification of the beginning of a drag event, used to capture the existing selection prior to modification if the Shift key is down. |
void |
blitText(String[] lines,
Font font,
Color color,
Point p)
Displays the provided foreground text temporarily, fading after a number of seconds to invisible. |
void |
centerNode(Node node,
boolean fast)
Scrolls the panel to center Node node, faster if fast is true. |
void |
clearHilights()
Clears the hilights of Set s set by keyNavigate(), nulling it when done. |
void |
clearOutlined()
Clears the nodes outlined by keyNavigate(). |
void |
clearSelect()
Deprecated. use clearSelection() instead |
void |
clearSelection()
Clears the current selection. |
void |
endMultiSelect(MouseEvent e)
Receives notification of the end of a drag event, used to clear the selection buffer supporting multiple selection. |
void |
fastScrollToCenter(Node n)
Modified from TG's HVScroll version, this is adjustable for speed. |
protected void |
findMouseOver()
Overrides the method in TGPanel to ignore the provisional node created during drag and drop. |
void |
focusGained(FocusEvent fe)
Indicates that the GraphPanel has gained the focus. |
void |
focusLost(FocusEvent fe)
Indicates that the GraphPanel has lost the focus. |
void |
followNode(Node node)
Nudge the Node node nearer to the cursor position. |
int |
getAngleDBetweenNodes(Node n1,
Node n2,
int skew)
Returns the angle (in degrees) formed by the Nodes n1 and n2. |
double |
getAngleRBetweenNodes(Node n1,
Node n2,
boolean noisy)
Returns the angle (in radians) formed by the Nodes n1 and n2. |
static int |
getAutoCenteringFrequency()
Returns the current value of auto-center frequency (in seconds). |
ImageIcon |
getBackgroundImage()
Returns the background image as an ImageIcon, null if not set. |
URL |
getBackgroundImageURL()
Returns the URL reference to the background image source, null if not set. |
GraphNode |
getFirstGraphNode()
Returns the selected node. |
String[] |
getForegroundText()
Return the current foreground text as an array of Strings, or null if not set. |
int |
getGridCellSize()
Returns the size of a horizontal grid cell. |
protected LocalityUtils |
getLocalityUtils()
Returns the LocalityUtils used by this GraphPanel, primarily for use by the SelectionManager. |
static int |
getMessageFadeTime()
Returns the current value of the message fade time (in seconds, not milliseconds); This delay is repeated multiple times. |
Iterator |
getMultiSelected()
Returns a Iterator over the Set containing all selected GraphNodes, null if there is no selection. |
Iterator |
getNodesByClass(Class c,
boolean inverse)
Returns an iterator over a set of the GraphNodes currently available from this GraphPanel having Class c. |
Node |
getSelect()
Deprecated. use getSelected() instead |
GraphNode |
getSelected()
Returns the selected node. |
int |
getSelectedComposition()
Return the composition of selected GraphNodes using an int code. |
int |
getSelectedCount()
Return the number of selected GraphNodes. |
SelectionManager |
getSelectionManager()
Return the SelectionManager handling the selection for this GraphPanel. |
static GraphEdge |
getSharedEdge(GraphNode n1,
GraphNode n2)
Return the first shared edge between the two GraphNodes, null if they do not share an edge. |
TGScrollPane |
getTGScrollPane()
Returns the TGScrollPane parent of this GraphPanel. |
void |
handleMouseEvent(MouseEvent e)
Processes mouse entered or exited events from the ExtendedMouseListener. |
void |
handleMouseMotionEvent(MouseEvent e)
Processes mouse motion dragged or moved events from the ExtendedMouseMotionListener, passing them on to the superclass method unless the current mouse position is within the Vernier. |
boolean |
isAutoCentering()
Returns true when autocentering is enabled. |
boolean |
isMouseDragging()
Returns true if the mouse is currently being dragged. |
boolean |
isSelected(GraphNode node)
Returns true if the GraphNode node is a selected node. |
void |
keyNavigate(int key)
This is unimplemented in the base class, as navigation will depend on specific node semantics (as found in subclasses of this class). |
void |
multiSelect(Point2D.Double from,
Point2D.Double to,
MouseEvent e)
Overrides TouchGraph's method, storing the selected nodes via the SelectionManager. |
int |
nodeCountByClass(Class c,
boolean inverse)
Returns an iterator over a set of the GraphNodes currently available from this GraphLayoutPanel having Class c. |
void |
paintBackground(Graphics g,
Dimension d)
Overrides TGPanel's method to allow the drawing of vertical and horizontal grid lines. |
void |
paintForeground(Graphics g,
Dimension d)
If the foreground text has been set (via setForegroundText(String[],Font,Point)), this method
displays its contents as an overlay on the graph. |
void |
paintGrid(Graphics2D g2,
Dimension d)
Overrides TGPanel's method to allow the drawing of vertical and horizontal grid lines. |
void |
removeEdgesOfType(int type)
Removes all GraphEdges having a type/style of int type. |
void |
removeFromSelection(GraphNode node)
Removes the GraphNode node from the selection. |
void |
selectAll()
Selects all of the graph nodes. |
void |
selectFirstNode()
A convenience method that selects the first node of a graph, so that hiding works. |
void |
setAutoCentering(boolean enabled)
Starts the auto-centering Thread when true, stops it when false. |
static void |
setAutoCenteringFrequency(int value)
Sets the auto-center frequency (in seconds). |
void |
setForegroundText(String[] lines,
Font font,
Point p)
Set the foreground text (displayed at Point p using Font font) to the String array lines. |
void |
setHilighted(GraphNode graphnode)
Hilights GraphNode gnode, also quickly scrolling it to the center of the screen if not within the view rectangle. |
void |
setMagneticMouse(boolean enabled)
Starts the magnetic mouse Thread when true, stops it when false. |
static void |
setMessageFadeTime(int value)
Sets the message fade time (in seconds). |
void |
setMouseIsDragging(boolean isDragging)
Sets the indicator of whether the mouse is currently being dragged. |
void |
setOutlined(GraphNode graphnode)
Outlines GraphNode gnode, also quickly scrolling it to the center of the screen if not within the view rectangle. |
void |
setSelect(Node node)
Deprecated. use setSelected(GraphNode) instead |
void |
setSelected(GraphNode node)
Selects the Node node. |
void |
setTGScrollPane(TGScrollPane tgScrollPane)
Sets the TGScrollPane parent of this GraphPanel to tgScrollPane. |
void |
updateLocality(GraphNode node)
This method should only be called by the SelectionManager as part of updating the graph following a change to the selection. |
| 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 int skew
public static boolean autoCenter
public static boolean magneticMouse
public static final int BIT_vgrid
public static final int BIT_hgrid
public Color COLOR_BACKGROUND
TGPanel.BACK_COLOR,
and overwritten by the stylesheet.
public static boolean fasterDraw
public static Color COLOR_EMPTY_GRAPH
public static Color COLOR_TEXT_FOREGROUND
public static final BasicStroke STROKE_DOTTED
protected TGScrollPane tgsp
protected MessageHandler mh
public Node provisionalNode
protected GraphNode hilighted
protected GraphNode outlined
protected StackSet connected
protected HashSet previouslySelectedNodes
protected ImageIcon m_bgimage
protected URL m_bgimageURL
protected SelectionManager m_selmgr
protected boolean mouseIsDragging
public int m_gridMode
protected boolean scrolling
| Constructor Detail |
|---|
public GraphPanel()
public GraphPanel(TGScrollPane tgScrollPane)
| Method Detail |
|---|
protected boolean acceptDroppedString(String uri,
Point p)
public void setTGScrollPane(TGScrollPane tgScrollPane)
public TGScrollPane getTGScrollPane()
public static void setMessageFadeTime(int value)
public static int getMessageFadeTime()
public static void setAutoCenteringFrequency(int value)
public static int getAutoCenteringFrequency()
public boolean isAutoCentering()
public void setAutoCentering(boolean enabled)
public void setMagneticMouse(boolean enabled)
The trick here will be to continue magnetizing the last node until a new one is mouseover'd, up to a certain distance, then let go.
public void followNode(Node node)
public ImageIcon getBackgroundImage()
public URL getBackgroundImageURL()
public boolean isMouseDragging()
public void setMouseIsDragging(boolean isDragging)
public Iterator getNodesByClass(Class c,
boolean inverse)
public int nodeCountByClass(Class c,
boolean inverse)
public void addEnMasse(Set nodes)
public void centerNode(Node node,
boolean fast)
public void fastScrollToCenter(Node n)
public void removeEdgesOfType(int type)
GraphEdge.UNDIRECTED, GraphEdge.DIRECTED_FROM,
GraphEdge.DIRECTED_TO and GraphEdge.ARROW_FORWARD.
If type is -1, all edges are removed.
public static GraphEdge getSharedEdge(GraphNode n1,
GraphNode n2)
public void selectAll()
public SelectionManager getSelectionManager()
public int getSelectedCount()
public int getSelectedComposition()
SelectionManagerpublic boolean addToSelection(GraphNode node)
public void removeFromSelection(GraphNode node)
public void clearSelection()
public Iterator getMultiSelected()
SelectionManager.getMultiSelected()public void setSelected(GraphNode node)
TGPanel.setSelect(Node),
but returns the Node subclass GraphNode.
public void selectFirstNode()
selectFirstNode in class TGPanelpublic void addSelectionListener(ListDataListener listener)
public GraphNode getFirstGraphNode()
protected LocalityUtils getLocalityUtils()
public GraphNode getSelected()
TGPanel.getSelect(),
but returns the Node subclass GraphNode.
public boolean isSelected(GraphNode node)
getSelected().
public void beginMultiSelect(MouseEvent e)
public void endMultiSelect(MouseEvent e)
public void multiSelect(Point2D.Double from,
Point2D.Double to,
MouseEvent e)
protected void findMouseOver()
findMouseOver in class TGPanelpublic void updateLocality(GraphNode node)
public void setSelect(Node node)
setSelect in class TGPanelpublic Node getSelect()
getSelect in class TGPanelpublic void clearSelect()
clearSelect in class TGPanelprotected void activateMMListener(boolean activate)
activateMMListener in class TGPanelpublic void handleMouseEvent(MouseEvent e)
handleMouseEvent in class TGPanelpublic void handleMouseMotionEvent(MouseEvent e)
handleMouseMotionEvent in class TGPanelpublic void focusGained(FocusEvent fe)
focusGained in interface FocusListenerpublic void focusLost(FocusEvent fe)
focusLost in interface FocusListener
public void paintBackground(Graphics g,
Dimension d)
Also, in TGPanel the background color is static (the same across all instances), whereas here it is set to COLOR_BACKGROUND, whose default value is TGPanel.BACK_COLOR.
paintBackground in class TGPanel
public void paintForeground(Graphics g,
Dimension d)
setForegroundText(String[],Font,Point)), this method
displays its contents as an overlay on the graph.
paintForeground in class TGPanel
public void blitText(String[] lines,
Font font,
Color color,
Point p)
public void setForegroundText(String[] lines,
Font font,
Point p)
public String[] getForegroundText()
public int getGridCellSize()
public void paintGrid(Graphics2D g2,
Dimension d)
public void clearHilights()
public void setHilighted(GraphNode graphnode)
public void clearOutlined()
public void setOutlined(GraphNode graphnode)
public void keyNavigate(int key)
public int getAngleDBetweenNodes(Node n1,
Node n2,
int skew)
public double getAngleRBetweenNodes(Node n1,
Node n2,
boolean noisy)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||