org.opensourcephysics.tools
Class LibraryTreePanel

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.opensourcephysics.tools.LibraryTreePanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class LibraryTreePanel
extends javax.swing.JPanel

This is a JPanel that displays an OSP LibraryResource at the root of a tree. If the resource is a LibraryCollection, the tree is populated with its child resources.

Author:
Douglas Brown
See Also:
Serialized Form

Nested Class Summary
protected static class LibraryTreePanel.EntryField
          A JTextField for editing LibraryTreeNode data.
protected static class LibraryTreePanel.HTMLPane
          A JTextPane that displays html pages for LibraryTreeNodes.
protected  class LibraryTreePanel.LibraryTreeNodeRenderer
          A tree node renderer to render LibraryTreeNodes.
protected  class LibraryTreePanel.MetadataComboBoxEditor
          An editor for Metadata objects.
protected  class LibraryTreePanel.MetadataComboBoxModel
          A ComboBoxModel for metadata.
protected  class LibraryTreePanel.MetadataComboBoxRenderer
          A renderer for Metadata objects.
protected  class LibraryTreePanel.MetadataEditField
          An EntryField for editing Metadata.
 
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
protected  javax.swing.Action addCollectionAction
           
protected  javax.swing.JButton addCollectionButton
           
protected  javax.swing.Action addResourceAction
           
protected  javax.swing.JButton addResourceButton
           
protected  java.lang.String AND
           
protected  javax.swing.Box authorBox
           
protected  LibraryTreePanel.EntryField authorField
           
protected  javax.swing.JLabel authorLabel
           
protected  LibraryTreePanel.EntryField basePathField
           
protected  javax.swing.JLabel basePathLabel
           
protected  LibraryBrowser browser
           
protected static javax.swing.JFileChooser chooser
           
protected  java.lang.String CLOSING
           
protected  java.lang.String command
           
protected  javax.swing.Box contactBox
           
protected  LibraryTreePanel.EntryField contactField
           
protected  javax.swing.JLabel contactLabel
           
protected  java.awt.event.MouseAdapter convertPathMouseListener
           
protected  javax.swing.Action copyAction
           
protected  javax.swing.JButton copyButton
           
protected  javax.swing.Action cutAction
           
protected  javax.swing.JButton cutButton
           
protected static java.awt.Color darkRed
           
protected static java.awt.Color defaultForeground
           
protected  javax.swing.JPanel displayPanel
           
protected  javax.swing.JToolBar editorbar
           
protected  javax.swing.Box editorPanel
           
protected  LibraryTreePanel.HTMLPane emptyHTMLPane
           
protected  LibraryResource.Metadata emptyMetadata
           
protected  java.util.Set<LibraryTreePanel.EntryField> entryFields
           
protected  javax.swing.Box fileBox
           
protected static javax.swing.filechooser.FileFilter folderFilter
           
protected  LibraryTreePanel.EntryField htmlField
           
protected static javax.swing.filechooser.FileFilter htmlFilter
           
protected  javax.swing.JLabel htmlLabel
           
protected static java.util.HashMap<LibraryTreeNode,LibraryTreePanel.HTMLPane> htmlPanesByNode
           
protected static java.util.HashMap<java.net.URL,LibraryTreePanel.HTMLPane> htmlPanesByURL
           
protected  javax.swing.JScrollPane htmlScroller
           
protected static javax.swing.event.HyperlinkListener hyperlinkListener
           
protected  boolean ignoreChanges
           
protected  boolean isChanged
           
protected  boolean isEditing
           
protected  boolean isXMLPath
           
protected  LibraryTreePanel.MetadataEditField keyEditField
           
protected static int keyFieldWidth
           
protected  javax.swing.Box keywordsBox
           
protected  LibraryTreePanel.EntryField keywordsField
           
protected  javax.swing.JLabel keywordsLabel
           
protected  java.util.ArrayList<javax.swing.JLabel> labels
           
protected static java.awt.Color lightGreen
           
protected static java.awt.Color lightRed
           
protected  javax.swing.Action metadataAction
           
