## com.bbn.openmap.tools.symbology.milStd2525
Class SymbolChooser

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      com.bbn.openmap.tools.symbology.milStd2525.SymbolChooser

All Implemented Interfaces:
  javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class SymbolChooser
extends javax.swing.JPanel
implements java.awt.event.ActionListener

The SymbolChooser is a GUI symbol builder. It can be used in stand-alone mode to create image files, or be integrated into a java application to create ImageIcons.

To bring up this chooser, run this class as a standalone application, or call showDialog(..)

See Also:
  Serialized Form

Nested Class Summary
`class` `SymbolChooser.SymbolTreeHolder`

Nested classes inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected boolean` `allowCreateImage`
`protected javax.swing.JButton` `clearFeaturesButton`
`static java.lang.String` `CREATE_IMAGE_CMD`
`protected javax.swing.JButton` `createImageFileButton`
`protected javax.swing.tree.DefaultMutableTreeNode` `currentSymbol`
`protected SymbolChooser.SymbolTreeHolder` `currentSymbolTreeHolder`
`static int` `DEFAULT_ICON_DIMENSION`
`protected static javax.swing.ImageIcon` `DEFAULT_SYMBOL_IMAGE`
`protected DimensionQueryPanel` `dqp`
`protected DrawingAttributes` `drawingAttributes`
`static java.lang.String` `EMPTY_CODE`
`static java.lang.String` `EMPTY_FEATURE_LIST`
`protected java.awt.Dimension` `iconDimension`
`protected SymbolReferenceLibrary` `library`
`protected javax.swing.JTextField` `nameField`
`static java.lang.String` `NAMEFIELD_CMD`
`protected javax.swing.JPanel` `optionPanel`
`protected javax.swing.ImageIcon` `symbolImage`
`protected javax.swing.JLabel` `symbolImageLabel`
`protected java.util.List` `trees`
`protected javax.swing.JScrollPane` `treeView`

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
`SymbolChooser(SymbolReferenceLibrary srl)`

Method Summary
`void` `actionPerformed(java.awt.event.ActionEvent ae)`
`static javax.swing.JDialog` `createDialog(java.awt.Component c, java.lang.String title, boolean modal, SymbolChooser chooserPane, java.awt.event.ActionListener okListener, java.awt.event.ActionListener cancelListener)` Creates JDialog window displaying a SymbolChooser.
`protected java.util.List` `createNodes(SymbolReferenceLibrary srl)` Initialization method to create the SymbolTreeHolders from the SymbolReferenceLibrary.
`java.lang.String` `getCode()` Get the current symbol code listed in the GUI.
`java.awt.Dimension` `getDesiredIconDimension()`
`javax.swing.ImageIcon` `getImageIcon()` Get the icon displayed in the GUI.
`static javax.swing.ImageIcon` `getNotFoundImageIcon()` Convenience function to get a standard blank image for those SymbolParts that are not found by the SymbolImageMaker.
`protected void` `handleManualNameFieldUpdate(java.lang.String text)` Update the GUI to react to code typed into the string window.
`protected void` `init(SymbolReferenceLibrary srl, java.util.List trees)` Create the GUI based on the contents of the SymbolReferenceLibrary and the SymbolPartTrees created from the options.
`boolean` `isAllowCreateImage()`
`static void` `main(java.lang.String[] args)`
`void` `setAllowCreateImage(boolean allowCreateImage)`
`void` `setCode(java.lang.String code)` Set the symbol code in the GUI.
`void` `setDesiredIconDimension(java.awt.Dimension d)` Set the dimension o the icon to be created.
`void` `setImageIcon(javax.swing.ImageIcon ii)` Set the current icon in the display.
`void` `setSelectedTreeHolder(SymbolChooser.SymbolTreeHolder sth)` Update the GUI with the contents of the provided SymbolTreeHolder, reflecting a new set of symbols.
`static javax.swing.ImageIcon` `showDialog(java.awt.Component component, java.lang.String title, SymbolReferenceLibrary srl, java.lang.String defaultSymbolCode)`

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

### CREATE_IMAGE_CMD

    public static final java.lang.String CREATE_IMAGE_CMD

See Also:
  Constant Field Values

### NAMEFIELD_CMD

    public static final java.lang.String NAMEFIELD_CMD

See Also:
  Constant Field Values

### EMPTY_FEATURE_LIST

    public static final java.lang.String EMPTY_FEATURE_LIST

### DEFAULT_ICON_DIMENSION

    public static final int DEFAULT_ICON_DIMENSION

See Also:
  Constant Field Values

### EMPTY_CODE

    public static final java.lang.String EMPTY_CODE

See Also:
  Constant Field Values

### DEFAULT_SYMBOL_IMAGE

    protected static javax.swing.ImageIcon DEFAULT_SYMBOL_IMAGE

### drawingAttributes

    protected DrawingAttributes drawingAttributes

### symbolImage

    protected javax.swing.ImageIcon symbolImage

### currentSymbol

    protected javax.swing.tree.DefaultMutableTreeNode currentSymbol

### currentSymbolTreeHolder

    protected SymbolChooser.SymbolTreeHolder currentSymbolTreeHolder

### library

    protected SymbolReferenceLibrary library

### trees

    protected java.util.List trees

### dqp

    protected DimensionQueryPanel dqp

### clearFeaturesButton

    protected javax.swing.JButton clearFeaturesButton

### createImageFileButton

    protected javax.swing.JButton createImageFileButton

### nameField

    protected javax.swing.JTextField nameField

### symbolImageLabel

    protected javax.swing.JLabel symbolImageLabel

### treeView

    protected javax.swing.JScrollPane treeView

### optionPanel

    protected javax.swing.JPanel optionPanel

### iconDimension

    protected java.awt.Dimension iconDimension

### allowCreateImage

    protected boolean allowCreateImage

Constructor Detail

### SymbolChooser

    public SymbolChooser(SymbolReferenceLibrary srl)

Method Detail

### setSelectedTreeHolder

    public void setSelectedTreeHolder(SymbolChooser.SymbolTreeHolder sth)

  Update the GUI with the contents of the provided SymbolTreeHolder, reflecting a new set of symbols.

  Parameters:
    `sth` -

### getNotFoundImageIcon

    public static javax.swing.ImageIcon getNotFoundImageIcon()

  Convenience function to get a standard blank image for those SymbolParts that are not found by the SymbolImageMaker.

  Returns:
    DEFAULT_SYMBOL_IMAGE

### init

    protected void init(SymbolReferenceLibrary srl,
                        java.util.List trees)

  Create the GUI based on the contents of the SymbolReferenceLibrary and the SymbolPartTrees created from the options.

  Parameters:
    `srl` -
    `trees` -

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent ae)

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`

