jsky.catalog.gui
Class CatalogTree

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 jsky.catalog.gui.CatalogTree
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, QueryResultDisplay, QueryResultHandler

public class CatalogTree
extends javax.swing.JPanel
implements QueryResultDisplay, QueryResultHandler

Used to display a catalog hierarchy.

See Also:
Serialized Form

Nested Class Summary
 
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.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
 
Constructor Summary
CatalogTree(CatalogDirectory catDir)
          Create a CatalogTree and display the given catalog directory hierarchy
 
Method Summary
 void addQueryResult(QueryResult queryResult)
          Add the given query result to the tree at the currently selected node.
 void copy()
          Copy the selected catalog to the clipboard.
 void cut()
          Cut the selected catalog to the clipboard.
 javax.swing.AbstractAction getCopyAction()
           
 javax.swing.AbstractAction getCutAction()
           
 javax.swing.AbstractAction getMoveDownAction()
           
 javax.swing.AbstractAction getMoveUpAction()
           
 javax.swing.AbstractAction getPasteAction()
           
 QueryResult getQueryResult()
          Return a reference to the QueryResult being displayed (in this case, it should be a CatalogDirectory object of some kind).
 QueryResult getQueryResult(java.net.URL url)
          This method is called in a background thread to get the contents of the given URL and return a QueryResult object representing it.
 QueryResultDisplay getQueryResultDisplay()
          Return the object used to display leaf items, such as tables, etc.
 Catalog getSelectedNode()
          Return the currently selected tree node
 javax.swing.AbstractAction getToBottomAction()
           
 javax.swing.AbstractAction getToTopAction()
           
 javax.swing.JTree getTree()
          Return the internal JTree
static void main(java.lang.String[] args)
          test main
 javax.swing.JMenuItem makeReloadMenuItem()
          Return a menu item to reload the catalog config file and rebuild the tree with the new data.
 void moveNode(boolean up)
          Move the the selected catalog up or down in the tree.
 void moveNodeToEnd(boolean up)
          Move the the selected catalog all the way up or down in the tree, as far as possible.
 void paste()
          Paste the selected catalog from the clipboard.
 void reload()
          If there is a URL corresponding to the root node, read it again and rebuild the tree (in case the file changed...).
 void selectNode(Catalog node)
          Select the given tree node
 void setHTMLQueryResultHandler(HTMLQueryResultHandler handler)
          Optional handler, used to report HTML format errors from servers
 void setQueryResult(QueryResult queryResult)
          Display the tree structure of the given query result, which may be either a CatalogDirectory or a URLQueryResult, where an HTTP get of the URL returns a CatalogDirectory.
 void setQueryResultDisplay(QueryResultDisplay q)
          Set the object used to display leaf items, such as tables, etc.
 
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, 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
 

Constructor Detail

CatalogTree

public CatalogTree(CatalogDirectory catDir)
Create a CatalogTree and display the given catalog directory hierarchy

Method Detail

setHTMLQueryResultHandler

public void setHTMLQueryResultHandler(HTMLQueryResultHandler handler)
Optional handler, used to report HTML format errors from servers


setQueryResultDisplay

public void setQueryResultDisplay(QueryResultDisplay q)
Set the object used to display leaf items, such as tables, etc.


getQueryResultDisplay

public QueryResultDisplay getQueryResultDisplay()
Return the object used to display leaf items, such as tables, etc.


getTree

public javax.swing.JTree getTree()
Return the internal JTree


setQueryResult

public void setQueryResult(QueryResult queryResult)
Display the tree structure of the given query result, which may be either a CatalogDirectory or a URLQueryResult, where an HTTP get of the URL returns a CatalogDirectory.

Specified by:
setQueryResult in interface QueryResultDisplay

getQueryResult

public QueryResult getQueryResult()
Return a reference to the QueryResult being displayed (in this case, it should be a CatalogDirectory object of some kind).


selectNode

public void selectNode(Catalog node)
Select the given tree node


getSelectedNode

public Catalog getSelectedNode()
Return the currently selected tree node


addQueryResult

public void addQueryResult(QueryResult queryResult)
Add the given query result to the tree at the currently selected node.


makeReloadMenuItem

public javax.swing.JMenuItem makeReloadMenuItem()
Return a menu item to reload the catalog config file and rebuild the tree with the new data.


reload

public void reload()
If there is a URL corresponding to the root node, read it again and rebuild the tree (in case the file changed...).


getQueryResult

public QueryResult getQueryResult(java.net.URL url)
                           throws java.io.IOException
This method is called in a background thread to get the contents of the given URL and return a QueryResult object representing it.

Specified by:
getQueryResult in interface QueryResultHandler
Throws:
java.io.IOException

cut

public void cut()
Cut the selected catalog to the clipboard.


copy

public void copy()
Copy the selected catalog to the clipboard.


paste

public void paste()
Paste the selected catalog from the clipboard.


moveNode

public void moveNode(boolean up)
Move the the selected catalog up or down in the tree.


moveNodeToEnd

public void moveNodeToEnd(boolean up)
Move the the selected catalog all the way up or down in the tree, as far as possible.


getCutAction

public javax.swing.AbstractAction getCutAction()

getCopyAction

public javax.swing.AbstractAction getCopyAction()

getPasteAction

public javax.swing.AbstractAction getPasteAction()

getMoveUpAction

public javax.swing.AbstractAction getMoveUpAction()

getMoveDownAction

public javax.swing.AbstractAction getMoveDownAction()

getToTopAction

public javax.swing.AbstractAction getToTopAction()

getToBottomAction

public javax.swing.AbstractAction getToBottomAction()

main

public static void main(java.lang.String[] args)
test main