Package jmri.jmrit.catalog
Class CatalogPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jmri.jmrit.catalog.CatalogPanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
Create a JPanel containing trees of resources to replace default icons. The
panel also displays image files contained in a node of a tree. Drag and
Drop is implemented to drag a display of an icon to the display of an icon
that may be added to the panel.
This panel is used in the Icon Editors and also in the ImageIndexEditor.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) classclass(package private) classclassNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BufferedImage[]Array of BufferedImage backgrounds loaded as background image in Preview.(package private) static Color(package private) static Color(package private) JScrollPaneprotected ImagePanel(package private) JLabelprotected Color[]static final intstatic final doublestatic final intFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTree(CatalogTree tree) Extend the Catalog by adding a tree to the root.voidcreateNewBranch(String systemName, String userName, String path) Create a new model and add it to the main root.voidgetIcon()static FramegetParentFrame(Component comp) Allows ItemPalette to set the preview panel background to match that of the icon set being edited.protected CatalogTreeNodeReturn the node the user has selected.protected JTreegetTree()For Index Editor to able to edit its treeprotected booleaninsertNodeIntoModel(String name, CatalogTreeNode parent) Insert a new node into the displayed tree.static CatalogPanelmakeCatalog(String label1, String label2, boolean addButtonPanel, boolean treeDnD, boolean dragIcons) Create a named icon catalog split pane.static CatalogPanelstatic CatalogPanelmakeDefaultCatalog(boolean addButtonPanel, boolean treeDrop, boolean dragIcon) static voidpackParentFrame(Component comp) static StringprintDbl(double z, int decimalPlaces) Utility returning a number as a string.protected voidDelete a node from the displayed tree.protected booleanrenameNode(CatalogTreeNode node, String name) Make a change to a node in the displayed tree.protected voidprotected voidscrollPathToVisible(String[] names) voidprotected voidprotected voidvoidsetToolTipText(String tip) voidMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, 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, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods 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, transferFocusDownCycle, validate, validateTreeMethods 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, 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
-
Field Details
-
ICON_SCALE
- See Also:
-
ICON_WIDTH
- See Also:
-
ICON_HEIGHT
- See Also:
-
_grayColor
-
_darkGrayColor
-
colorChoice
-
_backgrounds
Array of BufferedImage backgrounds loaded as background image in Preview. -
_iconPane
-
_previewLabel
-
_preview
-
-
Method Details
-
setToolTipText
- Overrides:
setToolTipTextin classJComponent
-
setParent
-
updatePanel
-
createNewBranch
Create a new model and add it to the main root.Can be called from off the GUI thread.
- Parameters:
systemName- the system name for the cataloguserName- the user name for the catalogpath- the path on the new branch
-
getTree
For Index Editor to able to edit its tree- Returns:
- tree
-
addTree
Extend the Catalog by adding a tree to the root.- Parameters:
tree- the tree to add to the catalog
-
insertNodeIntoModel
Insert a new node into the displayed tree.- Parameters:
name- the name of the new nodeparent- the parent of name- Returns:
- true if the node was inserted
-
removeNodeFromModel
Delete a node from the displayed tree.- Parameters:
node- the node to delete
-
renameNode
Make a change to a node in the displayed tree. Either its name or the contents of its leaves (image references).- Parameters:
node- the node to changename- new name for the node- Returns:
- true if the change was successful
-
getPreviewPanel
Allows ItemPalette to set the preview panel background to match that of the icon set being edited.- Returns:
- Preview panel
-
resetPanel
-
getIcon
-
deselectIcon
-
setSelection
-
makeDefaultCatalog
-
makeDefaultCatalog
public static CatalogPanel makeDefaultCatalog(boolean addButtonPanel, boolean treeDrop, boolean dragIcon) -
makeCatalog
public static CatalogPanel makeCatalog(String label1, String label2, boolean addButtonPanel, boolean treeDnD, boolean dragIcons) Create a named icon catalog split pane. Make sure both properties keys exist.- Parameters:
label1- properties key to be used as the label for the icon treelabel2- properties key to be used as the instructionaddButtonPanel- adds background select comboBoxtreeDnD- true allows dropping into tree or paneldragIcons- true allows dragging icons from panel- Returns:
- the created CatalogPanel
-
getParentFrame
-
packParentFrame
-
printDbl
Utility returning a number as a string.- Parameters:
z- doubledecimalPlaces- number of decimal places- Returns:
- String a formatted number
-
setSelectedNode
-
scrollPathToVisible
-
getSelectedNode
Return the node the user has selected.- Returns:
- CatalogTreeNode
-