org.ceryle.graph.tm
Class TMLayoutPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.ceryle.graph.GraphLayoutPanel
                      extended by org.ceryle.graph.tm.TMLayoutPanel
All Implemented Interfaces:
TGScrollPane, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
EditorLayoutPanel

public class TMLayoutPanel
extends GraphLayoutPanel

TMLayoutPanel extends GraphLayoutPanel in providing methods for visualizing Topic Map-based graphs, as well as display of time lines, subgraphs, and other visualization features. This class is focused on display, whereas a number of associated classes take up other roles, such as TMPanelEditor does most of the grunt work in handling editing actions, coordinating between the underlying Topic Map(s) and the graph visualization.

As with its superclass, once constructed initialize(TMPanel) must be called to establish the graph engine and its GUI support. The IDs used by this panel's objects match the IDs used in the source TopicMap object, hence a query on ID will produce the object desired, e.g., findNode("id34") will return the TNode whose ID is "id34", which contains a Topic whose ID is "id34".

A TMLayoutPanel can display more than one TopicMap object. Because any TopicMap may cause others to be loaded automatically (via its own mergeMap directives), or due to pre-loading (caused by this application's settings), the number of TopicMaps "stored within" the TMLayoutPanel may not match the number of explicit requests.

Since:
JDK1.4
Version:
$Id: TMLayoutPanel.java,v 3.3 2007-06-20 01:28:11 altheim Exp $
Author:
Murray Altheim
See Also:
GraphLayoutPanel, Serialized Form

Nested Class Summary
protected  class TMLayoutPanel.LocalityAdjustmentListener
          A listener for changes to the locality scroll bar.
protected  class TMLayoutPanel.TopicViewer
          Internal class extends Thread to display a dialog box containing information about the selected Topic.
 
Nested classes/interfaces inherited from class org.ceryle.graph.GraphLayoutPanel
GraphLayoutPanel.ButtonListener
 
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
 int anodes
           
protected  JButton btn_closeLeg
           
protected  boolean colorizeByDistance
          When true, sets a mode causing changes of locality to be color highlighted by a range of colors expressing distance from the selected node.
static int defaultOntology
          The default ontology for the open graph dialog.
protected  DirtyEvent dirtyEvent
          Lazily-created dirty event.
 boolean enableMakeConsistent
          Variable controlling if the Topic Map should be made consistent prior to visualizing.
protected  boolean favInTransition
          A boolean indicating that the favorites list is in transition.
protected  FindTopicDialog findTopicDlog
          The dialog box used for find and replace operations.
protected  EventListenerList listenerList
          List of dirty event listeners.
protected  AssociationEditorDialog m_aedlog
          The dialog box used for association editing operations.
protected static boolean m_canEdit
          A boolean indicating that the graph can be edited.
protected  ColorLookupTable m_clut
          The current color lookup table (CLUT).
protected  boolean m_dirty
          Indicates if the document text has been changed.
protected  FrequencyModel m_favorites
           
protected  JComboBox m_favoritesBox
           
protected  Vector m_legend
          Container for legendary color squares.
protected  int m_maxListSize
           
protected  HashSet m_tmSysIDs
          The HashSet containing the explicitly-requested TopicMap system IDs within this TMLayoutPanel.
protected  HashSet m_topicmaps
          The HashSet containing all TopicMap objects displayed in this TMLayoutPanel.
protected  XidTransferHandler m_xidTxferHandler
          The TransferHandler supporting Drag and Drop operations.
 int maps
           
static int MIDDLE_ONTOLOGY
          Static constant indicating a middle base ontology.
static int MINIMAL_ONTOLOGY
          Static constant indicating a minimal base ontology.
static int NO_BASE_ONTOLOGY
          Static constant indicating a (visually) empty base ontology.
 int onodes
           
protected  int ovViewMode
           
 int rnodes
           
 boolean showAssociations
          Variable controlling if associations should be displayed.
 boolean showEdges
          Variable controlling if edges should be displayed.
 boolean showOccurrences
          Variable controlling if topic occurrences should be displayed.
 int snodes
           
protected  TopicEditorDialog tedlog
          The dialog box used for topic editing operations.
protected  TMLayoutPanel tmlp
           
protected  TMPanelEditor tmpedit
          The editor used for topic editing operations.
protected  TopicMapProcessor tmproc
          The TopicMapProcessor used by this TMLayoutPanel.
protected  TopicMapVisualizer tmviz
          The TopicMapVisualizer used to display TopicMaps.
 int tnodes
           
static int UPPER_ONTOLOGY
          Static constant indicating an upper base ontology.
static boolean useDragAndDrop
          Variable controlling whether drag and drop is supported.
 
Fields inherited from class org.ceryle.graph.GraphLayoutPanel
btn_hyper, btn_infinity, btn_locality, btn_rotate, btn_sequence, btn_zoom, DEFAULT_HYPERBOLIC, DEFAULT_LOCALITY, DEFAULT_SEQUENCE, defaultColor, editUI, gp, gPopupMenu, hvScroll, HYPER_SCROLL, hyperSB, hyperScroll, includeEdit, INFINITE_LOCALITY, lastClick, LOCALITY_SCROLL, localitySB, localityScroll, m_desktop, m_graphContainer, m_legendPanel, m_localityEnabled, m_mouseWheelListener, m_selectedSB, m_verbose, m_view, MAXIMUM_LOCALITY, mh, modeSelect, navigateUI, pm, popPanel, ROTATE_SCROLL, rotateSB, rotateScroll, scrollPanel, SEQUENCE_SCROLL, sequenceSB, sequenceScroll, srvs, tgLensSet, tgUIManager, UI_EDIT, UI_NAVIGATE, UI_ROTATEDRAG, zero, ZOOM_SCROLL, zoomSB, zoomScroll
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
TMLayoutPanel(View view)
          Constructor provided a reference to the parent View.
TMLayoutPanel(View view, TMPanel tmpanel)
          Constructor provided a reference to the parent View.
TMLayoutPanel(View view, TMPanel tmpanel, FrequencyModel favList)
          Constructor provided a reference to the parent View.
 
Method Summary
 ANode addANode(ANode anode, Point2D.Double p)
          Adds an Association Node (ANode) to the graph.
 ANode addANode(Association assoc, String id, String name)
          Adds an Association Node (ANode) with the ID id and an optional Association assoc and String name.
 ANode addANode(Association assoc, String id, String name, Point2D.Double p)
          Adds an Association Node (ANode) with the ID id and an optional Association assoc and String name.
 void addDirtyListener(DirtyListener listener)
          Add a listener for changes to the dirty state.
 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, GraphEdge.DIRECTED_FROM, or GraphEdge.ARROW_FORWARD).
 void addFavoritesList(FrequencyModel list)
          Called once, adds the favorites list to the left side of the graph radio button bar.
 void addOccurrence(TNode tnode, ONode onode)
          Links a base TNode base to an ONode onode using a directed Edge.
 ONode addONode(ONode onode)
          Adds a Occurrence Node (ONode), provided its ID and (optional) name.
 ONode addONode(String id, String name)
          Adds a Occurrence Node (ONode), provided its ID and (optional) name.
 RNode addRNode(RNode rnode)
          Adds a Role Node (RNode) to the graph.
 void addScope(ANode anode, SNode snode, Collection nodes)
          Links an ANode anode through the SNode snode to a Collection of TNodes nodes using a directed Edge pointing into the association.
 SNode addSNode(SNode snode)
          Adds a Scope Node (SNode), provided its ID and (optional) name.
 SNode addSNode(String id, String name)
          Adds a Scope Node (SNode), provided its ID and (optional) name.
 SubGraph addSubGraph(int style, String id, String label, Set set)
          Links the provided Node node to a new subgraph having an ID id, String label, and optionally containing the Set of GraphNodes set.
 TNode addTNode(TNode tnode, Point2D.Double p)
          Adds a Topic Node (TNode) to the graph.
 TNode addTNode(Topic topic, String name)
          Adds a Topic Node (TNode) with the ID id and an optional name.
 TNode addTNode(Topic topic, String name, Point2D.Double p, boolean fixed)
          Adds a Topic Node (TNode) with the ID id and an optional name.
 void addToFavorites(GraphNode node)
          Adds TMNode node to the favorites list, if it has been initialized.
 boolean addTopicMap(TopicMap topicmap, boolean merge)
          Adds the TopicMap topicmap to this TMLayoutPanel, displaying it via its TopicMapVisualizer, and adding it to the registry of displayed TopicMaps.