protected  javax.swing.Box metadataBox
           
protected  javax.swing.JButton metadataButton
           
protected  javax.swing.JComboBox metadataDropdown
           
protected  java.awt.event.ActionListener metadataFieldListener
           
protected  javax.swing.JLabel metadataLabel
           
protected  org.opensourcephysics.tools.LibraryTreePanel.MetadataLoader metadataLoader
           
protected  LibraryTreePanel.MetadataComboBoxModel metadataModel
           
protected  javax.swing.Action moveDownAction
           
protected  javax.swing.JButton moveDownButton
           
protected  javax.swing.Action moveUpAction
           
protected  javax.swing.JButton moveUpButton
           
protected  LibraryTreePanel.EntryField nameField
           
protected  javax.swing.JLabel nameLabel
           
protected  javax.swing.JButton openBasePathButton
           
protected  javax.swing.JButton openFileButton
           
protected static javax.swing.Icon openFileIcon
           
protected  javax.swing.JButton openHTMLButton
           
protected  java.lang.String OPENING
           
protected  java.lang.String OR
           
protected  javax.swing.Action pasteAction
           
protected  javax.swing.JButton pasteButton
           
protected  XMLControl pasteControl
           
protected  java.lang.String pathToRoot
           
protected  javax.swing.JPopupMenu popup
           
protected  XMLControl revertControl
           
protected  LibraryTreeNode rootNode
           
protected  LibraryResource rootResource
           
protected  javax.swing.JSplitPane splitPane
           
protected  LibraryTreePanel.EntryField targetField
           
protected  javax.swing.JLabel targetLabel
           
protected  javax.swing.JTree tree
           
protected  javax.swing.tree.DefaultTreeModel treeModel
           
protected  java.awt.event.MouseAdapter treeMouseListener
           
protected  javax.swing.JScrollPane treeScroller
           
protected  javax.swing.event.TreeSelectionListener treeSelectionListener
           
protected  javax.swing.JLabel typeField
           
protected  int typeFieldWidth
           
protected  javax.swing.JLabel typeLabel
           
protected  LibraryTreePanel.MetadataEditField valueEditField
           
 
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
LibraryTreePanel(LibraryBrowser browser)
          Constructs an empty LibraryTreePanel.
 
Method Summary
protected  java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> applyAND(java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results1, java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results2)
          Returns the nodes that are contained in the keysets of both of two input maps.
protected  java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> applyOR(java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results1, java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results2)
          Returns the nodes that are contained in the keysets of either of two input maps.
protected  void createGUI()
          Creates the GUI and listeners.
protected  void createTree(LibraryTreeNode root)
          Creates the tree.
protected  void enableButtons()
          Enables/disables buttons based on selected node and clipboard state.
 LibraryResource getCollection()
          Gets the collection displayed in the tree.
protected static javax.swing.JFileChooser getFileChooser()
          Gets a shared file chooser.
protected  java.lang.String getHTMLBody(java.lang.String path)
          Gets the code from an HTML page.
protected  java.lang.String[] getNextSplit(java.lang.String phrase)
          Returns the phrase before the next AND or OR operator, the operator itself, and the remainder of the phrase.
protected  java.lang.String[] getParenthesisSplit(java.lang.String phrase)
          Returns the phrase enclosed in parentheses along with the remainder of a phrase.
protected  javax.swing.JPopupMenu getPopup(LibraryTreeNode node)
          Returns a popup menu with items appropriate for a given tree node.
protected  LibraryTreeNode getSelectedNode()
          Gets the selected node.
protected  boolean insertChildAt(LibraryTreeNode child, LibraryTreeNode parent, int index)
          Inserts a child into a parent node at a specified index.
protected  boolean isChanged()
          Determines if the resource has been changed since the last save.
protected  boolean isClipboardPastable()
          Determines if the clipboard can be pasted.
protected  boolean isEditable()
          Returns true if the collection is editable.
protected  boolean isEditing()
          Gets the editing state.
protected  void refreshEntryFields()
          Used to refresh the entry fields when the browser closes.
