org.ceryle.ui
Class GraphView

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.ui.View
                      extended by org.ceryle.ui.GraphView
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
ProjectView.ProjectGraphView

public class GraphView
extends View

A class that extends View to provide graph visualization features.

This is meant to be embedded in a ViewFrame.

Note

This and the DocumentView class have historically been places where a great deal of experimental coding has happened, so there may be variables and methods here that are not meant to be permanent parts of the application.

Since:
JDK1.4
Version:
$Id: GraphView.java,v 3.49 2007-06-20 01:28:17 altheim Exp $
Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
 
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 String assocTypesHelpID
          The ID in the Help collection for the tutorial on Association types.
static String GraphSearch
          The graph search string.
protected  GraphToolBar m_graphtools
          The toolbar used to manipulate the graph.
protected  boolean m_timelinesViz
          A boolean indicating the mode of display: if 'true', timelines are displayed.
protected  TimeLine timeline
           
protected  TMLayoutPanel tmlp
          The TMLayoutPanel used.
protected  TopicMapProcessor tmproc
          The TopicMapProcessor used by this GraphView.
protected  TopicMapVisualizer tmviz
          The TopicMapVisualizer used to display TopicMaps.
 
Fields inherited from class org.ceryle.ui.View
DOCUMENT, GRAPH, isClosing, m_desktop, m_verbose, mh, NOTE, pm, PROJECT, srvs, vf, vmgr
 
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
GraphView(ViewFrame viewframe)
          Constructor with a reference to its wrapper ViewFrame.
GraphView(ViewFrame viewframe, int type)
          Constructor with a reference to its wrapper ViewFrame and an optional View type.
GraphView(ViewFrame viewframe, String title)
          A "convenience constructor" that allows the View title to be set at construction time.
 
Method Summary
 void addToolExtras(JToolBar tb)
          If in developer mode, add some experimental buttons to the right end of the toolbar.
 void arrangeTopics()
          Arranges the selected TNodes on a grid, sorting them alphabetically.
 void centerTopic()
          Centers the selected topic node.
 File chooseExportFile(File defaultFile)
          Provided with a JComponent parent, displays a FileChooser dialog box and returns the selected File, or null if no file is chosen.
 void closing()
          This method should be called before closing the GraphView to allow safe closing of any dirty content, removing listeners, etc.
protected  void collapseTopic()
          Collapses the currently selected topic node.
 void deleteSelected(boolean confirm)
          Deletes the selected graph nodes.
 void designateAsComponent()
          Designate the selected Topics as either a normal Topic or a document component Topic.
 void desktopPropertyChanged()
          A notification that some property affecting graphs has changed in the Desktop, likely as a result of a menu action.
protected  void expandTopic()
          Expands the currently selected topic node.
 boolean fileClose(boolean forced)
          Closes the current graph, first checking to be sure that it has not been modified.
 boolean fileImport(File file, ExtensionFileFilter filter)
          If file is null, displays a FileChooser and obtains the selected File, then uses methods within SourceProcessor to determine which import processor to call to import the file type.
 boolean fileImport(Object source)
          Opens the selected source, specified by a String, File, or TypedInputSource into the current View.
 boolean fileImport(TypedInputSource source, ViewFrame viewframe, TMLayoutPanel tmpanel)
          Vets opening the provided TypedInputSource, checking first if there is existing content and querying on what to do if there is.
 boolean fileNew()
          Creates a new, empty document.
 boolean fileOpen(File file)
          A synonym for fileImport(Object).
 boolean fileSave()
          This method attempts to save the single TopicMap stored in the TMLayoutPanel to its base locator's systemID.
 boolean fileSave(File file)
          Saves the currently visualized Topic Map to a file.
 void finalize(TopicMap topicmap, File file)
          Prior to saving, perform any processes necessary to ready the TopicMap topicmap to be saved, such as updating its metadata and setting its base locator based on the File.
 boolean findTopic(String s)
          Does a query on the Graph based on the provided String.
 Association getAssociationTemplate(Topic type)
          Provided an association typing Topic, returns the corresponding Association template (as an Association).
 JPopupMenu getRecentPopup()
          Returns the recently-opened popup menu.
 String getSelectedResource()
          Returns the URI (as a String) of either the MouseOVer'd Topic node, or if there isn't one, the selected Topic node.
 Vector getTemplateList()
          Returns a Vector containing the association templates for this GraphView's TMLayoutPanel, in the form of a two element array containing a text description of the template followed by its typing Topic.
 TMLayoutPanel getTMLayoutPanel()
          Lazily creates and returns the TMLayoutPanel.
 JToolBar getToolBar()
          Lazily creates and returns the Graph ToolBar.
 TopicEditorDialog getTopicEditor(TNode tnode)
          Returns the TopicEditorDialog associated with this GraphView.
 TopicMapProcessor getTopicMapProcessor()
          Return the TopicMapProcessor used by this GraphView.
 TopicMapVisualizer getVisualizer()
          Returns the TopicMapVisualizer associated with this GraphView.
 void graphInfo()
          Display graph info in a dialog box.
 void grid()
          Sets the grid mode for this graph.