protected  void addUIs()
          Extends org.ceryle.graph.GraphNavigateUI to use a TMNavigateUI.
 boolean changeNodeID(String oldId, String newId)
          Changes the ID of a topic having ID oldId to newId, returning true if successful.
 void clear()
          Clears the TMLayoutPanel of any content.
protected  void clearLegend()
          Clears the color legend.
 boolean contains(TypedInputSource source)
          A convenience method that returns true if the graph currently contains a graph whose system identifier (either the base or resource locator) matches the provided parameter.
 void defloat(boolean shifted)
          This extends GraphLayoutPanel's method by first processing all Topics, then passing the method for anything remaining to the superclass.
 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.
protected  void droppedOnBackground(Point p, String uriref)
          Called as a result of a drag 'n drop process, adds the URI reference as an Occurrence of a new Topic, whose display name will be taken from the Occurrence (if available).
protected  void droppedOnNode(TMNode node, String uriref)
          Called as a result of a drag 'n drop process, adds the URI reference as an Occurrence on the underlying Topic of TNode tnode.
 void editAssociation(ANode anode)
          Displays information about the provided ANode (association node) anode.
 void editTopic(TNode tnode)
          Displays information about the provided TNode (topic node) tnode.
 void editTopicMap()
          Displays information about the selected TNode (topic node) or ANode (association node), by opening the respective editor.
 Set find(String s)
          Searches the current graph's node labels for the String s, returning an Iterator over the matching nodes, or null if none are found.
 void findNext()
          Repeats the previous Find operation.
 void findTNodeByLabel(String label)
          Searches the current TMPanel for a TNode having label, selecting it if found.
