edu.iris.dmc.pdcc.gui
Class PdccMainPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byedu.iris.dmc.pdcc.gui.PdccMainPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.KeyListener, java.awt.MenuContainer, java.io.Serializable, javax.swing.event.TreeSelectionListener, edu.iris.dmc.isis.UpdateListener

public class PdccMainPanel
extends javax.swing.JPanel
implements java.awt.event.KeyListener, javax.swing.event.TreeSelectionListener, edu.iris.dmc.isis.UpdateListener

This is the class that constructs the main GUI panel for PDCC.

Version:
5/22/2006
Author:
Robert Casey, IRIS DMC
Linus Kamb, IRIS DMC
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
 
Method Summary
 void collapseNode(javax.swing.tree.TreeNode node)
          Collapse the indicated tree node.
 void copySelectedObject()
          Save a copy of selected objects to the clipboard...in preparation for one or more pastes.
 void copySelectedObject(boolean pasteToClipboard)
          Save a copy of selected objects to the clipboard...in preparation for one or more pastes.
 PdccObject createCategoryNode(ObjectContainer objContainer, int categoryNum)
          Generate a new category node of the indicated category number to be placed relative to the currently registered root node.
 PdccTreeNodeObject createRootNode(java.lang.String prefix, java.lang.String nodeName, ObjectContainer objContainer)
          Set up current (volume) root node for containing objects.
 void cutSelectedObject(boolean copyFirst)
          Copy and then delete the selected object.
 void enableTreeSelectionListener()
          Enable TreeSelectionListener functions inherent to this class.
 void expandNode(javax.swing.tree.TreeNode node)
          Expand the indicated tree node.
 javax.swing.JMenu[] getContextMenus()
          Gets a JMenu that is not currently implemented.
 PdccObject getDictionaryNode(PdccObject startNode)
          find and return the dictionary category node (type -12) that belongs to the volume that startNode is in.
 PdccEditPanel getEditPanel()
           
 int getNewDictionaryCode(int type, PdccObject dictionaryCategoryNode)
          get the incremental lookup code for a new dictionary blockette of a given type for the dictonary category node (type -12) provided return a 1 on failure -- non fatal response
 PdccObject getNewPdccObject(java.lang.Object srcObj)
          returns new concrete instance of a PdccObject.
 int getNextStageNumber()
          return an incremented stage number for the currently selected channel object.
 PdccProgressBar getProgressBar()
          Return the progress bar object.
 boolean insertionSortResponseNodes(PdccObject treeNode, boolean newInsert)
          FOR RESPONSE BLOCKETTES that have special sorting, based on stage number and then on blockette type, we perform an insertion sort so that the JTree nodes are properly ordered.
 void keyPressed(java.awt.event.KeyEvent e)
          Implements Keylistener method
 void keyReleased(java.awt.event.KeyEvent e)
          Implements Keylistener method
 void keyTyped(java.awt.event.KeyEvent e)
          Implements Keylistener method
 void loadDbChildren(PdccObject pdccObj)
          non-interactively load database children for indicated parent node
 void loadNewChildren(PdccObject parent)
          Load child objects of this parent object.
 PdccObject loadNewObject(java.lang.Object newObj, PdccObject parent, ObjectContainer objContainer)
          This is how we load source data objects from the object container into the MainPanel.
 void loadObjectContainer(ObjectContainer objContainer, int categoryNum)
          this is how we load data into the MainPanel from object containers.
 void pasteFromClipboard()
          Paste to the JTree selection from the clipboard.
 PdccBlocketteObject pasteNewObjectAfter(int newObjType, PdccObject pasteAfter)
          Create a new object of indicated type and place after the indicated PdccObject.
 void pasteNewObjectAfterSelected(int newObjType)
          Create a new object of the indicated type and place after the currently selected JTree node.
 PdccObject pasteObjectAfter(PdccBlocketteObject objToPaste, PdccObject pasteAfterThis, int depth)
          Paste a copied/cut PdccObject after/under another PdccObject in the JTree and/or TreeModel.
 void refreshDictionary()
          Refresh the dictionary node for the currently selected node's volume.
 void setPreferredDictionaryCode(int code)
          sets the preferred dictionary lookup code for any new dictionary nodes created.
 void setPreferredStageNumber(int stageNumber)
          sets the preferred stage number of any new response objects created.
 void setSelection(javax.swing.tree.TreeNode obj)
          Move the JTree selection to point to this object.
 void setSelections(javax.swing.tree.TreeNode[] objs)
          Move the JTree selection to point to this collection of objects as indicated by the array of TreeNodes
 void update(edu.iris.dmc.isis.Editable editable)
           
 void updateNavTree(edu.iris.dmc.isis.Editable editable)
          Like update(), but update the graphics for just the Navigation tree
 void useClipboardModel(boolean flag)
          Call this method to activate and deactivate the referencing of the clipboard tree model.
 void valueChanged(javax.swing.event.TreeSelectionEvent e)
          Implements TreeSelectionListener: response to JTree selection events
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Method Detail