### handleManualNameFieldUpdate

    protected void handleManualNameFieldUpdate(java.lang.String text)

  Update the GUI to react to code typed into the string window.

  Parameters:
    `text` -

### createNodes

    protected java.util.List createNodes(SymbolReferenceLibrary srl)
                                  throws FormatException

  Initialization method to create the SymbolTreeHolders from the SymbolReferenceLibrary.

  Parameters:
    `srl` -
  Returns:
    List of nodes of the symbol part tree.
  Throws:
    `FormatException`

### getCode

    public java.lang.String getCode()

  Get the current symbol code listed in the GUI.

  Returns:
    code for current symbol.

### setCode

    public void setCode(java.lang.String code)

  Set the symbol code in the GUI.

### getImageIcon

    public javax.swing.ImageIcon getImageIcon()

  Get the icon displayed in the GUI.

  Returns:
    ImageIcon being displayed.

### setImageIcon

    public void setImageIcon(javax.swing.ImageIcon ii)

  Set the current icon in the display.

  Parameters:
    `ii` -

### setDesiredIconDimension

    public void setDesiredIconDimension(java.awt.Dimension d)

  Set the dimension o the icon to be created.

  Parameters:
    `d` -

### getDesiredIconDimension

    public java.awt.Dimension getDesiredIconDimension()

  Returns:
    the dimension of the icon to be created.

### isAllowCreateImage

    public boolean isAllowCreateImage()

  Returns:
    Returns the allowCreateImage.

### setAllowCreateImage

    public void setAllowCreateImage(boolean allowCreateImage)

  Parameters:
    `allowCreateImage` - The allowCreateImage to set.

### showDialog

    public static javax.swing.ImageIcon showDialog(java.awt.Component component,
                                                   java.lang.String title,
                                                   SymbolReferenceLibrary srl,
                                                   java.lang.String defaultSymbolCode)
                                            throws java.awt.HeadlessException

  Throws:
    `java.awt.HeadlessException`

### createDialog

    public static javax.swing.JDialog createDialog(java.awt.Component c,
                                                   java.lang.String title,
                                                   boolean modal,
                                                   SymbolChooser chooserPane,
                                                   java.awt.event.ActionListener okListener,
                                                   java.awt.event.ActionListener cancelListener)
                                            throws java.awt.HeadlessException

  Creates JDialog window displaying a SymbolChooser.

  Throws:
    `java.awt.HeadlessException`

### main

    public static void main(java.lang.String[] args)

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details