Class ConfigureTree

All Implemented Interfaces:
MouseListener, MouseMotionListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, TreeExpansionListener, TreeSelectionListener, Scrollable
Direct Known Subclasses:
ExtensionTree

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:
  • Field Details

  • Constructor Details

  • Method Details

    • noHTML

      protected static String noHTML(String text)
    • chat

      protected static void chat(String text)
    • getSearchDialog

      protected JDialog getSearchDialog()
    • setSearchDialog

      protected void setSearchDialog(JDialog searchDialog)
    • getSearchField

      protected JTextField getSearchField()
    • setSearchField

      protected void setSearchField(JTextField searchField)
    • setSearchAdvanced

      protected void setSearchAdvanced(JCheckBox searchAdvanced)
    • getSearchAdvanced

      protected JCheckBox getSearchAdvanced()
    • getFrame

      public JFrame getFrame()
    • treeExpanded

      public void treeExpanded(TreeExpansionEvent event)
      Specified by:
      treeExpanded in interface TreeExpansionListener
    • treeCollapsed

      public void treeCollapsed(TreeExpansionEvent event)
      A cell has been collapsed. Reset the edit flag on all the children owned by this node
      Specified by:
      treeCollapsed in interface TreeExpansionListener
      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

      protected Configurable getTarget(int x, int y)
    • buildTreeNode

      protected DefaultMutableTreeNode buildTreeNode(Configurable c)
    • addAction

      protected void addAction(JPopupMenu menu, Action a)
    • addSubMenu

      protected void addSubMenu(JPopupMenu menu, String name, List<Action> l)
    • buildPopupMenu

      protected JPopupMenu buildPopupMenu(Configurable target)
    • buildSearchAction

      protected Action buildSearchAction(Configurable target)
      Returns:
      Search action - runs search dialog box, then searches
    • buildMoveAction

      protected Action buildMoveAction(Configurable target)
    • buildCutAction

      protected Action buildCutAction(Configurable target)
    • buildCopyAction

      protected Action buildCopyAction(Configurable target)
    • buildPasteAction

      protected Action buildPasteAction(Configurable target)
    • isValidPasteTarget

      protected boolean isValidPasteTarget(Configurable target, DefaultMutableTreeNode sourceNode)
    • isValidPasteTarget

      protected boolean isValidPasteTarget(Configurable target)
    • convertChild

      protected Configurable convertChild(Configurable parent, Configurable child)
      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 Configurable
      child - Child Configurable
      Returns:
      new Child
    • isAllowedChildClass

      protected boolean isAllowedChildClass(Configurable parent, Class<?> childClass)
    • updateGpIds

      public void updateGpIds(Configurable c)
      Allocate new PieceSlot Id's to any PieceSlot sub-components
      Parameters:
      c - Configurable to update
    • buildImportAction

      protected Action buildImportAction(Configurable target)
    • buildMassPieceLoaderAction

      protected Action buildMassPieceLoaderAction(Configurable target)
    • hasChild

      protected boolean hasChild(Configurable parent, Class<?> childClass)
    • buildAddActionsFor

      protected List<Action> buildAddActionsFor(Configurable target)
    • buildAddActionsFor

      protected List<Action> buildAddActionsFor(Configurable target, List<Action> peerInserts)
    • buildAddAction

      protected Action buildAddAction(Configurable target, Class<? extends Buildable> newConfig)
    • buildAddAction

      protected Action buildAddAction(Configurable target, Class<? extends Buildable> newConfig, String key, int index, Configurable duplicate)
    • buildHelpAction

      protected Action buildHelpAction(Configurable target)
    • buildCloneAction

      protected Action buildCloneAction(Configurable target)
    • getParent

      protected Configurable getParent(DefaultMutableTreeNode targetNode)
    • buildDeleteAction

      protected Action buildDeleteAction(Configurable target)
    • buildEditPiecesAction

      protected Action buildEditPiecesAction(Configurable target)
    • buildOpenPiecesAction

      protected Action buildOpenPiecesAction(Configurable target)
    • buildEditAction

      protected Action buildEditAction(Configurable target)
    • buildTranslateAction

      protected Action buildTranslateAction(Configurable target)
    • canContainGamePiece

      public boolean canContainGamePiece(Configurable target)
    • delete

      protected boolean delete(Configurable target)
      Delete removes an item from the tree but ALSO traverses the tree throwing all the childrens' children manually out the airlock, one by one. Lest they return and live on as zombies...
    • remove

      protected boolean remove(Configurable parent, Configurable child)
    • insert

      protected boolean insert(Configurable parent, Configurable child, int index)
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • getConfigureName

      public static String getConfigureName(Class<?> c)
      Returns the name of the class for display purposes. Reflection is used to call getConfigureTypeName(), 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

      public static String getConfigureName(Configurable c)
    • importConfigurable

      protected Configurable importConfigurable()
    • maybePopup

      protected void maybePopup(MouseEvent e)
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • getTreeNode

      public DefaultMutableTreeNode getTreeNode(Configurable target)
    • mouseDragged

      public void mouseDragged(MouseEvent evt)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • isValidParent

      protected boolean isValidParent(Configurable parent, Configurable child)
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • nodeUpdated

      public void nodeUpdated(Configurable target)
    • jumpToTarget

      public void jumpToTarget(Configurable target)
    • externalInsert

      public void externalInsert(Configurable parent, Configurable child)
      Build an AddAction and execute it to request a new component from the user
      Parameters:
      parent - Target Parent
      child - Type to add
    • getHelpAction

      public Action getHelpAction()
    • populateEditMenu

      public void populateEditMenu(EditorWindow ew)
    • doKeyAction

      protected void doKeyAction(String action)
      Handle main Edit menu selections/accelerators
      Parameters:
      action - Edit command name
    • valueChanged

      public void valueChanged(TreeSelectionEvent e)
      Tree selection changed, record info about the currently selected component
      Specified by:
      valueChanged in interface TreeSelectionListener
    • updateEditMenu

      protected void updateEditMenu()
    • getParent

      protected Configurable getParent(Configurable target)
      Find the parent Configurable of a specified Configurable
      Parameters:
      target - target Configurable
      Returns:
      parent
    • getSearchCmd

      public String 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 Class
      child - Child Class
    • nodeEdited

      public void nodeEdited(Configurable target)
      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
    • checkMinimumIndex

      public int checkMinimumIndex(DefaultMutableTreeNode targetNode, int index)
      Allows ExtensionEditor to override and control what indexes are allowed