enableTreeSelectionListener

public void enableTreeSelectionListener()
Enable TreeSelectionListener functions inherent to this class.


collapseNode

public void collapseNode(javax.swing.tree.TreeNode node)
Collapse the indicated tree node.

Parameters:
node - the TreeNode to collapse.

expandNode

public void expandNode(javax.swing.tree.TreeNode node)
Expand the indicated tree node.


getContextMenus

public javax.swing.JMenu[] getContextMenus()
Gets a JMenu that is not currently implemented.

Returns:

getEditPanel

public PdccEditPanel getEditPanel()

getProgressBar

public PdccProgressBar getProgressBar()
Return the progress bar object.

Returns:

setSelection

public void setSelection(javax.swing.tree.TreeNode obj)
Move the JTree selection to point to this object.

Parameters:
obj - set tree selection to this node

setSelections

public void setSelections(javax.swing.tree.TreeNode[] objs)
Move the JTree selection to point to this collection of objects as indicated by the array of TreeNodes

Parameters:
objs - tree node objects to be marked as selected

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent e)
Implements TreeSelectionListener: response to JTree selection events

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener

createRootNode

public PdccTreeNodeObject createRootNode(java.lang.String prefix,
                                         java.lang.String nodeName,
                                         ObjectContainer objContainer)
                                  throws java.lang.Exception
Set up current (volume) root node for containing objects. Connect to the ObjectContainer pertaining to this volume. Return the root node created.

Throws:
java.lang.Exception

loadObjectContainer

public void loadObjectContainer(ObjectContainer objContainer,
                                int categoryNum)
                         throws java.lang.Exception
this is how we load data into the MainPanel from object containers.

Parameters:
objContainer - the container to be loaded from
categoryNum - the category of objects to read in (1 - 6)
Throws:
java.lang.Exception

loadNewObject

public PdccObject loadNewObject(java.lang.Object newObj,
                                PdccObject parent,
                                ObjectContainer objContainer)
                         throws java.lang.Exception
This is how we load source data objects from the object container into the MainPanel. This method is clipboard-aware.

Parameters:
newObj - new object to be loaded
parent - this object's parent
objContainer - the object container this object is to be registered to
Returns:
newly generated PdccObject
Throws:
java.lang.Exception

loadNewChildren

public void loadNewChildren(PdccObject parent)
                     throws java.lang.Exception
Load child objects of this parent object.

Parameters:
parent - the parent object to load its children to.
Throws:
java.lang.Exception

cutSelectedObject

public void cutSelectedObject(boolean copyFirst)
                       throws java.lang.Exception
Copy and then delete the selected object. Just delete if the boolean flag (copyFirst) parameter is set to false.

Throws:
java.lang.Exception

copySelectedObject

public void copySelectedObject()
                        throws java.lang.Exception
Save a copy of selected objects to the clipboard...in preparation for one or more pastes. If a previous copy was stored in the clipboard, then delete those nodes. This is the default usage.

Throws:
java.lang.Exception

copySelectedObject

public void copySelectedObject(boolean pasteToClipboard)
                        throws java.lang.Exception
Save a copy of selected objects to the clipboard...in preparation for one or more pastes. If a previous copy was stored in the clipboard, then delete those nodes.

Parameters:
pasteToClipboard - true (default) when this routine should paste a copy to the clipboard, false to skip this to facilitate just deletion
Throws:
java.lang.Exception

pasteFromClipboard

public void pasteFromClipboard()
                        throws java.lang.Exception
Paste to the JTree selection from the clipboard.

Throws:
java.lang.Exception

pasteObjectAfter

public PdccObject pasteObjectAfter(PdccBlocketteObject objToPaste,
                                   PdccObject pasteAfterThis,
                                   int depth)
                            throws java.lang.Exception
