|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.tensegrity.gui.swing.document.DockMDIComponent
This class implements a SwingMDIComponent with docking functionality.
The terminology used for the DockMDIComponent is as follows:
DockMDIComponent.
A DockMDIComponent manages the two skeleton item types
Document and Container. A Document is
added by invoking one of the addDocument methods. A Container
is added by first invoking the registerContainerView(String, Container, Icon, JMenuItem)
method to register the container as a view and then subsequently invoking
showContainerView(String, String[]) to display a previously
registered container.
With this class you have the ability to configure a screen layout. This process is limited, however, to the screen layout for the views - currently there is no notion of supporting or persisting documents in a screen layout.
The process of configuring a screen layout is done as follows:
The splitpane is made up of a tree with splits as inner nodes and tabpanes
as leaves. This tree is set up in different ways in the method
resetScreenLayout(int). Tabs are assigned symbolic names which
are used when calling method showContainerView(String, String[]).
Two standard screen layouts are provided. To override those subclass
DOCKMdiComponent and override onScreenLayout0()
and onScreenLayout1().
Views inside the screen layout can be further customized after reset
by means of the hooks onScreenLayoutInit0()
and onScreenLayoutInit1().
| Nested Class Summary | |
static class |
DockMDIComponent.ConfigNode
|
static class |
DockMDIComponent.SplitConfigNode
|
static class |
DockMDIComponent.TabConfigNode
|
static class |
DockMDIComponent.ViewConfig
View config root class. |
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
static java.lang.Object |
EDITOR_TAG
Tag for identifying editor entries. |
| 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 | |
DockMDIComponent(java.util.List initialdocuments,
MenuTool menutool,
Command closeDocumentCommand,
UIManager uimanager)
Constructs a new DockMDIComponent. |
|
| Method Summary | |
void |
addDocument(Document document)
Adds the given Document to the container. |
void |
addDocumentListener(DocumentListener listener)
Adds a document listener. |
void |
addObserver(Observer o)
Adds an observer to the internally managed list of observers of this observable. |
void |
applyEvList()
Tells the component to apply its UIItemEvaluationList. |
void |
applyViewConfig(View view,
DockMDIComponent.ViewConfig viewconfig)
Applies a given DockMDIComponent.ViewConfig memento object to the given
View. |
void |
clearChanged()
Sets the state to unchanged. |
void |
deleteObserver(Observer o)
Deletes an observer from the internally managed list of observers of this observable. |
void |
deleteObservers()
Deletes all of the observers registered with this observable. |
void |
fireDocumentDataChanged(Document document)
Fires the document data changed event from the outside world. |
Document |
getActiveDocument()
Returns the active document. |
int |
getDocumentCount()
Returns the number of currently open documents. |
java.util.List |
getDocuments()
Returns a List containing all active documents. |
TabEntry |
getEntryForComponent(javax.swing.JComponent component)
Returns the TabEntry for the given component.
|
TabEntry |
getEntryForDocument(Document document)
Returns the TabEntry for the given Document.
|
javax.swing.JComponent |
getJComponent()
Returns the JComponent subclass that is the MDI container. |
MenuTool |
getMenuTool()
Returns the MenuTool of this MDIComponent. |
Observable |
getObservable()
Returns the Observable instance. |
java.util.Collection |
getObservers()
Returns a collection of the observers currently registered with this observable. |
TabEntry |
getRegisteredEntry(java.lang.String name)
|
javax.swing.JSplitPane[] |
getSplitpanes()
Returns the splitpanes (legacy method, to be removed). |
View |
getView()
Returns the View of this instance.
|
TabPane |
getViewByName(java.lang.String name)
Returns the view for the given name or null if it is not
found. |
void |
indicateModifiedDocument(Document document)
The mdi component shall indicate visually that the given document was modified. |
void |
indicateUnmodifiedDocument(Document document)
The mdi component shall indicate visually that the given document was not modified. |
void |
installEvList()
Tells the component to setup its internal state. |
void |
killEmptyWindows()
Kills all empty windows (tabpanes). |
void |
notifyObservers()
Performs a notify on all registered observers, if the state has changed since the last notification. |
void |
notifyObservers(java.lang.Object arg)
Performs a notify on all registered observers, if the state has changed since the last notification. |
void |
onScreenLayout0()
Hook method to adjust screen-layout 0. |
void |
onScreenLayout1()
Hook method to adjust screen-layout 0. |
void |
onScreenLayoutInit0()
Hook method to adjust views after screen-layout 0 is initialized. |
void |
onScreenLayoutInit1()
Hook method to adjust views after screen-layout 1 is initialized. |
void |
postReset()
|
void |
postValidate()
Invoked by the framework after the MDIComponent was shown on the screen. |
void |
recordEntryIndex(TabPane tabpane,
TabEntry entry)
|
DockMDIComponent.ViewConfig |
recordViewConfig(View view)
Records the state of a View and returns it in a memento object. |
void |
recoverView(java.lang.String name,
java.lang.String[] preftabnames,
boolean defaultTabPane)
|
void |
registerContainerView(java.lang.String name,
Container container,
javax.swing.Icon icon,
javax.swing.JMenuItem menuitem)
Registers a view for a specific container. |
void |
rehashNamesFromContainers()
Rebuilds the entry names from the container names. |
void |
removeActiveDocument()
Closes the active document. |
void |
removeDocument(Document document)
Closes the given document and removes it from the mdi container. |
void |
removeDocumentListener(DocumentListener listener)
Removes a document listener. |
void |
renameDocument(Document document,
java.lang.String name)
Renames a document. |
void |
resetScreenLayout(int i)
Resets the screen-layout with the given index. |
void |
restoreEditors(TabEntry[] editors)
Internal helper, restores editors. |
void |
setActiveDocument(Document document)
Sets the active document. |
void |
setChanged()
Sets the state to changed. |
void |
setDocumentListener(DocumentListener documentlistener)
Sets a single document listener. |
void |
setEditorBackground(javax.swing.Icon icon)
Sets a background icon for all editor-panes. |
void |
setObservable(Observable observable)
Sets an observable. |
void |
setSplitPanes(javax.swing.JSplitPane[] splitpanes)
Sets the splitpanes (legacy method, to be removed). |
void |
showContainerView(java.lang.String name,
java.lang.String[] preftabnames)
Displays the view for the given name in the preferred tabpane. |
void |
showContainerView(java.lang.String name,
java.lang.String[] preftabnames,
boolean defaultTabPane)
Displays the view for the given name in the preferred tabpane. |
void |
viewChanged(ViewEvent event)
Invoked when the view has changed. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.Object EDITOR_TAG
| Constructor Detail |
public DockMDIComponent(java.util.List initialdocuments,
MenuTool menutool,
Command closeDocumentCommand,
UIManager uimanager)
DockMDIComponent.
initialdocuments - list of initial documents, null
is allowed here.menutool - the MenuTool reference.closeDocumentCommand - the close-command to invoke prior to
closing documents.uimanager - the UIManager reference used for i18n.| Method Detail |
public javax.swing.JComponent getJComponent()
SwingMDIComponent
getJComponent in interface SwingMDIComponentpublic void applyEvList()
EvaluableUIItemEvaluationList.
applyEvList in interface Evaluablepublic void installEvList()
Evaluable
installEvList in interface Evaluablepublic void addDocumentListener(DocumentListener listener)
MDIComponent
addDocumentListener in interface MDIComponentlistener - the documentlistener to add.public void removeDocumentListener(DocumentListener listener)
MDIComponent
removeDocumentListener in interface MDIComponentlistener - the documentlistener to remove.public void setDocumentListener(DocumentListener documentlistener)
MDIComponent
setDocumentListener in interface MDIComponentdocumentlistener - the documentlistener to set.public void fireDocumentDataChanged(Document document)
MDIComponent
fireDocumentDataChanged in interface MDIComponentdocument - the document whose data has changed.public int getDocumentCount()
MDIComponent
getDocumentCount in interface MDIComponentpublic java.util.List getDocuments()
MDIComponentList containing all active documents.
getDocuments in interface MDIComponentpublic void addDocument(Document document)
MDIComponentDocument to the container.
addDocument in interface MDIComponentdocument - the document to add to the container.public void removeDocument(Document document)
MDIComponent
removeDocument in interface MDIComponentdocument - the document to close and remove.public Document getActiveDocument()
MDIComponent
getActiveDocument in interface MDIComponentpublic void setActiveDocument(Document document)
MDIComponent
setActiveDocument in interface MDIComponentdocument - the document to activate.public void removeActiveDocument()
MDIComponent
removeActiveDocument in interface MDIComponent
public void renameDocument(Document document,
java.lang.String name)
MDIComponent
renameDocument in interface MDIComponentdocument - the document to rename.name - the new name for the document.public void indicateModifiedDocument(Document document)
MDIComponent
indicateModifiedDocument in interface MDIComponentdocument - the modified document.public void indicateUnmodifiedDocument(Document document)
MDIComponent
indicateUnmodifiedDocument in interface MDIComponentdocument - the unmodified document.public void postValidate()
MDIComponent
postValidate in interface MDIComponentpublic Observable getObservable()
MDIComponent
getObservable in interface MDIComponentpublic void addObserver(Observer o)
Observable
addObserver in interface Observableo - the observer to add to the internal list.public void deleteObserver(Observer o)
Observable
deleteObserver in interface Observableo - the observer to delete from the internal list.public void notifyObservers()
Observable
notifyObservers in interface ObservableObservable.setChanged()public void notifyObservers(java.lang.Object arg)
Observable
notifyObservers in interface Observablearg - additional argument to pass to the observers.Observable.setChanged()public void setObservable(Observable observable)
MDIComponent
setObservable in interface MDIComponentobservable - the observable to set for the mdi component.public void setChanged()
Observable
setChanged in interface Observablepublic void clearChanged()
Observable
clearChanged in interface Observablepublic java.util.Collection getObservers()
Observable
getObservers in interface Observablepublic void deleteObservers()
Observable
deleteObservers in interface Observablepublic void viewChanged(ViewEvent event)
ViewListener
viewChanged in interface ViewListenerevent - the view-change event information.public void setSplitPanes(javax.swing.JSplitPane[] splitpanes)
splitpanes - the splitpanes.public javax.swing.JSplitPane[] getSplitpanes()
public final MenuTool getMenuTool()
MenuTool of this MDIComponent.
MenuTool of this MDIComponent.public final TabEntry getEntryForDocument(Document document)
TabEntry for the given Document.
This method is docking-framework related only. Not to be used by clients
directly.
document - the document to look up.
TabEntry for the given document or null.public final TabEntry getEntryForComponent(javax.swing.JComponent component)
TabEntry for the given component.
This method is docking-framework related only. Not to be used by clients
directly.
component - the component to look up.
TabEntry for the given component or null.public final void resetScreenLayout(int i)
i - the index of the screen-layout to reset.public void onScreenLayout0()
public void onScreenLayoutInit0()
public void onScreenLayout1()
public void onScreenLayoutInit1()
public final void restoreEditors(TabEntry[] editors)
editors - the editors to restore.public final TabPane getViewByName(java.lang.String name)
null if it is not
found.
name - the view-name.
null.public final void killEmptyWindows()
public final void registerContainerView(java.lang.String name,
Container container,
javax.swing.Icon icon,
javax.swing.JMenuItem menuitem)
name - the name of the view.container - the Container to place inside the view.icon - the icon of the view.menuitem - optional menuitempublic TabEntry getRegisteredEntry(java.lang.String name)
public final void showContainerView(java.lang.String name,
java.lang.String[] preftabnames)
name - the name of the view to display.
public final void showContainerView(java.lang.String name,
java.lang.String[] preftabnames,
boolean defaultTabPane)
name - the name of the view to display.preftabnames - the preferred tabpanes indexed by the current
screen-layout.defaultTabPane - whether to apply additional magic to recreate
the desired tabpane or whether to use the first available one.public final void rehashNamesFromContainers()
public final View getView()
View of this instance.
This method is docking-framework related only. Not to be used by clients
directly.
View of this instance.public final void setEditorBackground(javax.swing.Icon icon)
icon - the icon to show as the background.public DockMDIComponent.ViewConfig recordViewConfig(View view)
View and returns it in a memento object.
view - the View whose state is to be recorded.
public final void applyViewConfig(View view,
DockMDIComponent.ViewConfig viewconfig)
DockMDIComponent.ViewConfig memento object to the given
View.
view - the View to apply the memento to.viewconfig - the DockMDIComponent.ViewConfig memento object.public void postReset()
public void recoverView(java.lang.String name,
java.lang.String[] preftabnames,
boolean defaultTabPane)
public void recordEntryIndex(TabPane tabpane,
TabEntry entry)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||