protected  void refreshGUI()
          Refreshes the GUI including locale-dependent resource strings.
protected  void removeNode(LibraryTreeNode node)
          Removes a given tree node.
protected  void revert()
          Discards collection edits and reverts to the previous state.
protected  java.lang.String save()
          Saves the current resource.
protected  boolean saveChanges(java.lang.String name)
          Gives the user an opportunity to save changes.
protected  void setChanged()
          Called whenever a resource changes due to a user edit.
protected  void setEditing(boolean edit)
          Sets the editing state.
protected  void setFontLevel(int level)
          Sets the font level.
 void setRootResource(LibraryResource resource, java.lang.String path, boolean editable, boolean pathIsXML)
          Sets the root resource or collection displayed in the tree.
protected  void setSelectedNode(LibraryTreeNode node)
          Sets the selected node.
protected  void setSelectionPath(java.util.List<java.lang.String> treePath)
          Sets the selection path.
protected  void showHTMLPane(LibraryTreeNode node)
          Displays the HTMLPane for a given tree node.
protected  void showInfo(LibraryTreeNode node)
          Displays the resource data for the specified node.
 
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, 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

AND

protected final java.lang.String AND
See Also:
Constant Field Values

OR

protected final java.lang.String OR
See Also:
Constant Field Values

OPENING

protected final java.lang.String OPENING
See Also:
Constant Field Values

CLOSING

protected final java.lang.String CLOSING
See Also:
Constant Field Values

keyFieldWidth

protected static int keyFieldWidth

lightRed

protected static java.awt.Color lightRed

darkRed

protected static java.awt.Color darkRed

lightGreen

protected static java.awt.Color lightGreen

defaultForeground

protected static java.awt.Color defaultForeground

openFileIcon

protected static javax.swing.Icon openFileIcon

hyperlinkListener

protected static javax.swing.event.HyperlinkListener hyperlinkListener

chooser

protected static javax.swing.JFileChooser chooser

htmlFilter

protected static javax.swing.filechooser.FileFilter htmlFilter

folderFilter

protected static javax.swing.filechooser.FileFilter folderFilter

htmlPanesByURL

protected static java.util.HashMap<java.net.URL,LibraryTreePanel.HTMLPane> htmlPanesByURL

htmlPanesByNode

protected static java.util.HashMap<LibraryTreeNode,LibraryTreePanel.HTMLPane> htmlPanesByNode

browser

protected LibraryBrowser browser

rootResource

protected LibraryResource rootResource

pathToRoot

protected java.lang.String pathToRoot

rootNode

protected LibraryTreeNode rootNode

treeModel

protected javax.swing.tree.DefaultTreeModel treeModel

tree

protected javax.swing.JTree tree

treeScroller

protected javax.swing.JScrollPane treeScroller

htmlScroller

protected javax.swing.JScrollPane htmlScroller

editorbar

protected javax.swing.JToolBar editorbar

cutAction

protected javax.swing.Action cutAction

copyAction

protected javax.swing.Action copyAction

pasteAction

protected javax.swing.Action pasteAction

addCollectionAction

protected javax.swing.Action addCollectionAction

addResourceAction

protected javax.swing.Action addResourceAction

moveUpAction

protected javax.swing.Action moveUpAction

moveDownAction

protected javax.swing.Action moveDownAction

metadataAction

protected javax.swing.Action metadataAction

cutButton

protected javax.swing.JButton cutButton

copyButton

protected javax.swing.JButton copyButton

pasteButton

protected javax.swing.JButton pasteButton

addCollectionButton

protected javax.swing.JButton addCollectionButton

addResourceButton

protected javax.swing.JButton addResourceButton

moveUpButton

protected javax.swing.JButton moveUpButton

moveDownButton

protected javax.swing.JButton moveDownButton

metadataButton

protected javax.swing.JButton metadataButton

editorPanel

protected javax.swing.Box editorPanel

fileBox

protected javax.swing.Box fileBox

displayPanel

protected javax.swing.JPanel displayPanel

emptyHTMLPane