static void invalidateRecentPopup()
          Invalidates the recently-opened popup due to a change in the underlying contents.
 boolean isDirty()
          Returns an indication of true if the current document has been edited.
 void makeConsistent()
          Processes the current TopicMap for consistency, removing duplicate roles, basenames, etc.
 void newAssociation()
          Create a new Association.
 void newRectTopic(String id)
          Creates a new rectangular style Topic node.
 void newTarget(String id)
          Creates a new target (or circle) style Topic node.
 TNode newTopic()
          Create a new Topic.
 TNode newTopic(Point2D.Double p)
          Create a new Topic at the optionally provided location.
 TNode newTopic(Point2D.Double p, String label)
          Create a new Topic having the provided label at the given location.
 void nodeFix()
          fix node in place.
 void nodeFixAll()
          Fixes the location of all TNodes in place.
 void nodeUnfix()
          unfix node.
 void nodeUnfixAll()
          Unfixes the location of all Nodes, regardless of type.
 boolean openImage(File file, boolean query)
          If either query is true or the supplied File is null, displays a file chooser box, then loads the selected image into the image panel.
 boolean openImageURL(URL url)
          Loads the image specified by the URL url into the image panel.
 void packView()
          Suggests to the GraphView that it resize any internal components appropriate to its current size.
 String queryTopicTitle(String title)
          Queries user for a Topic title, with an optional default title.
 void refresh()
          Refresh the display.
 void reinitialize(boolean forced, boolean flush)
          Removes the current graph, creating a new, empty graph.
 void requestFocus()
          Sets the current focus to the graph area.
 boolean save(File file, Object o)
          Saves the Object o (as a TopicMap) to the provided File file.
 void saveProperties()
          Saves any graph properties to the property file.
protected  void selectCLUT()
          Displays a dialog box allowing the user to select a different color lookup table (CLUT), used for custom node colors.
protected  Topic selectRelation(Topic relation)
          Return a selected Association type from a dialog of available relations.
protected  void selectScroll(int scroll)
          Displays the scrollbar indicated by the String name,
protected  void selectStylesheet()
          Displays a dialog box allowing the user to select a different graph stylesheet.
 Association selectTemplate(String title)
          Displays a dialog box for selecting one of the available association templates.
 void setColorFlag(String name, ActionEvent event)
          Colorize the labels of the selected nodes to the color identified by String name.
 void setFixedIsPinned(boolean pinned)
          Sets the fixed-is-pinned feature to the provided value, and also writes the value to the properties file.
protected  void setGraphMode(boolean showTimelines)
          Set the graph display mode, displaying timelines if showTimelines if true.
 void setToolsVisible(boolean visible)
          Sets the visibility of the graph toolbar to the boolean visible, updating the menu item appropriately.
 void showFindTopic()
          Displays the Find Topic dialog box.
 void subgraphTopic(int style)
          Creates a subgraph from the currently-selected Topic(s).
 void swapRoles()
          Swap the roles of the selected Association(s).
 void update()
          Updates the display.
 boolean updateLocations(TopicMap tm)
          Iterates through all of the Topics in TopicMap tm, updating the stored locations of any fixed nodes to their current locations.
 
Methods inherited from class org.ceryle.ui.View
deactivate, fileSaveAs, getDesktop, getSystemId, getTitle, getType, getTypeName, getViewFrame, getViewManager, hasDatabase, hasEditing, hasGraph, isDocumentOrNoteView, isDocumentView, isGraphView, isNoteView, isProjectView, setSystemId, setTitle, setTitle, setViewFrame
 
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, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

assocTypesHelpID

public static final String assocTypesHelpID
The ID in the Help collection for the tutorial on Association types.

See Also:
Constant Field Values

m_timelinesViz

protected boolean m_timelinesViz
A boolean indicating the mode of display: if 'true', timelines are displayed.


GraphSearch