protected  void fireDirtyStateChanged()
          Notify all listeners that have registered interest for notification on this event type.
 ANode getANodeForAssociation(Association assoc)
          Returns the ANode for the provided Association if it has been visualized, null if not.
 Set getANodes()
          Return the Set of all ANodes in the graph, an empty Set if none are available.
 AssociationEditorDialog getAssociationEditor()
          Returns the AssociationEditorDialog of this GraphView, or null if it has not been created.
 AssociationEditorDialog getAssociationEditor(ANode anode)
          Returns the AssociationEditorDialog associated with this TopicMayLayoutPanel, provided with an optional ANode anode.
 ColorLookupTable getCLUT()
          Returns the current ColorLookupTable (CLUT), null if unavailable.
 boolean getColorizeByDistance()
          Returns the current setting for colorize-by-distance.
 TMPanelEditor getEditor()
          Returns the TMPanelEditor associated with this TMLayoutPanel.
 FrequencyModel getFavoritesList()
          Returns the FrequencyModel backing the 'favorites' list, null if it has not been created.
 FindTopicDialog getFindTopicDialog(boolean simple)
          Returns a lazily-created FindTopicDialog.
 FindTopicPanel getFindTopicPanel()
          Returns the internal FindTopicPanel of the FindTopicDialog, which provides search capability on the graph.
 GraphPanel getGraphPanel()
          Overrides the superclass' method to return a lazily-created TMPanel, which extends GraphPanel.
 Set getRequestedBaseLocators()
          Returns an unmodifiable Set of the base Locators of the explicitly-requested TopicMap objects currently available from this TMLayoutPanel.
 TMPanel getTMPanel()
          Returns a lazily-created TMPanel (the GraphPanel extension) used by this TMLayoutPanel.
 TNode getTNodeByLabel(String label)
          Searches the current TMPanel for a TNode having label, returning it if found.
 TNode getTNodeForTopic(Topic topic)
          Returns the TNode for the provided Topic if it has been visualized, null if not.
 Set getTNodes()
          Return the Set of all TNodes in the graph, an empty Set if none are available.
 TopicEditorDialog getTopicEditor(TNode tnode)
          Returns the TopicEditorDialog associated with this TopicMayLayoutPanel, provided with an optional TMNode node.
 TopicMap getTopicMap()
          Returns the TopicMap object of the first Topic node (TNode) within the current graph.
 Set getTopicMapBaseLocators()
          Returns an unmodifiable Set of the base locators of all TopicMap objects currently available from this TMLayoutPanel.
 TopicMapProcessor getTopicMapProcessor()
          Returns the TopicMapProcessor used by this TMLayoutPanel.
 Set getTopicMaps()
          Returns an unmodifiable Set of the TopicMap objects currently available from this TMLayoutPanel.
 String getTopicReference(String title, String message)
          Display a dialog box provided with the dialog box title and message as Strings, requesting selection of a topic, returning a reference to it as a URI (generally, a relative reference).
 Set getTopics()
          Return the Set of all Topics corresponding to visualized TNodes in the graph, an empty Set if none are available.
 TopicMapVisualizer getVisualizer()
          Returns the TopicMapVisualizer associated with this TopicMayLayoutPanel.
 int[] graphStatus()
          Returns status info as an int array.
 void gridNodes(Collection nodes, boolean sort)
          Grids the provided Collection of nodes over the available screen area, alphabetizing them if the boolean sort is true.
 void initiateDrag(MouseEvent e)
          Returns true if a Drag and Drop is supported on this panel and was successfully initiated based on the provided MouseEvent.
 boolean isDirty()
          Returns true if the current document has been edited.
 boolean isEditable()
          Returns true if the TMLayoutPanel is editable.
 boolean isEmpty()
          A convenience method that returns true if the graph is empty (i.e., it contains no TopicMaps).
 void keyPressed(KeyEvent ke)
          Overrides GraphLayoutPanel's method, responding to KeyEvents sent to the GraphPanel's GraphKeyListener.
 void loadTopicMap(Locator loc, boolean confirm)
          Loads the topic map referenced by the provided link node, selecting the topic ID if its URI includes one.
 void makeAllConsistent()
          Makes all TopicMaps consistent.
