Package diva.gui.tutorial
Class MDIApplication
- java.lang.Object
-
- diva.gui.tutorial.AbstractApplication
-
- diva.gui.tutorial.MDIApplication
-
- All Implemented Interfaces:
Application
- Direct Known Subclasses:
MDIApplicationTutorial
public abstract class MDIApplication extends AbstractApplication
An abstract superclass for applications that use an MDI (multiple document interface) style of presentation. This class manages the interaction between documents of the application, and the frame that they are displayed in. For example, keeping documents and views in sync, handling focus changes, and so on. The context must implement MDIContext for this to work properly. Note: this application only manages one view per document. If you have multiple views per document, you will need to implement the view-document mapping yourself.- Version:
- $Id$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description MDIApplication(MDIContext context)
Create an MDI application in the given MDI context
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addView(View v)
Add a view to the list of views currently known by this application.abstract View
createView(Document d)
Given a document, create a new view which displays that document.MDIContext
getMDIContext()
Get the MDI frame -- type-specific version of getApplicationFrame().View
getView(javax.swing.JComponent c)
Get the Document displayed by the given component.void
removeView(View v)
Remove a view from the list of view currently known by this application.void
setCurrentView(View v)
Set the given document to be the current document, and raise the internal window that corresponds to that component.-
Methods inherited from class diva.gui.tutorial.AbstractApplication
actions, addAction, addDocument, addDocumentListener, addMenuItem, addMenuItem, addPropertyChangeListener, addToolBarButton, addToolBarButton, addViewListener, closeDocument, closeView, documentList, getAction, getAppContext, getClipboard, getCurrentView, getDocumentFactory, getResources, getStoragePolicy, getTitle, isVisible, removeDocument, removeDocumentListener, removePropertyChangeListener, removeViewListener, setAppContext, setClipboard, setDocumentFactory, setStoragePolicy, setVisible, showError, viewList, viewList
-
-
-
-
Constructor Detail
-
MDIApplication
public MDIApplication(MDIContext context)
Create an MDI application in the given MDI context
-
-
Method Detail
-
addView
public void addView(View v)
Description copied from class:AbstractApplication
Add a view to the list of views currently known by this application. Fire a view list event to registered listeners. Throw an exception if the view is already in the list of views.- Specified by:
addView
in interfaceApplication
- Overrides:
addView
in classAbstractApplication
-
createView
public abstract View createView(Document d)
Given a document, create a new view which displays that document. Subclasses must implement this method to create, initialize, and then return a View object that wraps a JComponent.- Specified by:
createView
in interfaceApplication
- Specified by:
createView
in classAbstractApplication
-
getMDIContext
public MDIContext getMDIContext()
Get the MDI frame -- type-specific version of getApplicationFrame().
-
getView
public View getView(javax.swing.JComponent c)
Get the Document displayed by the given component.
-
removeView
public void removeView(View v)
Remove a view from the list of view currently known by this application. Fire a document list event to registered listeners. Throw an exception if the document is not known. This method assumes that setCurrentView will be called subsequently on another view.- Specified by:
removeView
in interfaceApplication
- Overrides:
removeView
in classAbstractApplication
-
setCurrentView
public void setCurrentView(View v)
Set the given document to be the current document, and raise the internal window that corresponds to that component.- Specified by:
setCurrentView
in interfaceApplication
- Overrides:
setCurrentView
in classAbstractApplication
-
-