Package diva.gui
Interface Application
-
- All Known Implementing Classes:
AbstractApplication
,ApplicationTutorial
,MDIApplication
,MDIApplicationTutorial
public interface Application
Application is an interface that captures the notion of a graphical application. An application is associated with an ApplicationFrame, and contains a set of Documents. All applications will need to create an implementation of this interface.- Version:
- $Id$
- Author:
- John Reekie
- Pt.AcceptedRating:
- Red
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Iterator
actions()
Get an iterator over the names of the actions that are contained by this application.void
addAction(javax.swing.Action action)
Add an action to the table of actions.void
addDocument(Document d)
Add a document to the application and notify document listeners.void
addDocumentListener(javax.swing.event.ListDataListener listener)
Add a document listener to this application.void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this application.void
addView(View d)
Add a view to the application and notify view listeners.void
addViewListener(javax.swing.event.ListDataListener listener)
Add a view listener to this application.boolean
closeDocument(Document d)
Try to close the given document, respecting the storage policy.boolean
closeView(View v)
Try to close the given view, respecting the storage policy.View
createView(Document d)
Create a view to display the given document.java.util.List
documentList()
Get an iterator over all documentsjavax.swing.Action
getAction(java.lang.String name)
Get an action by name.AppContext
getAppContext()
Get the context that this application draws itself in.java.awt.datatransfer.Clipboard
getClipboard()
Return the clipboard used by this application.View
getCurrentView()
Get the current view.DocumentFactory
getDocumentFactory()
Get the factory that this application uses to create document objects.StoragePolicy
getStoragePolicy()
Get the storage policy of this application.java.lang.String
getTitle()
Get the title of this applicationboolean
isVisible()
Test whether the application frame is visible.void
removeDocument(Document d)
This method should only be called by storage policies.void
removeDocumentListener(javax.swing.event.ListDataListener listener)
Remove a document list listener from this application.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this application.void
removeView(View v)
This method should only be called by storage policies.void
removeViewListener(javax.swing.event.ListDataListener listener)
Remove a view list listener from this application.void
setCurrentView(View v)
Set the given view to be the current view.void
setVisible(boolean visible)
Set the visibility of the application's framevoid
showError(java.lang.String op, java.lang.Exception e)
Report that an exception occurred to the user.java.util.List
viewList()
Get an iterator over all views
-
-
-
Method Detail
-
actions
java.util.Iterator actions()
Get an iterator over the names of the actions that are contained by this application.
-
addAction
void addAction(javax.swing.Action action)
Add an action to the table of actions. Every action known by the application should be added to this list so it can be retrieved and invoked later. The action name must be unique in this application.
-
addDocument
void addDocument(Document d)
Add a document to the application and notify document listeners. Throw an exception if the document is already in the list of documents.
-
addDocumentListener
void addDocumentListener(javax.swing.event.ListDataListener listener)
Add a document listener to this application. The document listener is in fact a ListDataListener, which will be notified with intervalAdded() and intervalRemoved() events when documents are added or removed, and with a contentsChanged() event when the current document is changed.
-
addView
void addView(View d)
Add a view to the application and notify view listeners. Throw an exception if the view is already in the list of views.
-
addViewListener
void addViewListener(javax.swing.event.ListDataListener listener)
Add a view listener to this application. The view listener is in fact a ListDataListener, which will be notified with intervalAdded() and intervalRemoved() events when views are added or removed, and with a contentsChanged() event when the current view is changed.
-
addPropertyChangeListener
void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this application. Changes to certain elements of the state of the application require that registered property change listeners be notified of the change.
-
closeDocument
boolean closeDocument(Document d)
Try to close the given document, respecting the storage policy. Return whether or not the operation was successful.
-
closeView
boolean closeView(View v)
Try to close the given view, respecting the storage policy. Return whether or not the operation was successful.
-
createView
View createView(Document d)
Create a view to display the given document. The document should already be added to the application. After calling this method, most callers should set this view to be the current view.
-
documentList
java.util.List documentList()
Get an iterator over all documents
-
viewList
java.util.List viewList()
Get an iterator over all views
-
getAction
javax.swing.Action getAction(java.lang.String name)
Get an action by name.
-
getCurrentView
View getCurrentView()
Get the current view. Generally, this will be the one that is displayed in the window that is top-most in the display. Return null if there is no current document.
-
getClipboard
java.awt.datatransfer.Clipboard getClipboard()
Return the clipboard used by this application.
-
getDocumentFactory
DocumentFactory getDocumentFactory()
Get the factory that this application uses to create document objects.
-
getAppContext
AppContext getAppContext()
Get the context that this application draws itself in. Some applications may have more one than one frame, in which case they probably want to designate one as the "main frame" (heh heh).
-
getStoragePolicy
StoragePolicy getStoragePolicy()
Get the storage policy of this application.
-
getTitle
java.lang.String getTitle()
Get the title of this application
-
isVisible
boolean isVisible()
Test whether the application frame is visible. Return false if the application has no frame or if the frame is not visible.
-
removeDocument
void removeDocument(Document d)
This method should only be called by storage policies. It removes a document from the list of documents currently known by this application, and remove all of the views associated with this document. Fire a list data event to registered document listeners. Throw an exception if the document is not known.
-
removeView
void removeView(View v)
This method should only be called by storage policies. It removes a view from the list of views currently known by this application. Fire a list data event to registered view listeners. If the removed view is the current view it is up to the application to decide which view to display next. Throw an exception if the view is not known.
-
removeDocumentListener
void removeDocumentListener(javax.swing.event.ListDataListener listener)
Remove a document list listener from this application.
-
removeViewListener
void removeViewListener(javax.swing.event.ListDataListener listener)
Remove a view list listener from this application.
-
removePropertyChangeListener
void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this application.
-
setCurrentView
void setCurrentView(View v)
Set the given view to be the current view. Fire a contentsChanged() event to registered view listeners. Throw an exception of the view is not known.
-
setVisible
void setVisible(boolean visible)
Set the visibility of the application's frame
-
showError
void showError(java.lang.String op, java.lang.Exception e)
Report that an exception occurred to the user.
-
-