Class RosterGroupsPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RosterGroupSelector

public class RosterGroupsPanel extends JPanel implements RosterGroupSelector
A JPanel that lists Roster Groups

This panel contains a fairly self-contained display of Roster Groups that allows roster groups to be fully manipulated through context menus.

See Also:
  • Constructor Details

    • RosterGroupsPanel

      Create a RosterGroupsPanel with default settings
    • RosterGroupsPanel

      public RosterGroupsPanel(String defaultRosterGroup)
      Create a RosterGroupTreePane with the defaultRosterGroup selected.
      Parameters:
      defaultRosterGroup - the name of the default selection
  • Method Details

    • getSelectedRosterGroup

      Get the selected roster group.
      Specified by:
      getSelectedRosterGroup in interface RosterGroupSelector
      Returns:
      The selected roster group
    • setSelectedRosterGroup

      public final void setSelectedRosterGroup(String group)
      Set the selected roster group.

      If the group is null, the selected roster group is set to "All Entries".

      Parameters:
      group - The name of the group to set the selection to.
    • isSelectionUserDefinedRosterGroup

      Is the selected roster group user or system defined.
      Returns:
      flag indicating current selection is a user defined roster group.
    • setGroupsMenu

      public final void setGroupsMenu(JPopupMenu menu)
      Set the context menu for Roster Groups
      Parameters:
      menu - The new menu for Roster Groups.
    • getGroupsMenu

      Get the context menu for Roster Groups
      Returns:
      The current groups menu.
    • setAllEntriesMenu

      public final void setAllEntriesMenu(JPopupMenu menu)
      Set the context menu for the "All Entries" roster group
      Parameters:
      menu - The new menu for All Entries.
    • getAllEntriesMenu

      Get the context menu for "All Entries"
      Returns:
      The menu for All Entries.
    • setNewWindowMenuAction

      Set an action that the menu item "Open in New Window" will trigger.

      Set a JmriAbstractAction that the "Open in New Window" menu item will trigger. null will remove the "Open in New Window" menu item from context menus. The "Open in New Window" menu item will be added or removed from the menu as appropriate.

      If the action you pass has access to the RosterGroupPanel, it may call RosterGroupPanel.getSelectedRosterGroup to determine which group to open in the new window, otherwise it must accept a String defining the group in JmriAbstractAction.setParameter(String, String).

      Parameters:
      action - An action that can work on the current selection
    • getNewWindowMenuAction

      The action triggered by the "Open in New Window" menu item.
      Returns:
      A JmriAbstractAction or null
    • getScrollPane

      Get a JScrollPane containing the JTree that does not display horizontal scrollbars.
      Returns:
      The internal JScrollPane
    • getTree

      public final JTree getTree()
      Get the JTree containing the roster groups.
      Returns:
      The internal JTree
    • firePropertyChangeAsRGP

      protected void firePropertyChangeAsRGP(String propertyName, Object oldValue, Object newValue)