|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
dsto.dfc.swing.panels.PanelManager
public class PanelManager
Manages a set of panels similar to a Window Manager. Clients add a panel by passing in a component to be managed within PanelManager.Panel via addPanel (). The panel acts like a window that may exist in one of three states. The FIXED state displays the component within a tabbed pane, the FLOAT_INTERNAL state uses a lightweight java frame, while the FLOAT_EXTERNAL state uses a native window. The display state is controlled by setFloating (). Panels may also have child "tool" views which are shown in floated windows that are only visible when the panel is active (see Panel.addToolView ()).
Nested Class Summary | |
---|---|
class |
PanelManager.Panel
A panel managed by the panel manager. |
protected class |
PanelManager.WindowEventListener
Inner class to capture events generated by internal and external frames. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected PanelManager.Panel |
activePanel
|
protected DynamicCommandViews |
commandViewJuggler
|
protected EditPropagator |
editPropagator
|
static String |
FIXED
|
static String |
FLOAT_EXTERNAL
|
static String |
FLOAT_INTERNAL
|
protected HidePolicy |
hidePolicy
|
static Icon |
NULL_ICON
|
static String |
NULL_NAME
|
protected Vector |
panelManagerListeners
|
protected List |
panels
|
protected static int |
TAB_HEIGHT
|
protected static int |
TAB_WIDTH
|
RestrictedIndexTabbedPane |
tabPane
|
protected static Dimension |
tabPaneInsets
|
protected PanelManager.WindowEventListener |
windowEventListener
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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 | |
---|---|
PanelManager()
|
Method Summary | |
---|---|
PanelManager.Panel |
addPanel(Component component)
Add a new panel to the manager, using default settings for all other options. |
PanelManager.Panel |
addPanel(Component component,
int index)
Add a new panel to the manager. |
PanelManager.Panel |
addPanel(Component component,
int index,
String name,
Icon icon)
Add a new panel to the manager. |
PanelManager.Panel |
addPanel(Component component,
int index,
String name,
Icon icon,
boolean showingName,
boolean useScrollPane)
Add a new panel to the manager. |
PanelManager.Panel |
addPanel(Component component,
String name,
Icon icon)
Add a new panel to the manager. |
void |
addPanelManagerListener(PanelManagerListener l)
|
void |
addUndoableEditListener(UndoableEditListener listener)
|
protected void |
basicAddPanel(PanelManager.Panel panel,
int index)
Do the job of adding a new Panel instance, updating active view, firing panel added event, etc. |
boolean |
containsPanel(PanelManager.Panel managedPanel)
True if a given panel is inside this manager. |
protected UndoableEdit |
createActivePanelEdit(int oldActiveIndex,
int newActiveIndex)
Create an UndoableEdit that represents a change in the currently active panel |
protected FloatStateEdit |
createNewFloatStateEdit(String oldFloatState,
String newFloatState)
Create an UndoableEdit that represents a change in the floating state of a panel |
protected boolean |
fireAboutToRemovePanel(PanelManager.Panel panel)
Fire the aboutToRemovePanel event. |
protected void |
fireNewActivePanelEdit(int oldIndex,
int newIndex)
If the active panel has changed, let undoable edit listeners know. |
protected void |
firePanelAdded(PanelManagerEvent e)
|
protected void |
firePanelFloated(PanelManagerEvent e)
|
protected void |
firePanelRemoved(PanelManagerEvent e)
|
protected void |
firePanelUnfloated(PanelManagerEvent e)
|
PanelManager.Panel |
getActivePanel()
Return the active panel. |
CommandView |
getCommandView(String viewName)
Get the command view instance for a given view name. |
Dimension |
getMinimumSize()
|
protected PanelManager.Panel |
getNextFixedPanel(PanelManager.Panel startPanel)
|
PanelManager.Panel |
getNextPanel(PanelManager.Panel startPanel)
Get the panel that is the logical next panel after a given panel. |
PanelManager.Panel |
getPanel(Component component)
Get the panel that is hosting a given component. |
PanelManager.Panel |
getPanelAt(int index)
Get the panel at a given index. |
int |
getPanelCount()
The number of panels. |
Dimension |
getPreferredSize()
|
protected void |
hideOldActivePanel()
|
int |
indexOfActivePanel()
The index of the currently active panel. |
int |
indexOfPanel(PanelManager.Panel panel)
The index of a panel. |
protected boolean |
listenersRejectPanelRemoval(PanelManager.Panel panel)
|
String |
nameForPanelAt(int index)
The name for a panel at a given index. |
protected boolean |
panelDoesNotFireEdits(int index)
|
void |
removeAllPanels()
Remove all panels and dispose of any resources. |
boolean |
removePanel(PanelManager.Panel managedPanel)
Remove a panel. |
void |
removePanelManagerListener(PanelManagerListener l)
|
void |
removeUndoableEditListener(UndoableEditListener listener)
|
PanelManager.Panel |
replacePanel(PanelManager.Panel oldPanel,
Component newComponent)
Replace an existing panel with a new one. |
PanelManager.Panel |
replacePanel(PanelManager.Panel oldPanel,
Component newComponent,
String name)
Replace an existing panel with a new one. |
PanelManager.Panel |
replacePanel(PanelManager.Panel oldPanel,
Component newComponent,
String name,
Icon icon)
Replace an existing panel with a new one. |
void |
setActiveIndex(int index)
Set the active panel to be the panel at a given index. |
void |
setActivePanel(PanelManager.Panel newActivePanel)
Set the active panel. |
void |
setAutoHide(boolean hideWhenNoPanels)
When autoHide is true, the PanelManager becomes invisible when it contains no panels |
protected void |
setUndoFlag()
Workaround for avoiding ActivePanelEdits being fired while undoing previous ActivePanelEdits. |
protected void |
showActivePanel(boolean show)
|
protected void |
showNewActivePanel()
|
void |
undoableEditHappened(UndoableEditEvent evt)
|
protected boolean |
undoFlagIsSet()
|
protected void |
unsetUndoFlag()
|
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Icon NULL_ICON
public static final String NULL_NAME
protected static final int TAB_WIDTH
protected static final int TAB_HEIGHT
protected static Dimension tabPaneInsets
public static final String FIXED
public static final String FLOAT_INTERNAL
public static final String FLOAT_EXTERNAL
protected List panels
protected PanelManager.Panel activePanel
protected PanelManager.WindowEventListener windowEventListener
protected EditPropagator editPropagator
protected HidePolicy hidePolicy
public RestrictedIndexTabbedPane tabPane
protected DynamicCommandViews commandViewJuggler
protected transient Vector panelManagerListeners
Constructor Detail |
---|
public PanelManager()
Method Detail |
---|
public void setAutoHide(boolean hideWhenNoPanels)
public CommandView getCommandView(String viewName)
CommandSource
getCommandView
in interface CommandSource
viewName
- The name of the view to be retrieved. Usually one of
CommandView.MAIN_MENU_VIEW, CommandView.CONTEXT_MENU_VIEW or
CommandView.TOOLBAR_VIEW, but custom views may be supported also.
public PanelManager.Panel addPanel(Component component, int index, String name, Icon icon)
component
- The component to be shown in the panel.index
- The positio of the panel within the panels list.name
- The name to display for the panel.icon
- The icon to display next to the panel (may be null).
public PanelManager.Panel addPanel(Component component, String name, Icon icon)
component
- The component to be shown in the panel.name
- The name to display for the panel.icon
- The icon to display next to the panel (may be null).
public PanelManager.Panel addPanel(Component component, int index)
component
- The component to be shown in the panel.index
- The positio of the panel within the panels list.
public PanelManager.Panel addPanel(Component component)
component
- The component to be shown in the panel.
public PanelManager.Panel addPanel(Component component, int index, String name, Icon icon, boolean showingName, boolean useScrollPane)
component
- The component to be shown in the panel.index
- The positio of the panel within the panels list.name
- The name to display for the panel.icon
- The icon to display next to the panel (may be null).showingName
- True if name should be shown.useScrollPane
- True if panel should be hosted within a
scroll pane.
protected void basicAddPanel(PanelManager.Panel panel, int index)
public void removeAllPanels()
public boolean containsPanel(PanelManager.Panel managedPanel)
public boolean removePanel(PanelManager.Panel managedPanel)
public PanelManager.Panel replacePanel(PanelManager.Panel oldPanel, Component newComponent, String name, Icon icon)
oldPanel
- The existing panel to replace.newComponent
- The new component to add.name
- The name of the new panel.icon
- The icon of the new panel.
public PanelManager.Panel replacePanel(PanelManager.Panel oldPanel, Component newComponent, String name)
oldPanel
- The existing panel to replace.newComponent
- The new component to add.name
- The name of the new panel.
public PanelManager.Panel replacePanel(PanelManager.Panel oldPanel, Component newComponent)
oldPanel
- The existing panel to replace.newComponent
- The new component to add.
public void setActivePanel(PanelManager.Panel newActivePanel)
public void setActiveIndex(int index)
index
- The index of the new active panel.setActivePanel(dsto.dfc.swing.panels.PanelManager.Panel)
public PanelManager.Panel getActivePanel()
setActivePanel(dsto.dfc.swing.panels.PanelManager.Panel)
public int getPanelCount()
public int indexOfPanel(PanelManager.Panel panel)
panel
- The panel.
public int indexOfActivePanel()
public PanelManager.Panel getPanelAt(int index)
public String nameForPanelAt(int index)
public PanelManager.Panel getPanel(Component component)
component
- The component.
public PanelManager.Panel getNextPanel(PanelManager.Panel startPanel)
protected void hideOldActivePanel()
protected void showNewActivePanel()
protected void showActivePanel(boolean show)
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public Dimension getMinimumSize()
getMinimumSize
in class JComponent
protected PanelManager.Panel getNextFixedPanel(PanelManager.Panel startPanel)
protected boolean listenersRejectPanelRemoval(PanelManager.Panel panel)
protected UndoableEdit createActivePanelEdit(int oldActiveIndex, int newActiveIndex)
protected void fireNewActivePanelEdit(int oldIndex, int newIndex)
protected boolean panelDoesNotFireEdits(int index)
protected FloatStateEdit createNewFloatStateEdit(String oldFloatState, String newFloatState)
protected void setUndoFlag()
setActivePanel(dsto.dfc.swing.panels.PanelManager.Panel)
make sure to invoke setUndoFlag
before the call and unsetUndoFlag()
after the
call.
protected void unsetUndoFlag()
protected boolean undoFlagIsSet()
public void addUndoableEditListener(UndoableEditListener listener)
addUndoableEditListener
in interface UndoableEditSource
public void removeUndoableEditListener(UndoableEditListener listener)
removeUndoableEditListener
in interface UndoableEditSource
public void undoableEditHappened(UndoableEditEvent evt)
undoableEditHappened
in interface UndoableEditListener
public void removePanelManagerListener(PanelManagerListener l)
public void addPanelManagerListener(PanelManagerListener l)
protected void firePanelAdded(PanelManagerEvent e)
protected void firePanelRemoved(PanelManagerEvent e)
protected void firePanelFloated(PanelManagerEvent e)
protected void firePanelUnfloated(PanelManagerEvent e)
protected boolean fireAboutToRemovePanel(PanelManager.Panel panel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |