Package weka.gui
Class PerspectiveManager
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- weka.gui.PerspectiveManager
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
public class PerspectiveManager extends javax.swing.JPanelManages 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPerspectiveManager.SelectedPerspectivePreferencesClass to manage user preferences with respect to visible perspectives and whether the perspectives toolbar is always hidden or is visible on application startup
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPERSPECTIVE_INTERFACEInterface name of perspectivesstatic Settings.SettingKeyVISIBLE_PERSPECTIVES_KEYSettings key for visible perspectives in an application-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description PerspectiveManager(GUIApplication mainApp, java.lang.String... perspectivePrefixesToAllow)ConstructorPerspectiveManager(GUIApplication mainApp, java.lang.String[] perspectivePrefixesToAllow, java.lang.String[] perspectivePrefixesToDisallow)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSettingsMenuItemToProgramMenu(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)voiddisableAllPerspectiveTabs()Disable the tab/button for each visible perspectivevoidenableAllPerspectiveTabs()Enable the tab/button for each visible perspectivejava.util.List<Perspective>getLoadedPerspectives()Get a list of all loaded perspectives.PerspectivegetMainPerspective()Get the main application perspective.PerspectivegetPerspective(java.lang.String ID)Get the perspective with the given IDjavax.swing.JPanelgetPerspectiveToolBar()Get the panel that contains the perspectives toolbarjava.util.List<Perspective>getVisiblePerspectives()Get a list of visible perspectives.booleanperspectiveToolBarIsVisible()Returns true if the perspective toolbar is visiblevoidsetActivePerspective(int theIndex)Set the active perspectivevoidsetActivePerspective(java.lang.String perspectiveID)Set the active perspectivevoidsetEnablePerspectiveTab(java.lang.String perspectiveID, boolean enabled)Enable/disable a perspective's button/tabvoidsetEnablePerspectiveTabs(java.util.List<java.lang.String> perspectiveIDs, boolean enabled)Enable/disable the tab/button for each perspective in the supplied list of perspective IDsvoidsetMainApplicationForAllPerspectives()Set the main application on all perspectives managed by this managervoidsetPerspectiveToolbarAlwaysHidden(Settings settings)Set whether the perspectives toolbar should always be hidden.voidsetPerspectiveToolBarIsVisible(boolean v)voidshowMenuBar(javax.swing.JFrame topLevelAncestor)Tell the perspective manager to show the menu barvoidterminate()Method to be called when GUI application is no longer needed, to free up resources so that they can be garbage collected.booleanuserRequestedPerspectiveToolbarVisibleOnStartup(Settings settings)Returns true if the user has requested that the perspective toolbar is visible when the application starts up-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
PERSPECTIVE_INTERFACE
public static final java.lang.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, java.lang.String... perspectivePrefixesToAllow)
Constructor- Parameters:
mainApp- the application that owns this perspective managerperspectivePrefixesToAllow- 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, java.lang.String[] perspectivePrefixesToAllow, java.lang.String[] perspectivePrefixesToDisallow)
Constructor- Parameters:
mainApp- the application that owns this perspective managerperspectivePrefixesToAllow- 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(java.lang.String perspectiveID)
Set the active perspective- Parameters:
perspectiveID- the ID of the perspective to make the active one
-
getLoadedPerspectives
public java.util.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 java.util.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 javax.swing.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(java.util.List<java.lang.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 IDsenabled- true or false to enable or disable the perspective buttons
-
setEnablePerspectiveTab
public void setEnablePerspectiveTab(java.lang.String perspectiveID, boolean enabled)Enable/disable a perspective's button/tab- Parameters:
perspectiveID- the ID of the perspective to enable/disableenabled- 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(java.lang.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(javax.swing.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
-
-