protected  void makeColorsPermanent()
          Transfers the current hilight colors (as from by Colorize By Distance) to each node's flag color, which are stored permanently with the nodes as facets.
 TNode mergeTopics()
          Merges the selected topic nodes, returning the merged TNode.
 void nodeDoubleClicked(Node node, MouseEvent e)
          An action method that indicates that the Node node has been double-clicked.
 void nodeFixAll()
          A Thread that fixes the location of all TNodes in place.
 void nodeUnfixAll()
          A Thread that unfixes the location of all Nodes, regardless of type.
 boolean openBase()
          Queries the user to open a base TopicMap.
 boolean openBase(int option)
          Opens a default TopicMap.
 void openOccurrence(TNode tnode)
          Open the occurrence indicated by the Occurrence occur.
 void openOccurrence(TNode tnode, boolean inBrowser)
          Open the Occurrences of the TNode tnode.
 void openOccurrence(Topic topic, Occurrence occur)
          Open the occurrence indicated by the Occurrence occur.
 void openOccurrences()
          Open the Occurrences of the selected TNode using an OccurrenceView.
 void randomTMGraph()
          Generate a random TM-style graph.
 void removeDirtyListener(DirtyListener listener)
          Remove a listener for changes to the dirty state.
 boolean replaceBaseLocator(Locator oldloc, Locator newloc)
          Removes the provided Locator from the set of TopicMap objects currently available from this TMLayoutPanel.
 void restoreFavorites(TopicMap topicmap)
          Restores the favorites list from the metadata container Topic in the provided TopicMap topicmap.
 void saveProperties()
          A call to save any user properties to the preferences file.
 Set searchTopics(String searchString, boolean labelsOnly, boolean partial, boolean caseSensitive)
          Searches the current graph's underlying TopicMap for the String s, returning the Set of matching TNodes, an empty Set if none are found.
 void selectAll(boolean unfiltered)
          Selects all of the Topic nodes.
 void selectByLabel(String label)
          Called from favorites list.
 void selectFavorite()
          If the favorites list is populated, selects the favorite (first item) Topic in the graph.
 Topic selectFromTree(Object o, String title, String message, String description)
          Displays the TopicTreeDialog, allowing selection of a Topic from an expandable tree.
 void selectHierarchy(boolean up, boolean unfiltered)
          Selects TNodes up or down the superclass-subclass hierarchy.
 boolean selectNode(Node node)
          Selects the Node node, and if the appropriate editor is visible and node is a TNode or ANode, sets it to display the new Node.
 void setAssociationVisibility(boolean visible)
          Set the visibility of all ANodes to visible.
 void setCLUT(String name)
          Loads the ColorLookupTable used by this panel to one with the provided name.
 void setColorFlags(Set tnodes, Color color)
          Sets the Color of each TNode in the set to Color color.
 void setColorizeByDistance(boolean colorize)
          When set true, sets a mode causing changes of locality to be color highlighted by a range of colors expressing distance from the selected node, using the current CLUT.
 void setDefaultSelection(TopicMap topicmap)
          This selects a Topic node in order to affect the locality.
