Class NodeRootComboBox

All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, ListDataListener

public class NodeRootComboBox extends JComboBox
Combo box from which can be selected a DataNode to serve as the root of the visible tree. From an application's point of view, the idea is that this can be used to obtain any starting point the user wants to get to.

The choices it presents to the user are the root(s) of the local filesystem, plus any roots of remote filesystems which are available. You can set the current value to any of these roots, or any descendants of them. As a convenience to the user, it also permits the selection of any of the ancestors of the selected node. This is basically what the combo box in the JFileChooser does, but this one allows remote filesystems as well.

Since:
9 Mar 2005
Author:
Mark Taylor (Starlink)
See Also:
  • Constructor Details

    • NodeRootComboBox

      public NodeRootComboBox(DataNodeFactory factory)
      Constructor.
      Parameters:
      factory - used for creating new nodes within this component
  • Method Details

    • setModel

      public void setModel(ComboBoxModel model)
      Sets this combo box's model. Will only accept a suitable model (one acquired from another NodeRootComboBox).
      Overrides:
      setModel in class JComboBox
      Parameters:
      model - model
      Throws:
      ClassCastException - if it's the wrong type
    • getModel

      public ComboBoxModel getModel()
      Returns a NodeRootModel.
      Overrides:
      getModel in class JComboBox
      Returns:
      model
    • getSelectedNode

      public DataNode getSelectedNode()
      Returns the selected DataNode.
      Returns:
      current selection
    • getConnectorAction

      public uk.ac.starlink.connect.ConnectorAction getConnectorAction()
      Returns any ConnectorAction associatd with the currently selected node. It will be null unless the selection represents a remote filesystem.
      Returns:
      connector action, or null
    • addDefaultRoots

      public void addDefaultRoots()
      Adds root nodes to the selector representing all the known filestores. This includes any roots of the local filesytem(s) and any remote filestores as supplied by ConnectorManager. The selection is also set to a sensible initial value (probably the current directory).