JGraphpad Pro
v6.0.5.0


com.jgraph.pad.factory
Class JGraphpadLibraryPane.LibraryTracker

java.lang.Object
  extended bycom.jgraph.pad.util.JGraphpadTreeModelAdapter
      extended bycom.jgraph.pad.factory.JGraphpadLibraryPane.LibraryTracker
All Implemented Interfaces:
EventListener, TreeModelListener
Enclosing class:
JGraphpadLibraryPane

public static class JGraphpadLibraryPane.LibraryTracker
extends JGraphpadTreeModelAdapter

Utility class to establish a listener in a editor's document model and update the library panes in a tabbed pane.


Field Summary
protected  JGraphEditor editor
          References the enclosing editor.
protected  JTabbedPane tabPane
          References the tabbed pane to be updated.
protected  Map tabs
          Holds library, component pairs to find the respective tabs.
 
Constructor Summary
JGraphpadLibraryPane.LibraryTracker(JTabbedPane tabPane, JGraphEditor editor)
          Constructs a new library tracker for updating the specified tabPane using factory to create required components.
 
Method Summary
protected  String getTitle(JGraphpadLibrary library)
          Hook for subclassers to return the tab title to be used for the specified library.
 void treeNodesChanged(TreeModelEvent arg0)
          Calls updateTabTitle(JGraphpadLibrary) for all libraries that have changed in the tree.
 void treeNodesInserted(TreeModelEvent arg0)
          Creates a new JGraphpadLibraryPane, wraps it up in a scroll pane using JGraphEditorFactory.createScrollPane(Component) and adds it as a tab to tabPane using the library's toString method to set the tab's title.
 void treeNodesRemoved(TreeModelEvent arg0)
          Removes the tabs for the removed libraries from the tab pane.
protected  void updateTabTitle(JGraphpadLibrary library)
          Invoked to update the title for the tab of the specified library.
 
Methods inherited from class com.jgraph.pad.util.JGraphpadTreeModelAdapter
treeStructureChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editor

protected JGraphEditor editor
References the enclosing editor.


tabPane

protected JTabbedPane tabPane
References the tabbed pane to be updated.


tabs

protected Map tabs
Holds library, component pairs to find the respective tabs.

Constructor Detail

JGraphpadLibraryPane.LibraryTracker

public JGraphpadLibraryPane.LibraryTracker(JTabbedPane tabPane,
                                           JGraphEditor editor)
Constructs a new library tracker for updating the specified tabPane using factory to create required components. The library tracker must be added as a tree model listener to an editor's document model.

Parameters:
tabPane - The pane to be updated on document model changes.
editor - The enclosing editor.
Method Detail

treeNodesInserted

public void treeNodesInserted(TreeModelEvent arg0)
Creates a new JGraphpadLibraryPane, wraps it up in a scroll pane using JGraphEditorFactory.createScrollPane(Component) and adds it as a tab to tabPane using the library's toString method to set the tab's title.

Specified by:
treeNodesInserted in interface TreeModelListener
Overrides:
treeNodesInserted in class JGraphpadTreeModelAdapter
Parameters:
arg0 - The object that describes the event.

treeNodesRemoved

public void treeNodesRemoved(TreeModelEvent arg0)
Removes the tabs for the removed libraries from the tab pane.

Specified by:
treeNodesRemoved in interface TreeModelListener
Overrides:
treeNodesRemoved in class JGraphpadTreeModelAdapter

treeNodesChanged

public void treeNodesChanged(TreeModelEvent arg0)
Calls updateTabTitle(JGraphpadLibrary) for all libraries that have changed in the tree.

Specified by:
treeNodesChanged in interface TreeModelListener
Overrides:
treeNodesChanged in class JGraphpadTreeModelAdapter
Parameters:
arg0 - The object that describes the event.

updateTabTitle

protected void updateTabTitle(JGraphpadLibrary library)
Invoked to update the title for the tab of the specified library.

Parameters:
library - The library who's title needs to be updated.

getTitle

protected String getTitle(JGraphpadLibrary library)
Hook for subclassers to return the tab title to be used for the specified library. This implementation returns the filename-part of a path.

Parameters:
library - The library to return the title for.
Returns:
Returns a title for library.

JGraphpad Pro
v6.0.5.0


Copyright (C) 2005 JGraph.com. All rights reserved.