Class BranchComboBox

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

public class BranchComboBox extends JComboBox<Branch>
JComboBox which allows selection of Branch objects. For any branch in the box's model, all its ancestors are automatically in the model too (this behaviour is inspired by widgets like JFileChooser).
Since:
18 Feb 2005
Author:
Mark Taylor (Starlink)
See Also:
  • Constructor Details

    • BranchComboBox

      public BranchComboBox()
      Constructor.
  • Method Details

    • setModel

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

      public void setSelectedBranch(Branch branch)
      Sets the selected branch. This may or may not have the effect of adding or subtracting branches from the box's model.
      Parameters:
      branch - branch to form the current selection
    • getSelectedBranch

      public Branch getSelectedBranch()
      Returns the currently selected branch.
      Returns:
      current branch
    • addBranch

      public void addBranch(Branch branch)
      Adds a new normal branch to the model.
      Parameters:
      branch - branch to add
    • addConnection

      public void addConnection(ConnectorAction connAct)
      Adds a new branch to the model which represents a Connector.
      Parameters:
      connAct - connector action to be represented by a new branch
    • getConnectorAction

      public ConnectorAction getConnectorAction()
      Returns any connector action which is assocated with the currently selected branch. This will return null unless the current branch represents a Connector.
      Returns:
      connector action associated with current selection, if any
      See Also:
    • getFileView

      public static FileView getFileView()
      Returns a FileView object which can be used to interpret files on this platform.
      Returns:
      FileView