public static final String GraphSearch
The graph search string.

See Also:
Constant Field Values

tmlp

protected TMLayoutPanel tmlp
The TMLayoutPanel used.


tmviz

protected TopicMapVisualizer tmviz
The TopicMapVisualizer used to display TopicMaps.


tmproc

protected TopicMapProcessor tmproc
The TopicMapProcessor used by this GraphView.


timeline

protected TimeLine timeline

m_graphtools

protected GraphToolBar m_graphtools
The toolbar used to manipulate the graph.

Constructor Detail

GraphView

public GraphView(ViewFrame viewframe)
Constructor with a reference to its wrapper ViewFrame.

Parameters:
viewframe - the parent ViewFrame for this GraphView

GraphView

public GraphView(ViewFrame viewframe,
                 int type)
Constructor with a reference to its wrapper ViewFrame and an optional View type. Use of this method is designed for GraphView extensions (with the value for a GraphView being Graph.VIEW).

Parameters:
viewframe - the parent ViewFrame for this GraphView
type - the type of View this represents

GraphView

public GraphView(ViewFrame viewframe,
                 String title)
A "convenience constructor" that allows the View title to be set at construction time.

Method Detail

update

public void update()
Updates the display.


reinitialize

public void reinitialize(boolean forced,
                         boolean flush)
Removes the current graph, creating a new, empty graph. If forced, makes no attempt to warn about open files, if false, queries via fileClose(boolean). If flush is true, replaces the existing TopicMapProcessor rather than simply resetting it. This may have an effect on other GraphView or ProjectView views if they use the same processor, though in current code processors are unique per view.


getTopicMapProcessor

public TopicMapProcessor getTopicMapProcessor()
Return the TopicMapProcessor used by this GraphView.


saveProperties

public void saveProperties()
Saves any graph properties to the property file.


packView

public void packView()
Suggests to the GraphView that it resize any internal components appropriate to its current size.

Specified by:
packView in class View

requestFocus

public void requestFocus()
Sets the current focus to the graph area.

Specified by:
requestFocus in class View

refresh

public void refresh()
Refresh the display. Unimplemented.

Specified by:
refresh in class View

closing

public void closing()
This method should be called before closing the GraphView to allow safe closing of any dirty content, removing listeners, etc.

Specified by:
closing in class View

getRecentPopup

public JPopupMenu getRecentPopup()
Returns the recently-opened popup menu. This is lazily-created, and gets its content from the Desktop's recent graph list.


invalidateRecentPopup

public static void invalidateRecentPopup()
Invalidates the recently-opened popup due to a change in the underlying contents.


setFixedIsPinned

public void setFixedIsPinned(boolean pinned)
Sets the fixed-is-pinned feature to the provided value, and also writes the value to the properties file. (I.e., while the boolean is public and may be set directly, using this method writes the property.)


getSelectedResource

