public class LibraryTreePanel
extends javax.swing.JPanel
Modifier and Type | Class | Description |
---|---|---|
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.
|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
java.awt.Container.AccessibleAWTContainer
Modifier and Type | Field | Description |
---|---|---|
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 LibraryTreePanel.LibraryTreeNodeRenderer |
treeNodeRenderer |
|
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 |
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor | Description |
---|---|
LibraryTreePanel(LibraryBrowser browser) |
Constructs an empty LibraryTreePanel.
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
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
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
protected final java.lang.String AND
protected final java.lang.String OR
protected final java.lang.String OPENING
protected final java.lang.String CLOSING
protected static int keyFieldWidth
protected static java.awt.Color lightRed
protected static java.awt.Color darkRed
protected static java.awt.Color lightGreen
protected static java.awt.Color defaultForeground
protected static javax.swing.Icon openFileIcon
protected static javax.swing.event.HyperlinkListener hyperlinkListener
protected static javax.swing.JFileChooser chooser
protected static javax.swing.filechooser.FileFilter htmlFilter
protected static javax.swing.filechooser.FileFilter folderFilter
protected static java.util.HashMap<java.net.URL,LibraryTreePanel.HTMLPane> htmlPanesByURL
protected static java.util.HashMap<LibraryTreeNode,LibraryTreePanel.HTMLPane> htmlPanesByNode
protected LibraryBrowser browser
protected LibraryResource rootResource
protected java.lang.String pathToRoot
protected LibraryTreeNode rootNode
protected javax.swing.tree.DefaultTreeModel treeModel
protected LibraryTreePanel.LibraryTreeNodeRenderer treeNodeRenderer
protected javax.swing.JTree tree
protected javax.swing.JScrollPane treeScroller
protected javax.swing.JScrollPane htmlScroller
protected javax.swing.JToolBar editorbar
protected javax.swing.Action cutAction
protected javax.swing.Action copyAction
protected javax.swing.Action pasteAction
protected javax.swing.Action addCollectionAction
protected javax.swing.Action addResourceAction
protected javax.swing.Action moveUpAction
protected javax.swing.Action moveDownAction
protected javax.swing.Action metadataAction
protected javax.swing.JButton cutButton
protected javax.swing.JButton copyButton
protected javax.swing.JButton pasteButton
protected javax.swing.JButton addCollectionButton
protected javax.swing.JButton addResourceButton
protected javax.swing.JButton moveUpButton
protected javax.swing.JButton moveDownButton
protected javax.swing.JButton metadataButton
protected javax.swing.Box editorPanel
protected javax.swing.Box fileBox
protected javax.swing.JPanel displayPanel
protected LibraryTreePanel.HTMLPane emptyHTMLPane
protected javax.swing.JSplitPane splitPane
protected LibraryTreePanel.EntryField nameField
protected LibraryTreePanel.EntryField htmlField
protected LibraryTreePanel.EntryField basePathField
protected LibraryTreePanel.EntryField targetField
protected javax.swing.JLabel nameLabel
protected javax.swing.JLabel htmlLabel
protected javax.swing.JLabel basePathLabel
protected javax.swing.JLabel targetLabel
protected java.awt.event.ActionListener metadataFieldListener
protected LibraryTreePanel.EntryField authorField
protected LibraryTreePanel.EntryField contactField
protected LibraryTreePanel.EntryField keywordsField
protected javax.swing.JLabel authorLabel
protected javax.swing.JLabel contactLabel
protected javax.swing.JLabel keywordsLabel
protected javax.swing.JLabel metadataLabel
protected javax.swing.Box authorBox
protected javax.swing.Box contactBox
protected javax.swing.Box keywordsBox
protected javax.swing.Box metadataBox
protected LibraryTreePanel.MetadataComboBoxModel metadataModel
protected javax.swing.JComboBox metadataDropdown
protected LibraryTreePanel.MetadataEditField keyEditField
protected LibraryTreePanel.MetadataEditField valueEditField
protected javax.swing.JLabel typeLabel
protected javax.swing.JLabel typeField
protected javax.swing.JButton openHTMLButton
protected javax.swing.JButton openBasePathButton
protected javax.swing.JButton openFileButton
protected java.util.ArrayList<javax.swing.JLabel> labels
protected javax.swing.JPopupMenu popup
protected java.awt.event.MouseAdapter treeMouseListener
protected java.awt.event.MouseAdapter convertPathMouseListener
protected javax.swing.event.TreeSelectionListener treeSelectionListener
protected XMLControl pasteControl
protected boolean isEditing
protected boolean isChanged
protected boolean isXMLPath
protected boolean ignoreChanges
protected XMLControl revertControl
protected int typeFieldWidth
protected java.lang.String command
protected LibraryResource.Metadata emptyMetadata
protected org.opensourcephysics.tools.LibraryTreePanel.MetadataLoader metadataLoader
protected java.util.Set<LibraryTreePanel.EntryField> entryFields
public LibraryTreePanel(LibraryBrowser browser)
browser
- the LibraryBrowser that will display this panelpublic void setRootResource(LibraryResource resource, java.lang.String path, boolean editable, boolean pathIsXML)
resource
- the resourcepath
- the file path to the resource or collectioneditable
- true if the collection is user-editablepathIsXML
- true if the path points to a DL xml filepublic LibraryResource getCollection()
protected LibraryTreeNode getSelectedNode()
protected void setSelectedNode(LibraryTreeNode node)
node
- the node to selectprotected void setSelectionPath(java.util.List<java.lang.String> treePath)
treePath
- tree path to select in root-first order (may be null)protected void setFontLevel(int level)
level
- the desired font levelprotected void setEditing(boolean edit)
edit
- true to start editing, false to stopprotected boolean isEditable()
protected boolean isEditing()
protected void showInfo(LibraryTreeNode node)
node
- the LibraryTreeNodeprotected void showHTMLPane(LibraryTreeNode node)
node
- the nodeprotected void createGUI()
protected void refreshGUI()
protected void enableButtons()
protected void revert()
protected void createTree(LibraryTreeNode root)
root
- the root nodeprotected boolean isClipboardPastable()
protected javax.swing.JPopupMenu getPopup(LibraryTreeNode node)
node
- the nodeprotected boolean insertChildAt(LibraryTreeNode child, LibraryTreeNode parent, int index)
child
- the child nodeparent
- the parent nodeindex
- the indexprotected void removeNode(LibraryTreeNode node)
node
- the nodeprotected void setChanged()
protected boolean isChanged()
protected java.lang.String save()
protected boolean saveChanges(java.lang.String name)
name
- the name of the collectionfalse
if the user cancels, otherwise true
protected java.lang.String[] getNextSplit(java.lang.String phrase)
phrase
- a search phraseprotected java.lang.String[] getParenthesisSplit(java.lang.String phrase)
phrase
- a phrase that starts immediately AFTER an opening parenthesisprotected 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)
results1
- results2
- 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)
results1
- results2
- protected java.lang.String getHTMLBody(java.lang.String path)
path
- the HTML pathprotected void refreshEntryFields()
protected static javax.swing.JFileChooser getFileChooser()