Package jmri.jmrit.display.palette
Class ItemPalette
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- jmri.util.JmriJFrame
-
- jmri.jmrit.display.DisplayFrame
-
- jmri.jmrit.display.palette.ItemPalette
-
- All Implemented Interfaces:
java.awt.event.ComponentListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.event.ChangeListener
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
,BeanInterface
,ModifiedFlag
,WindowInterface
public class ItemPalette extends DisplayFrame implements javax.swing.event.ChangeListener
Container for adding items to Control Panels. Starting point for palette package.Loads and stores icons used in Control Panel Editor panels. For background colors to work on a particular editor instance, select the 'Item Palette' item under 'Add Items' menu and configure the 'Backgrounds' tab ItemPalette for that editor. Otherwise any item can be dragged and dropped to any editor.
The icons are displayed on the background of the last editor to call the ItemPalette instance. In session the user can set it to another color or a white/gray squares pattern using the "View on:" combo. This choice is shared across tabs as a field on the
DisplayFrame
parent frame.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.util.JmriJFrame
JmriJFrame.ScreenDimensions
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
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
-
Nested classes/interfaces inherited from interface jmri.util.swing.WindowInterface
WindowInterface.Hint
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.HashMap<java.lang.String,ItemPanel>
_tabIndex
(package private) static javax.swing.JTabbedPane
_tabPane
(package private) static java.lang.String
RED_X
static int
STRUT_SIZE
-
Fields inherited from class jmri.util.JmriJFrame
allowInFrameServlet, properties, reuseFrameSavedPosition, reuseFrameSavedSized, windowInterface
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description ItemPalette(java.lang.String title, Editor ed)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean
addFamily(java.lang.String type, java.lang.String family, java.util.HashMap<java.lang.String,NamedIcon> iconMap)
Add a new Family of icons to the device type.(package private) static void
addItemTab(ItemPanel itemPanel, java.lang.String key, java.lang.String tabTitle)
protected static boolean
addLevel4Family(java.lang.String type, java.lang.String family, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> iconMap)
************ Currently only needed for IndicatorTO type **************protected static void
addLevel4FamilyMap(java.lang.String type, java.lang.String family, java.lang.String key, java.util.HashMap<java.lang.String,NamedIcon> iconMap)
(package private) static void
buildTabPane(ItemPalette palette)
protected static java.util.HashMap<java.lang.String,NamedIcon>
cloneMap(java.util.HashMap<java.lang.String,NamedIcon> map)
static java.lang.String
convertText(java.lang.String name)
Default key names as listed in defaultPanelIcons.xml are Bundle keys and nodes in the CatalogTree.static ItemPalette
getDefault(java.lang.String title, Editor ed)
(package private) static java.util.List<org.jdom2.Element>
getDefaultIconItemTypes()
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>
getFamilyMaps(java.lang.String type)
Get all the Families of icons for a given device type.static java.util.HashMap<java.lang.String,NamedIcon>
getIconMap(java.lang.String type, java.lang.String family)
protected static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>
getLevel4Family(java.lang.String type, java.lang.String family)
protected static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>>
getLevel4FamilyMaps(java.lang.String type)
(package private) static int
getTabWidth()
(package private) static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>
loadDefaultFamilyMap(java.util.List<org.jdom2.Element> families, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> familyMap)
(package private) static void
loadDefaultIcons()
(package private) static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>>
loadDefaultIndicatorTOMap(java.util.List<org.jdom2.Element> typeList, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>> familyTOMap)
(package private) static void
loadFamilies(java.lang.String typeName, java.util.List<org.jdom2.Element> families)
(package private) static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>
loadFamilyMap(CatalogTreeNode node)
static void
loadIcons()
(package private) static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>>
loadIndicatorFamilyMap(CatalogTreeNode node)
static void
loadMissingItemType(java.lang.String itemType)
(package private) static boolean
loadSavedIcons()
protected static void
removeIconMap(java.lang.String type, java.lang.String family)
Remove a Family of icons from the device type.protected static void
removeLevel4IconMap(java.lang.String type, java.lang.String family, java.lang.String key)
void
setEditor(Editor ed)
(package private) static void
setTabs()
void
stateChanged(javax.swing.event.ChangeEvent e)
(package private) static CatalogTreeNode
store3levelMap(java.lang.String type, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> familyMap)
static void
storeIcons()
Store palette icons in preferences file catalogTrees.xml-
Methods inherited from class jmri.jmrit.display.DisplayFrame
getBackground, getCurrentColor, getEditor, getPreviewBackground, getPreviewBg, reSize, setPreviewBg, updateBackground
-
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, componentHidden, componentMoved, componentResized, componentShown, dispose, generateWindowRef, getAllowInFrameServlet, getEscapeKeyAction, getEscapeKeyClosesWindow, getFrame, getFrame, getFrameList, getFrameList, getIndexedProperty, getMaximumSize, getModifiedFlag, getPreferredSize, getProperty, getPropertyNames, getSavePosition, getSaveSize, getScreenDimensions, getWindowFrameRef, getWindowInterface, handleModified, hasIndexedProperty, hasProperty, initComponents, makePrivateWindow, markWindowModified, multipleInstances, pack, setAllowInFrameServlet, setEscapeKeyAction, setEscapeKeyClosesWindow, setFrameLocation, setIndexedProperty, setModifiedFlag, setProperty, setSavePosition, setSaveSize, setShutDownTask, setWindowInterface, show, show, storeValues, undecorate, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
STRUT_SIZE
public static final int STRUT_SIZE
- See Also:
- Constant Field Values
-
RED_X
static final java.lang.String RED_X
- See Also:
- Constant Field Values
-
_tabPane
static javax.swing.JTabbedPane _tabPane
-
-
Constructor Detail
-
ItemPalette
public ItemPalette(java.lang.String title, Editor ed)
-
-
Method Detail
-
storeIcons
public static void storeIcons()
Store palette icons in preferences file catalogTrees.xml
-
store3levelMap
static CatalogTreeNode store3levelMap(java.lang.String type, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> familyMap)
-
loadIcons
public static void loadIcons()
-
loadSavedIcons
static boolean loadSavedIcons()
-
loadIndicatorFamilyMap
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>> loadIndicatorFamilyMap(CatalogTreeNode node)
-
loadFamilyMap
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> loadFamilyMap(CatalogTreeNode node)
-
getDefaultIconItemTypes
static java.util.List<org.jdom2.Element> getDefaultIconItemTypes() throws org.jdom2.JDOMException, java.io.IOException
- Throws:
org.jdom2.JDOMException
java.io.IOException
-
loadDefaultIcons
static void loadDefaultIcons()
-
loadFamilies
static void loadFamilies(java.lang.String typeName, java.util.List<org.jdom2.Element> families)
-
loadMissingItemType
public static void loadMissingItemType(java.lang.String itemType)
-
loadDefaultFamilyMap
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> loadDefaultFamilyMap(java.util.List<org.jdom2.Element> families, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> familyMap)
-
loadDefaultIndicatorTOMap
static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>> loadDefaultIndicatorTOMap(java.util.List<org.jdom2.Element> typeList, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>> familyTOMap)
-
getDefault
public static ItemPalette getDefault(java.lang.String title, @Nonnull Editor ed)
-
buildTabPane
static void buildTabPane(ItemPalette palette)
-
addItemTab
static void addItemTab(ItemPanel itemPanel, java.lang.String key, java.lang.String tabTitle)
-
getTabWidth
static int getTabWidth()
-
setTabs
static void setTabs()
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent e)
- Specified by:
stateChanged
in interfacejavax.swing.event.ChangeListener
-
addFamily
protected static boolean addFamily(java.lang.String type, java.lang.String family, java.util.HashMap<java.lang.String,NamedIcon> iconMap)
Add a new Family of icons to the device type.- Parameters:
type
- type to retrievefamily
- name for iconMap "family"iconMap
- icon HashMap providing the images- Returns:
- result
-
getFamilyMaps
@Nonnull public static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> getFamilyMaps(java.lang.String type)
Get all the Families of icons for a given device type.- Parameters:
type
- type- Returns:
- map of families
-
removeIconMap
protected static void removeIconMap(java.lang.String type, java.lang.String family)
Remove a Family of icons from the device type.- Parameters:
type
- typefamily
- family
-
getIconMap
public static java.util.HashMap<java.lang.String,NamedIcon> getIconMap(java.lang.String type, java.lang.String family)
-
addLevel4Family
protected static boolean addLevel4Family(java.lang.String type, java.lang.String family, java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> iconMap)
************ Currently only needed for IndicatorTO type **************- Parameters:
type
- typefamily
- familyiconMap
- iconMap- Returns:
- result
-
addLevel4FamilyMap
protected static void addLevel4FamilyMap(java.lang.String type, java.lang.String family, java.lang.String key, java.util.HashMap<java.lang.String,NamedIcon> iconMap)
-
getLevel4FamilyMaps
protected static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>>> getLevel4FamilyMaps(java.lang.String type)
-
getLevel4Family
protected static java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,NamedIcon>> getLevel4Family(java.lang.String type, java.lang.String family)
-
removeLevel4IconMap
protected static void removeLevel4IconMap(java.lang.String type, java.lang.String family, java.lang.String key)
-
cloneMap
protected static java.util.HashMap<java.lang.String,NamedIcon> cloneMap(java.util.HashMap<java.lang.String,NamedIcon> map)
-
convertText
public static java.lang.String convertText(java.lang.String name)
Default key names as listed in defaultPanelIcons.xml are Bundle keys and nodes in the CatalogTree. However users also define icon sets and store them in the CatalogTree. The names the user has defined for these sets (i.e.family" name) are also nodes in the CatalogTree. So it is expected that such names will fall through as an Exception. Thus these names are returned as the user has entered them. There is no failure of I18N here.- Parameters:
name
- key name- Returns:
- usable UI display name
-
-