Paste a copied/cut PdccObject after/under another PdccObject in the JTree and/or TreeModel.

Parameters:
objToPaste - blockette wrapper object to pasted -- a new copy is made before pasting
pasteAfterThis - object to be pasted after or under
depth - recursion depth, which starts out as 0
Returns:
handle to 'copy of objToPaste', as it resides in the destination tree
Throws:
java.lang.Exception

pasteNewObjectAfter

public PdccBlocketteObject pasteNewObjectAfter(int newObjType,
                                               PdccObject pasteAfter)
                                        throws java.lang.Exception
Create a new object of indicated type and place after the indicated PdccObject.

Parameters:
newObjType - new object to be created
pasteAfter - object to be pasted after
Returns:
the new PdccBlocketteObject of type newObjType
Throws:
java.lang.Exception

pasteNewObjectAfterSelected

public void pasteNewObjectAfterSelected(int newObjType)
                                 throws java.lang.Exception
Create a new object of the indicated type and place after the currently selected JTree node.

Parameters:
newObjType - new object to be created
Throws:
java.lang.Exception

createCategoryNode

public PdccObject createCategoryNode(ObjectContainer objContainer,
                                     int categoryNum)
                              throws java.lang.Exception
Generate a new category node of the indicated category number to be placed relative to the currently registered root node. If a category node is registered being the same type and having the same parent, then do not create a new category node, but use the currently instantiated one.

Parameters:
objContainer - the object container that applies to the category node
categoryNum - the category number of the node to be created and/or recognized
Returns:
the PdccObject handle to the current or new category node
Throws:
java.lang.Exception

insertionSortResponseNodes

public boolean insertionSortResponseNodes(PdccObject treeNode,
                                          boolean newInsert)
                                   throws java.lang.Exception
FOR RESPONSE BLOCKETTES that have special sorting, based on stage number and then on blockette type, we perform an insertion sort so that the JTree nodes are properly ordered. Also includes Channel comments in the sort, but places them last in the list. Return true if a sort had occurred.

Throws:
java.lang.Exception

loadDbChildren

public void loadDbChildren(PdccObject pdccObj)
non-interactively load database children for indicated parent node


refreshDictionary

public void refreshDictionary()
                       throws java.lang.Exception
Refresh the dictionary node for the currently selected node's volume.

Throws:
java.lang.Exception

useClipboardModel

public void useClipboardModel(boolean flag)
Call this method to activate and deactivate the referencing of the clipboard tree model. Clipboard is for use by routines performing cut-copy-paste operations. Be sure the implementor toggles this true, does its work, and then sets it back to false.


getNextStageNumber

public int getNextStageNumber()
return an incremented stage number for the currently selected channel object. return a -1 on failure


setPreferredStageNumber

public void setPreferredStageNumber(int stageNumber)
sets the preferred stage number of any new response objects created. when not in use, set the preferred stage number to -1.


getNewDictionaryCode

public int getNewDictionaryCode(int type,
                                PdccObject dictionaryCategoryNode)
get the incremental lookup code for a new dictionary blockette of a given type for the dictonary category node (type -12) provided return a 1 on failure -- non fatal response


setPreferredDictionaryCode

public void setPreferredDictionaryCode(int code)
sets the preferred dictionary lookup code for any new dictionary nodes created. When not in use, set the preferred code to -1.


keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Implements Keylistener method

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Implements Keylistener method

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Implements Keylistener method

Specified by:
keyTyped in interface java.awt.event.KeyListener

getDictionaryNode

public PdccObject getDictionaryNode(PdccObject startNode)
find and return the dictionary category node (type -12) that belongs to the volume that startNode is in. return null on failure


getNewPdccObject

public PdccObject getNewPdccObject(java.lang.Object srcObj)
                            throws java.lang.Exception
returns new concrete instance of a PdccObject. the concrete type is determined by the type of srcObj. srcObj == blockette --> return PdccBlocketteObject srcObj == Vector --> return PdccTreeNodeObject

Throws:
java.lang.Exception

update

public void update(edu.iris.dmc.isis.Editable editable)
Specified by:
update in interface edu.iris.dmc.isis.UpdateListener

updateNavTree

public void updateNavTree(edu.iris.dmc.isis.Editable editable)
Like update(), but update the graphics for just the Navigation tree

Parameters:
editable -


brought to you by Incorporated Research Institutions for Seismology
June 29 2006