Package VASSAL.configure
Class ConfigureTree
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
VASSAL.configure.ConfigureTree
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,TreeExpansionListener
,TreeSelectionListener
,Scrollable
- Direct Known Subclasses:
ExtensionTree
public class ConfigureTree
extends JTree
implements PropertyChangeListener, MouseListener, MouseMotionListener, TreeSelectionListener, TreeExpansionListener
The beating heart of the Editor, this class handles the Configuration Tree
that appears in the Configuration window when editing a VASSAL module. Each
node in the tree structure is a
Configurable
object,
whose child nodes are obtained via Configurable.getConfigureComponents()
.
When we're running as the Extension Editor, this is subclassed by ExtensionTree
, which
overrides some methods to handle extension-specific differences.- See Also:
- Serialized Form
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
static interface
Configurers that add or remove their own children directly should implement the Mutable interface so that ConfigureTree can refresh the changed node.Nested classes/interfaces inherited from class javax.swing.JTree
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionprotected static List<ConfigureTree.AdditionalComponent>
protected static Chatter
protected Action
protected String
protected DefaultMutableTreeNode
protected KeyStroke
protected Action
protected String
protected DefaultMutableTreeNode
protected KeyStroke
protected Action
protected String
protected KeyStroke
protected EditorWindow
protected Action
protected String
protected KeyStroke
protected HelpWindow
protected Action
protected String
protected KeyStroke
protected Map<Configurable,DefaultMutableTreeNode>
protected Action
protected String
protected KeyStroke
static Font
protected Action
protected String
protected KeyStroke
protected Action
protected JCheckBox
protected String
protected JDialog
protected JTextField
protected KeyStroke
protected Configurable
protected int
protected Action
protected String
protected KeyStroke
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
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
-
Constructor Summary
ConstructorDescriptionConfigureTree(Configurable root, HelpWindow helpWindow)
Creates new ConfigureTreeConfigureTree(Configurable root, HelpWindow helpWindow, EditorWindow editorWindow)
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAction(JPopupMenu menu, Action a)
static void
addAdditionalComponent(Class<? extends Buildable> parent, Class<? extends Buildable> child)
Record additional available components to add to the popup menu.protected Action
buildAddAction(Configurable target, Class<? extends Buildable> newConfig)
protected Enumeration<Action>
buildAddActions(Configurable target)
Deprecated, for removal: This API element is subject to removal in a future version.buildAddActionsFor(Configurable target)
protected Action
buildCloneAction(Configurable target)
protected Action
buildCopyAction(Configurable target)
protected Action
buildCutAction(Configurable target)
protected Action
buildDeleteAction(Configurable target)
protected Action
buildEditAction(Configurable target)
protected Action
buildEditPiecesAction(Configurable target)
protected Action
buildHelpAction(Configurable target)
protected Action
buildImportAction(Configurable target)
protected Action
buildMassPieceLoaderAction(Configurable target)
protected Action
buildMoveAction(Configurable target)
protected Action
buildPasteAction(Configurable target)
protected JPopupMenu
buildPopupMenu(Configurable target)
protected VASSAL.configure.ConfigureTree.Renderer
protected Action
buildSearchAction(Configurable target)
protected Action
buildTranslateAction(Configurable target)
protected DefaultMutableTreeNode
boolean
canContainGamePiece(Configurable target)
protected static void
protected Configurable
convertChild(Configurable parent, Configurable child)
Some components need to be converted to a new type before insertion.protected void
doKeyAction(String action)
Handle main Edit menu selections/acceleratorsvoid
externalInsert(Configurable parent, Configurable child)
Build an AddAction and execute it to request a new component from the userstatic String
getConfigureName(Class<?> c)
Returns the name of the class for display purposes.static String
getFrame()
protected Configurable
getParent(DefaultMutableTreeNode targetNode)
protected Configurable
getParent(Configurable target)
Find the parent Configurable of a specified Configurableprotected JCheckBox
protected JDialog
protected JTextField
protected Configurable
getTarget(int x, int y)
getTreeNode(Configurable target)
protected boolean
hasChild(Configurable parent, Class<?> childClass)
protected Configurable
protected boolean
insert(Configurable parent, Configurable child, int index)
protected boolean
isAllowedChildClass(Configurable parent, Class<?> childClass)
protected boolean
isValidParent(Configurable parent, Configurable child)
protected boolean
isValidPasteTarget(Configurable target)
protected void
maybePopup(MouseEvent e)
void
void
mouseDragged(MouseEvent evt)
void
void
void
mouseMoved(MouseEvent e)
void
void
void
nodeEdited(Configurable target)
Called when the Configurable held by a node has been edited.void
nodeUpdated(Configurable target)
protected static String
protected void
notifyStateChanged(boolean changed)
Tell our enclosing EditorWindow that we are now clean or dirty.void
void
protected boolean
remove(Configurable parent, Configurable child)
protected void
setSearchAdvanced(JCheckBox searchAdvanced)
protected void
setSearchDialog(JDialog searchDialog)
protected void
setSearchField(JTextField searchField)
void
treeCollapsed(TreeExpansionEvent event)
A cell has been collapsed.void
treeExpanded(TreeExpansionEvent event)
protected void
void
Allocate new PieceSlot Id's to any PieceSlot sub-componentsvoid
Tree selection changed, record info about the currently selected componentMethods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setDropMode, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, 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, 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, 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, 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
-
Field Details
-
nodes
-
copyData
-
cutData
-
helpWindow
-
editorWindow
-
selected
-
selectedRow
protected int selectedRow -
searchCmd
-
moveCmd
-
deleteCmd
-
pasteCmd
-
copyCmd
-
cutCmd
-
helpCmd
-
propertiesCmd
-
translateCmd
-
cutKey
-
copyKey
-
pasteKey
-
deleteKey
-
moveKey
-
searchKey
-
helpKey
-
propertiesKey
-
translateKey
-
cutAction
-
copyAction
-
pasteAction
-
deleteAction
-
moveAction
-
searchAction
-
propertiesAction
-
translateAction
-
helpAction
-
searchDialog
-
searchField
-
searchAdvanced
-
chatter
-
POPUP_MENU_FONT
-
additionalComponents
-
-
Constructor Details
-
ConfigureTree
Creates new ConfigureTree -
ConfigureTree
-
-
Method Details
-
noHTML
-
chat
-
getSearchDialog
-
setSearchDialog
-
getSearchField
-
setSearchField
-
setSearchAdvanced
-
getSearchAdvanced
-
getFrame
-
treeExpanded
- Specified by:
treeExpanded
in interfaceTreeExpansionListener
-
treeCollapsed
A cell has been collapsed. Reset the edit flag on all the children owned by this node- Specified by:
treeCollapsed
in interfaceTreeExpansionListener
- Parameters:
event
- Expansion event
-
buildRenderer
protected VASSAL.configure.ConfigureTree.Renderer buildRenderer() -
notifyStateChanged
protected void notifyStateChanged(boolean changed)Tell our enclosing EditorWindow that we are now clean or dirty.- Parameters:
changed
- true = state is not dirty
-
getTarget
-
buildTreeNode
-
addAction
-
buildPopupMenu
-
buildSearchAction
- Returns:
- Search action - runs search dialog box, then searches
-
buildMoveAction
-
buildCutAction
-
buildCopyAction
-
buildPasteAction
-
isValidPasteTarget
-
convertChild
Some components need to be converted to a new type before insertion. Currently this is used to allow cut and paste of CardSlots and PieceSlots between Decks and GamePiece Palette components.- Parameters:
parent
- Parent Configurablechild
- Child Configurable- Returns:
- new Child
-
isAllowedChildClass
-
updateGpIds
Allocate new PieceSlot Id's to any PieceSlot sub-components- Parameters:
c
- Configurable to update
-
buildImportAction
-
buildMassPieceLoaderAction
-
hasChild
-
buildAddActionsFor
-
buildAddActions
@Deprecated(since="2020-08-06", forRemoval=true) protected Enumeration<Action> buildAddActions(Configurable target)Deprecated, for removal: This API element is subject to removal in a future version.UsebuildAddActionsFor(Configurable)
instead. -
buildAddAction
-
buildHelpAction
-
buildCloneAction
-
getParent
-
buildDeleteAction
-
buildEditPiecesAction
-
buildEditAction
-
buildTranslateAction
-
canContainGamePiece
-
remove
-
insert
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
getConfigureName
Returns the name of the class for display purposes. Reflection is used to callgetConfigureTypeName()
, which should be a static method if it exists in the given class. (This is necessary because static methods are not permitted in interfaces.)- Parameters:
c
- the class whose configure name will be returned- Returns:
- the configure name of the class
-
getConfigureName
-
importConfigurable
-
maybePopup
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
getTreeNode
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
isValidParent
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
nodeUpdated
-
externalInsert
Build an AddAction and execute it to request a new component from the user- Parameters:
parent
- Target Parentchild
- Type to add
-
getHelpAction
-
populateEditMenu
-
doKeyAction
Handle main Edit menu selections/accelerators- Parameters:
action
- Edit command name
-
valueChanged
Tree selection changed, record info about the currently selected component- Specified by:
valueChanged
in interfaceTreeSelectionListener
-
updateEditMenu
protected void updateEditMenu() -
getParent
Find the parent Configurable of a specified Configurable- Parameters:
target
- target Configurable- Returns:
- parent
-
getSearchCmd
-
addAdditionalComponent
public static void addAdditionalComponent(Class<? extends Buildable> parent, Class<? extends Buildable> child)Record additional available components to add to the popup menu.- Parameters:
parent
- Parent Classchild
- Child Class
-
nodeEdited
Called when the Configurable held by a node has been edited. Set the edit status and re-build the Jtree label- Parameters:
target
- Edited Configurable
-
buildAddActionsFor(Configurable)
instead.