public String getSelectedResource()
Returns the URI (as a String) of either the MouseOVer'd Topic node, or if there isn't one, the selected Topic node. This also has to negotiate multiple selection (though even in a multiple selection there is always the one node that TG thinks is selected, but this isn't necessarily discernable to the user).

If there is currently no loaded TopicMap or no selected Topic node, null is returned. If the current TopicMap has no base Locator, the ID of the selected Topic node is returned as a fragment ID (though absent the initial hash symbol).

Note that if there is more than one selected node, the selection is checked against the mouseOver Node, which is given priority since it is most likely the trigger for this method call. [This work still needs to be done -- currently, only pays attention to the one "selected node."]

Specified by:
getSelectedResource in class View
See Also:
View

getTMLayoutPanel

public TMLayoutPanel getTMLayoutPanel()
Lazily creates and returns the TMLayoutPanel. If the panel has already been created, the existing one is returned.

Note that this method does not throw an exception upon fault during lazy creation.


getToolBar

public JToolBar getToolBar()
Lazily creates and returns the Graph ToolBar. If the toolbar has already been created, the existing one is returned.


getVisualizer

public TopicMapVisualizer getVisualizer()
Returns the TopicMapVisualizer associated with this GraphView. Uses a lazy instantiation.


getTopicEditor

public TopicEditorDialog getTopicEditor(TNode tnode)
Returns the TopicEditorDialog associated with this GraphView. This is a convenience method that returns the object owned by the TMLayoutPanel.


queryTopicTitle

public String queryTopicTitle(String title)
Queries user for a Topic title, with an optional default title. Returns null if cancelled.


desktopPropertyChanged

public void desktopPropertyChanged()
A notification that some property affecting graphs has changed in the Desktop, likely as a result of a menu action.


addToolExtras

public void addToolExtras(JToolBar tb)
If in developer mode, add some experimental buttons to the right end of the toolbar.


setToolsVisible

public void setToolsVisible(boolean visible)
Sets the visibility of the graph toolbar to the boolean visible, updating the menu item appropriately.


selectScroll

protected void selectScroll(int scroll)
Displays the scrollbar indicated by the String name,

See Also:
GraphLayoutPanel.ZOOM_SCROLL, GraphLayoutPanel.ROTATE_SCROLL, GraphLayoutPanel.LOCALITY_SCROLL

fileNew

public boolean fileNew()
Creates a new, empty document.

Specified by:
fileNew in class View
Returns:
true if able to close any existing content and establish a new document

fileOpen

public boolean fileOpen(File file)
A synonym for fileImport(Object).

Specified by:
fileOpen in class View
Returns:
true if opened

fileImport

public boolean fileImport(File file,
                          ExtensionFileFilter filter)
If file is null, displays a FileChooser and obtains the selected File, then uses methods within SourceProcessor to determine which import processor to call to import the file type. If filter is null, a default is used.


fileImport

public boolean fileImport(Object source)
Opens the selected source, specified by a String, File, or TypedInputSource into the current View. If source is null, displays a FileChooser allowing user selection.

Specified by:
fileImport in class View
Returns:
true if opened

fileImport

public boolean fileImport(TypedInputSource source,
                          ViewFrame viewframe,
                          TMLayoutPanel tmpanel)
Vets opening the provided TypedInputSource, checking first if there is existing content and querying on what to do if there is. The options include: opening a new GraphView; merging with the existing content; clearing the existing content before proceeding; or cancelling the operation (i.e., doing nothing).

Returns:
true if the document was opened

fileSave

public boolean fileSave()
This method attempts to save the single TopicMap stored in the TMLayoutPanel to its base locator's systemID.

Overrides:
fileSave in class View
Returns:
false if the user cancels the file selection dialog or chooses not to overwrite an existing file. Returns true if the save was successful or the source document (content) is empty (i.e., we didn't need to save).

fileSave

public boolean fileSave(File file)
Saves the currently visualized Topic Map to a file. The provided file is generally only used when there is only one visualized Topic Map.

If a file already exists, displays a dialog box allowing overwrite or a "save as..." option.

Returns true as per the API: if all of the visualized documents have been successfully saved or if no saving is necessary.

Prior to saving the TopicMap(s), if the Ceryle property tm-consistentTopicMap is true, the TopicMap object is made consistent (a function provided by TM4J) prior to serialization.

Specified by:
fileSave in class View
Returns:
false if the user cancels the file selection dialog or chooses not to overwrite an existing file. Returns true if all necessary saves were successful or the source document (content) is empty (i.e., a save wasn't necessary).

chooseExportFile

public File chooseExportFile(File defaultFile)
Provided with a JComponent parent, displays a FileChooser dialog box and returns the selected File, or null if no file is chosen. If defaultFile is non-null, it is set as the selected file. The dialog type can be JFileChooser.OPEN_DIALOG or JFileChooser.SAVE_DIALOG. The FileFilter is optional.


finalize

public void finalize(TopicMap topicmap,
                     File file)
Prior to saving, perform any processes necessary to ready the TopicMap topicmap to be saved, such as updating its metadata and setting its base locator based on the File.


updateLocations

public boolean updateLocations(TopicMap tm)
Iterates through all of the Topics in TopicMap tm, updating the stored locations of any fixed nodes to their current locations. Nodes that are not fixed (i.e., have no stored location property) are unaffected. Since this is generally performed just prior to export and they are related functions, this method can be used to determine if the TopicMap is using a ColorLookupTable, as it returns true if this is the case (rather than doing yet another pass).

Returns:
true if any Topic nodes are using a color flag (a convenience)

save

public boolean save(File file,
                    Object o)
Saves the Object o (as a TopicMap) to the provided File file.


isDirty

public boolean isDirty()
Returns an indication of true if the current document has been edited. (This returns the 'dirty' member variable of the current TMLayoutPanel.)

Specified by:
isDirty in class View

fileClose

public boolean fileClose(boolean forced)
Closes the current graph, first checking to be sure that it has not been modified. If the boolean forced is true, provides only a "yes" or "no" option for the save dialog if the existing content is dirty, "cancel" as well if false. This also clears and reinitializes the graph.

Specified by:
fileClose in class View
Returns:
true if closed

graphInfo

public void graphInfo()
Display graph info in a dialog box.


newTopic

public TNode newTopic()
Create a new Topic.


newTopic

public TNode newTopic(Point2D.Double p)
Create a new Topic at the optionally provided location.


newTopic

public TNode newTopic(Point2D.Double p,
                      String label)
Create a new Topic having the provided label at the given location. Both parameters are optional.


newAssociation

public void newAssociation()
Create a new Association.


getTemplateList

public Vector getTemplateList()
Returns a Vector containing the association templates for this GraphView's TMLayoutPanel, in the form of a two element array containing a text description of the template followed by its typing Topic.


selectTemplate

public Association selectTemplate(String title)
Displays a dialog box for selecting one of the available association templates. This is returned as the Association template itself (an, Association having the Ceryle 'Template' PSI as a type), or null if the dialog was cancelled.

Parameters:
title - the dialog title String.

getAssociationTemplate

public Association getAssociationTemplate(Topic type)
Provided an association typing Topic, returns the corresponding Association template (as an Association).


selectRelation

protected Topic selectRelation(Topic relation)
Return a selected Association type from a dialog of available relations. This involves building a list of class topics whose parent is "Relation" and its subclasses.


swapRoles

public void swapRoles()
Swap the roles of the selected Association(s).


nodeFix

public void nodeFix()
fix node in place.


nodeUnfix

public void nodeUnfix()
unfix node.


collapseTopic

protected void collapseTopic()
Collapses the currently selected topic node.


expandTopic

protected void expandTopic()
Expands the currently selected topic node.


arrangeTopics

public void arrangeTopics()
Arranges the selected TNodes on a grid, sorting them alphabetically.


grid

public void grid()
Sets the grid mode for this graph.


centerTopic

public void centerTopic()
Centers the selected topic node.


designateAsComponent

public void designateAsComponent()
Designate the selected Topics as either a normal Topic or a document component Topic.


setColorFlag

public void setColorFlag(String name,
                         ActionEvent event)
Colorize the labels of the selected nodes to the color identified by String name. A null value will clear this property from the selected nodes. If the ActionEvent event indicates the Alt key was down, this does an entirely different task: searches the graph for all Topics of the specified Color, and selects them. If the shift key was down the selection is not cleared prior to adding the new selected nodes.


subgraphTopic

public void subgraphTopic(int style)
Creates a subgraph from the currently-selected Topic(s). There are two modes, depending on the number and type of the selected Topics.

nodeFixAll

public void nodeFixAll()
Fixes the location of all TNodes in place. Other node types are ignored.


nodeUnfixAll

public void nodeUnfixAll()
Unfixes the location of all Nodes, regardless of type.


selectStylesheet

protected void selectStylesheet()
Displays a dialog box allowing the user to select a different graph stylesheet.


findTopic

public boolean findTopic(String s)
Does a query on the Graph based on the provided String. This can either be a fragment identifier (in which case the query is by ID), or in the form of ~find(name) (searching on the value of 'name').

Returns:
true if one or more Topics are found.

showFindTopic

public void showFindTopic()
Displays the Find Topic dialog box. This passes the message off to the existing FindReplaceDialog, set to graph mode.


deleteSelected

public void deleteSelected(boolean confirm)
Deletes the selected graph nodes. This passes the message off to the TMPanelEditor.


selectCLUT

protected void selectCLUT()
Displays a dialog box allowing the user to select a different color lookup table (CLUT), used for custom node colors.


setGraphMode

protected void setGraphMode(boolean showTimelines)
Set the graph display mode, displaying timelines if showTimelines if true.


makeConsistent

public void makeConsistent()
Processes the current TopicMap for consistency, removing duplicate roles, basenames, etc. If there is no Topic Map loaded, nothing happens.


openImage

public boolean openImage(File file,
                         boolean query)
If either query is true or the supplied File is null, displays a file chooser box, then loads the selected image into the image panel.

Returns:
true if successful

openImageURL

public boolean openImageURL(URL url)
Loads the image specified by the URL url into the image panel. If supplied with a null parameter, queries the user.

Returns:
true if successful

newTarget

public void newTarget(String id)
Creates a new target (or circle) style Topic node. If the optional id is provided, it will be used as the ID of the new node.


newRectTopic

public void newRectTopic(String id)
Creates a new rectangular style Topic node. If the optional id is provided, it will be used as the ID of the new node.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.