public class PerspectiveManager
extends javax.swing.JPanel
| Modifier and Type | Class and Description |
|---|---|
static class |
PerspectiveManager.SelectedPerspectivePreferences
Class to manage user preferences with respect to visible perspectives and
whether the perspectives toolbar is always hidden or is visible on
application startup
|
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.String> |
m_allowedPerspectiveClassPrefixes
Allow these perspectives in the toolbar (empty list means allow all)
|
protected javax.swing.JMenuBar |
m_appMenuBar
Main application menu bar
|
protected javax.swing.JPanel |
m_configAndPerspectivesToolBar
Holds the config/settings button and toolbar
|
protected boolean |
m_configAndPerspectivesVisible
Whether the toolbar is visible or hidden
|
protected java.util.List<java.lang.String> |
m_disallowedPerspectiveClassPrefixes
Disallow these perspectives (non-empty list overrides meaning of empty
allowed list)
|
protected LogPanel |
m_LogPanel
The panel for log and status messages
|
protected boolean |
m_logVisible
Whether the log is visible in the current perspective
|
protected GUIApplication |
m_mainApp
The main application that owns this perspective manager
|
protected Perspective |
m_mainPerspective
The main perspective for the application owning this perspective manager
|
protected java.util.Map<java.lang.String,Perspective> |
m_perspectiveCache
Cache of perspectives
|
protected javax.swing.ButtonGroup |
m_perspectiveGroup
For grouping the perspectives buttons in the toolbar
|
protected java.util.Map<java.lang.String,java.lang.String> |
m_perspectiveNameLookup
Name lookup for perspectives
|
protected java.util.List<Perspective> |
m_perspectives
The perspectives that have a button in the toolbar
|
protected javax.swing.JToolBar |
m_perspectiveToolBar
The actual perspectives toolbar
|
protected javax.swing.JMenu |
m_programMenu
Program menu
|
protected javax.swing.JMenuItem |
m_togglePerspectivesToolBar
Menu item for toggling whether the toolbar is visible or not
|
protected java.util.LinkedHashSet<java.lang.String> |
m_visiblePerspectives
Names of visible perspectives (i.e. those that the user has opted to be
available via a button in the toolbar
|
static java.lang.String |
PERSPECTIVE_INTERFACE
Interface name of perspectives
|
static Settings.SettingKey |
VISIBLE_PERSPECTIVES_KEY
Settings key for visible perspectives in an application
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
PerspectiveManager(GUIApplication mainApp,
java.lang.String... perspectivePrefixesToAllow)
Constructor
|
PerspectiveManager(GUIApplication mainApp,
java.lang.String[] perspectivePrefixesToAllow,
java.lang.String[] perspectivePrefixesToDisallow)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
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)
|
void |
disableAllPerspectiveTabs()
Disable the tab/button for each visible perspective
|
void |
enableAllPerspectiveTabs()
Enable the tab/button for each visible perspective
|
java.util.List<Perspective> |
getLoadedPerspectives()
Get a list of all loaded perspectives.
|
Perspective |
getMainPerspective()
Get the main application perspective.
|
Perspective |
getPerspective(java.lang.String ID)
Get the perspective with the given ID
|
javax.swing.JPanel |
getPerspectiveToolBar()
Get the panel that contains the perspectives toolbar
|
java.util.List<Perspective> |
getVisiblePerspectives()
Get a list of visible perspectives.
|
protected void |
initLogPanel(Settings settings)
Initialize the log panel
|
protected void |
initPerspectivesCache(Settings settings)
Loads perspectives and initializes the cache.
|
protected javax.swing.JMenu |
initProgramMenu()
Initialize the program menu
|
protected void |
initVisiblePerspectives(Settings settings)
Initializes the visible perspectives.
|
protected void |
notifySettingsChanged()
Notify all perspectives of a change to the application settings
|
boolean |
perspectiveToolBarIsVisible()
Returns true if the perspective toolbar is visible
|
protected void |
popupSettingsDialog(Settings settings)
Popup the settings editor dialog
|
void |
setActivePerspective(int theIndex)
Set the active perspective
|
void |
setActivePerspective(java.lang.String perspectiveID)
Set the active perspective
|
void |
setEnablePerspectiveTab(java.lang.String perspectiveID,
boolean enabled)
Enable/disable a perspective's button/tab
|
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
|
protected void |
setLogSettings(Settings settings)
Apply settings to the log panel
|
void |
setMainApplicationForAllPerspectives()
Set the main application on all perspectives managed by this manager
|
void |
setPerspectiveToolbarAlwaysHidden(Settings settings)
Set whether the perspectives toolbar should always be hidden.
|
void |
setPerspectiveToolBarIsVisible(boolean v) |
protected void |
setupUserPerspectives()
Creates a button on the toolbar for each visible perspective
|
void |
showMenuBar(javax.swing.JFrame topLevelAncestor)
Tell the perspective manager to show the menu bar
|
boolean |
userRequestedPerspectiveToolbarVisibleOnStartup(Settings settings)
Returns true if the user has requested that the perspective toolbar is
visible when the application starts up
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, getPeer, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final java.lang.String PERSPECTIVE_INTERFACE
public static final Settings.SettingKey VISIBLE_PERSPECTIVES_KEY
protected javax.swing.JToolBar m_perspectiveToolBar
protected javax.swing.ButtonGroup m_perspectiveGroup
protected GUIApplication m_mainApp
protected java.util.Map<java.lang.String,Perspective> m_perspectiveCache
protected java.util.Map<java.lang.String,java.lang.String> m_perspectiveNameLookup
protected java.util.List<Perspective> m_perspectives
protected java.util.LinkedHashSet<java.lang.String> m_visiblePerspectives
protected java.util.List<java.lang.String> m_allowedPerspectiveClassPrefixes
protected java.util.List<java.lang.String> m_disallowedPerspectiveClassPrefixes
protected Perspective m_mainPerspective
protected boolean m_configAndPerspectivesVisible
protected javax.swing.JPanel m_configAndPerspectivesToolBar
protected javax.swing.JMenuBar m_appMenuBar
protected javax.swing.JMenu m_programMenu
protected javax.swing.JMenuItem m_togglePerspectivesToolBar
protected LogPanel m_LogPanel
protected boolean m_logVisible
public PerspectiveManager(GUIApplication mainApp, java.lang.String... perspectivePrefixesToAllow)
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.public PerspectiveManager(GUIApplication mainApp, java.lang.String[] perspectivePrefixesToAllow, java.lang.String[] perspectivePrefixesToDisallow)
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.)protected void setLogSettings(Settings settings)
settings - settings to applyprotected void initLogPanel(Settings settings)
public void setMainApplicationForAllPerspectives()
protected void notifySettingsChanged()
protected javax.swing.JMenu initProgramMenu()
public void setPerspectiveToolbarAlwaysHidden(Settings settings)
settings - the settings object to set this property onpublic void addSettingsMenuItemToProgramMenu(Settings settings)
settings - the settings object for the applicationprotected void popupSettingsDialog(Settings settings)
settings - the settings to editprotected void setupUserPerspectives()
public void setActivePerspective(int theIndex)
theIndex - the index of the perspective to make the active onepublic void setActivePerspective(java.lang.String perspectiveID)
perspectiveID - the ID of the perspective to make the active onepublic java.util.List<Perspective> getLoadedPerspectives()
public java.util.List<Perspective> getVisiblePerspectives()
protected void initPerspectivesCache(Settings settings)
settings - the settings object in which to store default settings from
each loaded perspectiveprotected void initVisiblePerspectives(Settings settings)
settings - the settings object for the owner applicationpublic javax.swing.JPanel getPerspectiveToolBar()
public void disableAllPerspectiveTabs()
public void enableAllPerspectiveTabs()
public void setEnablePerspectiveTabs(java.util.List<java.lang.String> perspectiveIDs,
boolean enabled)
perspectiveIDs - the list of perspective IDsenabled - true or false to enable or disable the perspective buttonspublic void setEnablePerspectiveTab(java.lang.String perspectiveID,
boolean enabled)
perspectiveID - the ID of the perspective to enable/disableenabled - true or false to enable or disablepublic boolean perspectiveToolBarIsVisible()
public void setPerspectiveToolBarIsVisible(boolean v)
public Perspective getMainPerspective()
public Perspective getPerspective(java.lang.String ID)
ID - the ID of the perspective to getpublic void showMenuBar(javax.swing.JFrame topLevelAncestor)
topLevelAncestor - the owning application's Framepublic boolean userRequestedPerspectiveToolbarVisibleOnStartup(Settings settings)
settings - the settings object for the application