Package weka.gui

Class PerspectiveManager

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

    public class PerspectiveManager
    extends JPanel
    Manages perspectives and the main menu bar (if visible), holds the currently selected perspective, and implements the perspective button bar.
    Version:
    $Revision: $
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    See Also:
    Serialized Form
    • Field Detail

      • PERSPECTIVE_INTERFACE

        public static final String PERSPECTIVE_INTERFACE
        Interface name of perspectives
      • VISIBLE_PERSPECTIVES_KEY

        public static final Settings.SettingKey VISIBLE_PERSPECTIVES_KEY
        Settings key for visible perspectives in an application
    • Constructor Detail

      • PerspectiveManager

        public PerspectiveManager​(GUIApplication mainApp,
                                  String... perspectivePrefixesToAllow)
        Constructor
        Parameters:
        mainApp - the application that owns this perspective manager
        perspectivePrefixesToAllow - a list of perspective class name prefixes that are to be allowed in this perspective manager. Any perspectives not covered by this list are ignored. An empty list means allow all.
      • PerspectiveManager

        public PerspectiveManager​(GUIApplication mainApp,
                                  String[] perspectivePrefixesToAllow,
                                  String[] perspectivePrefixesToDisallow)
        Constructor
        Parameters:
        mainApp - the application that owns this perspective manager
        perspectivePrefixesToAllow - a list of perspective class name prefixes that are to be allowed in this perspective manager. Any perspectives not covered by this list are ignored. An empty list means allow all.
        perspectivePrefixesToDisallow - a list of perspective class name prefixes that are disallowed in this perspective manager. Any matches in this list are prevented from appearing in this perspective manager. Overrides a successful match in the allowed list. This enables fine-grained exclusion of perspectives (e.g. allowed might specify all perspectives in weka.gui.funky, while disallowed vetoes just weka.gui.funky.NonFunkyPerspective.)
    • Method Detail

      • terminate

        public void terminate()
        Method to be called when GUI application is no longer needed, to free up resources so that they can be garbage collected.
      • setMainApplicationForAllPerspectives

        public void setMainApplicationForAllPerspectives()
        Set the main application on all perspectives managed by this manager
      • setPerspectiveToolbarAlwaysHidden

        public void setPerspectiveToolbarAlwaysHidden​(Settings settings)
        Set whether the perspectives toolbar should always be hidden. This allows just menu-based access to the perspectives and their settings
        Parameters:
        settings - the settings object to set this property on
      • addSettingsMenuItemToProgramMenu

        public void addSettingsMenuItemToProgramMenu​(Settings settings)
        Applications can call this to allow access to the settings editor from the program menu (in addition to the toolbar widget that pops up the settings editor)
        Parameters:
        settings - the settings object for the application
      • setActivePerspective

        public void setActivePerspective​(int theIndex)
        Set the active perspective
        Parameters:
        theIndex - the index of the perspective to make the active one
      • setActivePerspective

        public void setActivePerspective​(String perspectiveID)
        Set the active perspective
        Parameters:
        perspectiveID - the ID of the perspective to make the active one
      • getLoadedPerspectives

        public List<Perspective> getLoadedPerspectives()
        Get a list of all loaded perspectives. I.e. all perspectives that this manager knows about. Note that this list does not include the main application perspective - use getMainPerspective() to retrieve this.
        Returns:
        a list of all loaded (but not necessary visible) perspectives
      • getVisiblePerspectives

        public List<Perspective> getVisiblePerspectives()
        Get a list of visible perspectives. I.e. those that are available to be selected in the perspective toolbar
        Returns:
        a list of visible perspectives
      • getPerspectiveToolBar

        public JPanel getPerspectiveToolBar()
        Get the panel that contains the perspectives toolbar
        Returns:
        the panel that contains the perspecitves toolbar
      • disableAllPerspectiveTabs

        public void disableAllPerspectiveTabs()
        Disable the tab/button for each visible perspective
      • enableAllPerspectiveTabs

        public void enableAllPerspectiveTabs()
        Enable the tab/button for each visible perspective
      • setEnablePerspectiveTabs

        public void setEnablePerspectiveTabs​(List<String> perspectiveIDs,
                                             boolean enabled)
        Enable/disable the tab/button for each perspective in the supplied list of perspective IDs
        Parameters:
        perspectiveIDs - the list of perspective IDs
        enabled - true or false to enable or disable the perspective buttons
      • setEnablePerspectiveTab

        public void setEnablePerspectiveTab​(String perspectiveID,
                                            boolean enabled)
        Enable/disable a perspective's button/tab
        Parameters:
        perspectiveID - the ID of the perspective to enable/disable
        enabled - true or false to enable or disable
      • perspectiveToolBarIsVisible

        public boolean perspectiveToolBarIsVisible()
        Returns true if the perspective toolbar is visible
        Returns:
        true if the perspective toolbar is visible
      • setPerspectiveToolBarIsVisible

        public void setPerspectiveToolBarIsVisible​(boolean v)
      • getMainPerspective

        public Perspective getMainPerspective()
        Get the main application perspective. This is the perspective that is visible on startup of the application and is usually the entry point for the application.
        Returns:
        the main perspective
      • getPerspective

        public Perspective getPerspective​(String ID)
        Get the perspective with the given ID
        Parameters:
        ID - the ID of the perspective to get
        Returns:
        the perspective, or null if there is no perspective with the supplied ID
      • showMenuBar

        public void showMenuBar​(JFrame topLevelAncestor)
        Tell the perspective manager to show the menu bar
        Parameters:
        topLevelAncestor - the owning application's Frame
      • userRequestedPerspectiveToolbarVisibleOnStartup

        public boolean userRequestedPerspectiveToolbarVisibleOnStartup​(Settings settings)
        Returns true if the user has requested that the perspective toolbar is visible when the application starts up
        Parameters:
        settings - the settings object for the application
        Returns:
        true if the user has specified that the perspective toolbar should be visible when the application first starts up