protected  void setDefaultStylesheet()
          Sets the default colors for this TMLayoutPanel.
 void setDirty(boolean dirty)
          Sets the state indicating that the current document has been edited.
 void setEdgeVisibility(boolean visible)
          Set the visibility of all Edges to visible.
 void setEditable(boolean editable)
          Sets the availability of editing features to editable.
 void setFixed(GraphNode node, boolean fixed)
          Sets the fixed state of GraphNode node to the boolean fixed.
 void setLegend(ColorLookupTable clut, boolean show)
          Populates the legend panel with the provided CLUT's palette.
 void setSizeByDistance(boolean resize)
          When set true, sets a mode causing changes of locality to be highlighted by a range of font sizes expressing distance from the selected node.
 void setStylesheet(String filename)
          Overrides the method in GraphLayoutPanel, setting display properties based on those found in file filename, which is an XML properties file in the same notation as the Ceryle property file (".ceryle.prop").
 void setTopicMapProcessor(TopicMapProcessor tmprocessor)
          Sets the TopicMapProcessor of this TMLayoutPanel to the provided parameter.
 void showFindTopic(boolean simple)
          Displays the FindTopic dialog box.
 void storeFavorites(TopicMap topicmap)
          Stores the current favorites list to the metadata container Topic for the provided TopicMap topicmap.
protected  void tmEngineRecover(String uri)
          Queries the user to reinitialize the Topic Map engine following an error.
 Set topicsToTNodes(Collection topics)
          Provided with a Collection of Topics, returns a Set of corresponding TNodes.
 Set traverseGraph(TNode node, int direction, int depth, boolean asTopics)
          Traverses the graph to depth nodes in direction, returning a Set of connected TNodes or Topics, depending on the boolean asTopics.
 void updateOccurrenceCount(TNode tnode, Topic topic)
          Updates the occurrence count based on the Topic corresponding to the TNode tnode.
 
Methods inherited from class org.ceryle.graph.GraphLayoutPanel
activateUI, addGraphPanel, buildLens, buildScrollBars, buildScrollPanel, centerNode, centerSelectedNode, centerSelectedNode, clearGraph, findNode, findNode, getAllEdges, getGraphView, getHVScroll, getHyperbolicDistortion, getHyperRadius, getHyperScroll, getLastClickPoint, getLeftOf, getLegend, getLocalityRadius, getLocalityScroll, getNodeCount, getNodeFont, getOffset, getPopPanel, getPopupMenu, getPosition, getPosition, getRotateScroll, getRotationAngle, getScrollPanel, getSelectedCount, getSelectedLocation, getSelectedNode, getSequenceDistortion, getSequenceScroll, getTGPanel, getTopOf, getView, getZoomScroll, getZoomValue, hideNode, initialize, initialize, isEditActive, isLocalityEnabled, nodeClicked, releaseGraphPanel, repaintNode, reset, selectFirstNode, selectFirstNode, selectNode, selectSB, setFixedSelectedNode, setGraphPriority, setGraphPriority, setHyperbolicDistortion, setHyperRadius, setLastClickPoint, setLocalityEnabled, setLocalityRadius, setNavigateVerbosity, setNodeFont, setOffset, setPosition, setRotationAngle, setScrollBarsEnabled, setScrollPanelVisibility, setSequenceDistortion, setToolVisibility, setZoomValue, update
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isV