org.peace_tools.views
Class DataSetTreeView

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.peace_tools.views.DataSetTreeView
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class DataSetTreeView
extends javax.swing.JPanel
implements java.awt.event.ActionListener

See Also:
Serialized Form

Nested Class Summary
private  class DataSetTreeView.DataSetRenderer
          A tree cell renderer that essentially provides a better representative set of Icons to make the overall display look a bit prettier.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JTree dataSetTree
          The actual JTree that provides a hierarchical view of the data files currently configured on this work space.
private static javax.swing.Icon[] LeafIcons
          The static set of icons that are repeatedly used by the custom cell renderer used by this tree view class.
private  DataSetFileListView listView
          The actual JTable that provides a graphical view of the data sets in the form of a list.
private  MainFrame mainFrame
          Convenient reference to the main frame class that logically owns this view in its frame.
(package private)  DataSetPopupMenu popupMenu
          This is a pop-up menu that is displayed whenever the user clicks the left mouse button on a menu item.
private static long serialVersionUID
          A generated serial version ID.
private  javax.swing.JToolBar toolbar
          The tool bar that contains some commonly used tools with the data set tree view.
private  DataSetTreeModel treeModel
          The data model that provides the various branches and leaves to be displayed in the tree.
 
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
DataSetTreeView(MainFrame frame)
          The constructor creates the tree view using the data from the current work space.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
          Action listener to handle call backs from pop up menu items.
private  void addMouseAdapter(javax.swing.JTree tree)
          A refactored helper method to add a mouse adapter.
private  void handleDoubleClick(java.awt.event.MouseEvent me)
          Helper method to handle double click of the mouse on a tree item.
 void handlePopup(java.awt.event.MouseEvent me)
          Helper method to left mouse click on a tree item.
 void setSelectedEntry(java.lang.Object entry)
          Method to select entry in the data set tree view This is a helper method that is primarily used by the DataSetFileListView to update the selected entry when when the selection in the table changes.
 void setTableView(DataSetFileListView listView)
          Set the reference to the file table to be synchronized with this tree.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LeafIcons

private static final javax.swing.Icon[] LeafIcons
The static set of icons that are repeatedly used by the custom cell renderer used by this tree view class.


popupMenu

DataSetPopupMenu popupMenu
This is a pop-up menu that is displayed whenever the user clicks the left mouse button on a menu item. This menu is created with a static set of menu items and appropriate entries are enabled and disabled.


mainFrame

private final MainFrame mainFrame
Convenient reference to the main frame class that logically owns this view in its frame. This value is set in the constructor and is never changed.


treeModel

private final DataSetTreeModel treeModel
The data model that provides the various branches and leaves to be displayed in the tree. The tree model obtains the necessary data from the currently active workspace.


toolbar

private javax.swing.JToolBar toolbar
The tool bar that contains some commonly used tools with the data set tree view.


dataSetTree

private javax.swing.JTree dataSetTree
The actual JTree that provides a hierarchical view of the data files currently configured on this work space.


listView

private DataSetFileListView listView
The actual JTable that provides a graphical view of the data sets in the form of a list. This reference is used to synchronize the selected entries in the tree and the table.


serialVersionUID

private static final long serialVersionUID
A generated serial version ID.

See Also:
Constant Field Values
Constructor Detail

DataSetTreeView

public DataSetTreeView(MainFrame frame)
The constructor creates the tree view using the data from the current work space.

Parameters:
frame - The main frame that logically owns this view.
Method Detail

addMouseAdapter

private void addMouseAdapter(javax.swing.JTree tree)
A refactored helper method to add a mouse adapter. This method adds a mouse adapter to intercept certain mouse events occurring on the data set tree to trigger various operations. The mouse adapter simply delegates the actual operations to other methods in this class.

Parameters:
tree - The tree object to which the mouse adapter is to be added.

handlePopup

public void handlePopup(java.awt.event.MouseEvent me)
Helper method to left mouse click on a tree item. This method is invoked whenever the user clicks on the left mouse button on a item in the data set tree. This method checks to see if the entry is valid and if so, pops up a menu with valid operations for the selected item.

Parameters:
me - The mouse event associated with the mouse click.

handleDoubleClick

private void handleDoubleClick(java.awt.event.MouseEvent me)
Helper method to handle double click of the mouse on a tree item. This method is invoked whenever the user double clicks on a item in the data set tree. This method checks to see if the entry is valid and if so, opens a view of the specified data file.

Parameters:
me - The mouse event associated with the double click.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Action listener to handle call backs from pop up menu items. This action handler is invoked whenever the user selects various menu options or clicks on the tool bar buttons. This method is handles only actions that are specific to tree operations (such as expand and collapse). Other operations are handled by the DataSetPopupMenu class.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

setTableView

public void setTableView(DataSetFileListView listView)
Set the reference to the file table to be synchronized with this tree. This method is used by the ViewFactory to setup cross reference between the tree view and the data set file list view.

Parameters:
listView - The list view whose selected entry is to be synchronized with that of this tree.

setSelectedEntry

public void setSelectedEntry(java.lang.Object entry)
Method to select entry in the data set tree view This is a helper method that is primarily used by the DataSetFileListView to update the selected entry when when the selection in the table changes.

Parameters:
entry - The entry to be selected. If this value is null then selections are cleared.