protected LibraryTreePanel.HTMLPane emptyHTMLPane

splitPane

protected javax.swing.JSplitPane splitPane

nameField

protected LibraryTreePanel.EntryField nameField

htmlField

protected LibraryTreePanel.EntryField htmlField

basePathField

protected LibraryTreePanel.EntryField basePathField

targetField

protected LibraryTreePanel.EntryField targetField

nameLabel

protected javax.swing.JLabel nameLabel

htmlLabel

protected javax.swing.JLabel htmlLabel

basePathLabel

protected javax.swing.JLabel basePathLabel

targetLabel

protected javax.swing.JLabel targetLabel

metadataFieldListener

protected java.awt.event.ActionListener metadataFieldListener

authorField

protected LibraryTreePanel.EntryField authorField

contactField

protected LibraryTreePanel.EntryField contactField

keywordsField

protected LibraryTreePanel.EntryField keywordsField

authorLabel

protected javax.swing.JLabel authorLabel

contactLabel

protected javax.swing.JLabel contactLabel

keywordsLabel

protected javax.swing.JLabel keywordsLabel

metadataLabel

protected javax.swing.JLabel metadataLabel

authorBox

protected javax.swing.Box authorBox

contactBox

protected javax.swing.Box contactBox

keywordsBox

protected javax.swing.Box keywordsBox

metadataBox

protected javax.swing.Box metadataBox

metadataModel

protected LibraryTreePanel.MetadataComboBoxModel metadataModel

metadataDropdown

protected javax.swing.JComboBox metadataDropdown

keyEditField

protected LibraryTreePanel.MetadataEditField keyEditField

valueEditField

protected LibraryTreePanel.MetadataEditField valueEditField

typeLabel

protected javax.swing.JLabel typeLabel

typeField

protected javax.swing.JLabel typeField

openHTMLButton

protected javax.swing.JButton openHTMLButton

openBasePathButton

protected javax.swing.JButton openBasePathButton

openFileButton

protected javax.swing.JButton openFileButton

labels

protected java.util.ArrayList<javax.swing.JLabel> labels

popup

protected javax.swing.JPopupMenu popup

treeMouseListener

protected java.awt.event.MouseAdapter treeMouseListener

convertPathMouseListener

protected java.awt.event.MouseAdapter convertPathMouseListener

treeSelectionListener

protected javax.swing.event.TreeSelectionListener treeSelectionListener

pasteControl

protected XMLControl pasteControl

isEditing

protected boolean isEditing

isChanged

protected boolean isChanged

isXMLPath

protected boolean isXMLPath

ignoreChanges

protected boolean ignoreChanges

revertControl

protected XMLControl revertControl

typeFieldWidth

protected int typeFieldWidth

command

protected java.lang.String command

emptyMetadata

protected LibraryResource.Metadata emptyMetadata

metadataLoader

protected org.opensourcephysics.tools.LibraryTreePanel.MetadataLoader metadataLoader

entryFields

protected java.util.Set<LibraryTreePanel.EntryField> entryFields
Constructor Detail

LibraryTreePanel

public LibraryTreePanel(LibraryBrowser browser)
Constructs an empty LibraryTreePanel.

Parameters:
browser - the LibraryBrowser that will display this panel
Method Detail

setRootResource

public void setRootResource(LibraryResource resource,
                            java.lang.String path,
                            boolean editable,
                            boolean pathIsXML)
Sets the root resource or collection displayed in the tree.

Parameters:
resource - the resource
path - the file path to the resource or collection
editable - true if the collection is user-editable
pathIsXML - true if the path points to a DL xml file

getCollection

public LibraryResource getCollection()
Gets the collection displayed in the tree.

Returns:
the collection

getSelectedNode

protected LibraryTreeNode getSelectedNode()
Gets the selected node.

Returns:
the selected node, or null if none

setSelectedNode

protected void setSelectedNode(LibraryTreeNode node)
Sets the selected node.

Parameters:
node - the node to select

setSelectionPath

