Class CatalogPanel

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public class CatalogPanel
    extends javax.swing.JPanel
    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:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  CatalogPanel.DropJTree  
      (package private) class  CatalogPanel.DropOnPanelToNode  
      class  CatalogPanel.IconDisplayPanel  
      (package private) class  CatalogPanel.IconListener  
      class  CatalogPanel.MemoryExceptionHandler  
      • 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

      Fields 
      Modifier and Type Field Description
      protected java.awt.image.BufferedImage[] _backgrounds
      Array of BufferedImage backgrounds loaded as background image in Preview.
      (package private) static java.awt.Color _darkGrayColor  
      (package private) static java.awt.Color _grayColor  
      (package private) javax.swing.JScrollPane _iconPane  
      protected ImagePanel _preview  
      (package private) javax.swing.JLabel _previewLabel  
      protected java.awt.Color[] colorChoice  
      static int ICON_HEIGHT  
      static double ICON_SCALE  
      static int ICON_WIDTH  
      • Fields inherited from class javax.swing.JComponent

        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

        accessibleContext, 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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTree​(CatalogTree tree)
      Extend the Catalog by adding a tree to the root.
      void createNewBranch​(java.lang.String systemName, java.lang.String userName, java.lang.String path)
      Create a new model and add it to the main root.
      void deselectIcon()  
      NamedIcon getIcon()  
      static java.awt.Frame getParentFrame​(java.awt.Component comp)  
      ImagePanel getPreviewPanel()
      Allows ItemPalette to set the preview panel background to match that of the icon set being edited.
      protected CatalogTreeNode getSelectedNode()
      Return the node the user has selected.
      protected javax.swing.JTree getTree()
      For Index Editor to able to edit its tree
      protected boolean insertNodeIntoModel​(java.lang.String name, CatalogTreeNode parent)
      Insert a new node into the displayed tree.
      static CatalogPanel makeCatalog​(java.lang.String label1, java.lang.String label2, boolean addButtonPanel, boolean treeDnD, boolean dragIcons)
      Create a named icon catalog split pane.
      static CatalogPanel makeDefaultCatalog()  
      static CatalogPanel makeDefaultCatalog​(boolean addButtonPanel, boolean treeDrop, boolean dragIcon)  
      static void packParentFrame​(java.awt.Component comp)  
      static java.lang.String printDbl​(double z, int decimalPlaces)
      Utility returning a number as a string.
      protected void removeNodeFromModel​(CatalogTreeNode node)
      Delete a node from the displayed tree.
      protected boolean renameNode​(CatalogTreeNode node, java.lang.String name)
      Make a change to a node in the displayed tree.
      protected void resetPanel()  
      protected void scrollPathToVisible​(java.lang.String[] names)  
      void setParent​(IconItemPanel p)  
      protected void setSelectedNode​(CatalogTreeNode node)  
      protected void setSelection​(CatalogPanel.IconDisplayPanel panel)  
      void setToolTipText​(java.lang.String tip)  
      void updatePanel()  
      • 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, 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, 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, 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, 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • setToolTipText

        public void setToolTipText​(java.lang.String tip)
        Overrides:
        setToolTipText in class javax.swing.JComponent
      • createNewBranch

        public void createNewBranch​(java.lang.String systemName,
                                    java.lang.String userName,
                                    java.lang.String path)
        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 catalog
        userName - the user name for the catalog
        path - the path on the new branch
      • getTree

        protected javax.swing.JTree getTree()
        For Index Editor to able to edit its tree
        Returns:
        tree
      • addTree

        public void addTree​(CatalogTree tree)
        Extend the Catalog by adding a tree to the root.
        Parameters:
        tree - the tree to add to the catalog
      • insertNodeIntoModel

        protected boolean insertNodeIntoModel​(java.lang.String name,
                                              CatalogTreeNode parent)
        Insert a new node into the displayed tree.
        Parameters:
        name - the name of the new node
        parent - the parent of name
        Returns:
        true if the node was inserted
      • renameNode

        protected boolean renameNode​(CatalogTreeNode node,
                                     java.lang.String name)
        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 change
        name - new name for the node
        Returns:
        true if the change was successful
      • getPreviewPanel

        public ImagePanel getPreviewPanel()
        Allows ItemPalette to set the preview panel background to match that of the icon set being edited.
        Returns:
        Preview panel
      • makeCatalog

        public static CatalogPanel makeCatalog​(java.lang.String label1,
                                               java.lang.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 tree
        label2 - properties key to be used as the instruction
        addButtonPanel - adds background select comboBox
        treeDnD - true allows dropping into tree or panel
        dragIcons - true allows dragging icons from panel
        Returns:
        the created CatalogPanel
      • getParentFrame

        public static java.awt.Frame getParentFrame​(java.awt.Component comp)
      • packParentFrame

        public static void packParentFrame​(java.awt.Component comp)
      • printDbl

        public static java.lang.String printDbl​(double z,
                                                int decimalPlaces)
        Utility returning a number as a string.
        Parameters:
        z - double
        decimalPlaces - number of decimal places
        Returns:
        String a formatted number