|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.opensourcephysics.tools.LibraryTreePanel
public class LibraryTreePanel
This is a JPanel that displays an OSP LibraryCollection in a tree.
| 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. |
| 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 javax.swing.JTextField |
basePathField
|
protected javax.swing.JLabel |
basePathLabel
|
protected LibraryBrowser |
browser
|
protected static javax.swing.JFileChooser |
chooser
|
protected LibraryCollection |
collection
|
protected java.lang.String |
command
|
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 boolean |
editing
|
protected javax.swing.JToolBar |
editorbar
|
protected javax.swing.Box |
editorPanel
|
protected LibraryTreePanel.HTMLPane |
emptyHTMLPane
|
protected javax.swing.Box |
fileBox
|
protected static javax.swing.filechooser.FileFilter |
folderFilter
|
protected javax.swing.JTextField |
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 |
isCollectionChanged
|
protected java.util.ArrayList<javax.swing.JLabel> |
labels
|
protected static java.awt.Color |
lightGreen
|
protected static java.awt.Color |
lightRed
|
protected javax.swing.Action |
moveDownAction
|
protected javax.swing.JButton |
moveDownButton
|
protected javax.swing.Action |
moveUpAction
|
protected javax.swing.JButton |
moveUpButton
|
protected javax.swing.JTextField |
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 javax.swing.Action |
pasteAction
|
protected javax.swing.JButton |
pasteButton
|
protected XMLControl |
pasteControl
|
protected java.lang.String |
pathToCollection
|
protected javax.swing.JPopupMenu |
popup
|
protected XMLControl |
revertControl
|
protected LibraryTreeNode |
rootNode
|
protected javax.swing.JSplitPane |
splitPane
|
protected javax.swing.JTextField |
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
|
| 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 void |
collectionChanged()
Called whenever the collection changes due to a user edit. |
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. |
LibraryCollection |
getCollection()
Gets the collection displayed in the tree. |
protected static javax.swing.JFileChooser |
getFileChooser()
Gets a shared file chooser. |
protected LibraryTreePanel.HTMLPane |
getHTMLPane(LibraryTreeNode node)
Gets the HTMLPane that describes a given tree node. |
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 |
isClipboardPastable()
Determines if the clipboard can be pasted. |
protected boolean |
isCollectionChanged()
Called whenever the collection changes due to a user edit. |
protected boolean |
isEditable()
Returns true if the collection is editable. |
protected boolean |
isEditing()
Gets the editing state. |
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 void |
save()
Saves the current collection. |
protected boolean |
saveChanges(java.lang.String name)
Gives the user an opportunity to save changes. |
void |
setCollection(LibraryCollection collection,
java.lang.String path,
boolean editable)
Sets the collection displayed in the tree. |
protected void |
setEditing(boolean edit)
Sets the editing state. |
protected void |
setSelectedNode(LibraryTreeNode node)
Sets the selected 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 |
|---|
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 LibraryCollection collection
protected java.lang.String pathToCollection
protected LibraryTreeNode rootNode
protected javax.swing.tree.DefaultTreeModel treeModel
protected javax.swing.JTree tree
protected javax.swing.JScrollPane treeScroller
protected javax.swing.JScrollPane htmlScroller
protected javax.swing.JToolBar editorbar
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.Box editorPanel
protected javax.swing.Box fileBox
protected javax.swing.JPanel displayPanel
protected LibraryTreePanel.HTMLPane emptyHTMLPane
protected javax.swing.JSplitPane splitPane
protected javax.swing.JTextField nameField
protected javax.swing.JTextField htmlField
protected javax.swing.JTextField basePathField
protected javax.swing.JTextField targetField
protected javax.swing.JLabel nameLabel
protected javax.swing.JLabel htmlLabel
protected javax.swing.JLabel basePathLabel
protected javax.swing.JLabel targetLabel
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 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 XMLControl pasteControl
protected boolean editing
protected boolean isCollectionChanged
protected XMLControl revertControl
protected int typeFieldWidth
protected java.lang.String command
| Constructor Detail |
|---|
public LibraryTreePanel(LibraryBrowser browser)
browser - the LibraryBrowser that will display this panel| Method Detail |
|---|
public void setCollection(LibraryCollection collection,
java.lang.String path,
boolean editable)
collection - the collectionpath - the collection xml file patheditable - true if the collection is user-editablepublic LibraryCollection getCollection()
protected LibraryTreeNode getSelectedNode()
protected void setSelectedNode(LibraryTreeNode node)
node - the node to selectprotected 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 LibraryTreePanel.HTMLPane getHTMLPane(LibraryTreeNode node)
node - the node
protected 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 node
protected 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 collectionChanged()
protected boolean isCollectionChanged()
protected void save()
protected boolean saveChanges(java.lang.String name)
false if the user cancels, otherwise trueprotected static javax.swing.JFileChooser getFileChooser()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||