protected void setSelectionPath(java.util.List<java.lang.String> treePath)
Sets the selection path.

Parameters:
treePath - tree path to select in root-first order (may be null)

setFontLevel

protected void setFontLevel(int level)
Sets the font level.

Parameters:
level - the desired font level

setEditing

protected void setEditing(boolean edit)
Sets the editing state.

Parameters:
edit - true to start editing, false to stop

isEditable

protected boolean isEditable()
Returns true if the collection is editable.

Returns:
true if editable

isEditing

protected boolean isEditing()
Gets the editing state.

Returns:
true if editing

showInfo

protected void showInfo(LibraryTreeNode node)
Displays the resource data for the specified node.

Parameters:
node - the LibraryTreeNode

showHTMLPane

protected void showHTMLPane(LibraryTreeNode node)
Displays the HTMLPane for a given tree node.

Parameters:
node - the node

createGUI

protected void createGUI()
Creates the GUI and listeners.


refreshGUI

protected void refreshGUI()
Refreshes the GUI including locale-dependent resource strings.


enableButtons

protected void enableButtons()
Enables/disables buttons based on selected node and clipboard state.


revert

protected void revert()
Discards collection edits and reverts to the previous state.


createTree

protected void createTree(LibraryTreeNode root)
Creates the tree.

Parameters:
root - the root node

isClipboardPastable

protected boolean isClipboardPastable()
Determines if the clipboard can be pasted.

Returns:
true if the clipboard contains a LibraryTreeNode XMLControl string

getPopup

protected javax.swing.JPopupMenu getPopup(LibraryTreeNode node)
Returns a popup menu with items appropriate for a given tree node.

Parameters:
node - the node
Returns:
the popup menu

insertChildAt

protected boolean insertChildAt(LibraryTreeNode child,
                                LibraryTreeNode parent,
                                int index)
Inserts a child into a parent node at a specified index.

Parameters:
child - the child node
parent - the parent node
index - the index
Returns:
true if added

removeNode

protected void removeNode(LibraryTreeNode node)
Removes a given tree node.

Parameters:
node - the node

setChanged

protected void setChanged()
Called whenever a resource changes due to a user edit.


isChanged

protected boolean isChanged()
Determines if the resource has been changed since the last save.

Returns:
true if changed

save

protected java.lang.String save()
Saves the current resource.

Returns:
the path to the saved file, or null if not saved

saveChanges

protected boolean saveChanges(java.lang.String name)
Gives the user an opportunity to save changes.

Parameters:
name - the name of the collection
Returns:
false if the user cancels, otherwise true

getNextSplit

protected java.lang.String[] getNextSplit(java.lang.String phrase)
Returns the phrase before the next AND or OR operator, the operator itself, and the remainder of the phrase.

Parameters:
phrase - a search phrase
Returns:
String[]

getParenthesisSplit

protected java.lang.String[] getParenthesisSplit(java.lang.String phrase)
Returns the phrase enclosed in parentheses along with the remainder of a phrase.

Parameters:
phrase - a phrase that starts immediately AFTER an opening parenthesis
Returns:
String[] {the enclosed phrase, the remainder}

applyAND

protected java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> applyAND(java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results1,
                                                                                     java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results2)
Returns the nodes that are contained in the keysets of both of two input maps.

Parameters:
results1 -
results2 -
Returns:
map of nodes found in both keysets

applyOR

protected java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> applyOR(java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results1,
                                                                                    java.util.Map<LibraryTreeNode,java.util.List<java.lang.String[]>> results2)
Returns the nodes that are contained in the keysets of either of two input maps.

Parameters:
results1 -
results2 -
Returns:
map of nodes found in either keyset

getHTMLBody

protected java.lang.String getHTMLBody(java.lang.String path)
Gets the code from an HTML page.

Parameters:
path - the HTML path
Returns:
the body of the HTML

refreshEntryFields

protected void refreshEntryFields()
Used to refresh the entry fields when the browser closes.


getFileChooser

protected static javax.swing.JFileChooser getFileChooser()
Gets a shared file chooser.

Returns:
the file chooser