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:
ImageObserver
,MenuContainer
,Serializable
,Accessible
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class to manage user preferences with respect to visible perspectives and whether the perspectives toolbar is always hidden or is visible on application startupNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Interface name of perspectivesstatic final Settings.SettingKey
Settings key for visible perspectives in an applicationFields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionPerspectiveManager
(GUIApplication mainApp, String... perspectivePrefixesToAllow) ConstructorPerspectiveManager
(GUIApplication mainApp, String[] perspectivePrefixesToAllow, String[] perspectivePrefixesToDisallow) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
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)void
Disable the tab/button for each visible perspectivevoid
Enable the tab/button for each visible perspectiveGet a list of all loaded perspectives.Get the main application perspective.getPerspective
(String ID) Get the perspective with the given IDGet the panel that contains the perspectives toolbarGet a list of visible perspectives.boolean
Returns true if the perspective toolbar is visiblevoid
setActivePerspective
(int theIndex) Set the active perspectivevoid
setActivePerspective
(String perspectiveID) Set the active perspectivevoid
setEnablePerspectiveTab
(String perspectiveID, boolean enabled) Enable/disable a perspective's button/tabvoid
setEnablePerspectiveTabs
(List<String> perspectiveIDs, boolean enabled) Enable/disable the tab/button for each perspective in the supplied list of perspective IDsvoid
Set the main application on all perspectives managed by this managervoid
setPerspectiveToolbarAlwaysHidden
(Settings settings) Set whether the perspectives toolbar should always be hidden.void
setPerspectiveToolBarIsVisible
(boolean v) void
showMenuBar
(JFrame topLevelAncestor) Tell the perspective manager to show the menu barvoid
Method to be called when GUI application is no longer needed, to free up resources so that they can be garbage collected.boolean
Returns true if the user has requested that the perspective toolbar is visible when the application starts upMethods 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 Details
-
PERSPECTIVE_INTERFACE
Interface name of perspectives -
VISIBLE_PERSPECTIVES_KEY
Settings key for visible perspectives in an application
-
-
Constructor Details
-
PerspectiveManager
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, String[] perspectivePrefixesToAllow, 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 Details
-
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
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
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
Set the active perspective- Parameters:
perspectiveID
- the ID of the perspective to make the active one
-
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
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
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
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
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
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
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
Tell the perspective manager to show the menu bar- Parameters:
topLevelAncestor
- the owning application's Frame
-
userRequestedPerspectiveToolbarVisibleOnStartup
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
-