|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.gui.tutorial.AbstractApplication
public abstract class AbstractApplication
An abstract implementation of the Application interface. This class implements the common elements of the Application abstraction, and takes care of listener notification for documents and properties. Concrete subclasses will generally override a number of these methods to add their own behavior. Most importantly, this abstract class does not provide any support for creating documents, or managing the views of those documents. For an example of one way of managing the view associated with a document, see MDIApplication.
Red |
Field Summary | |
---|---|
private java.util.HashMap |
_actions
Remembered actions |
private AppContext |
_appContext
The frame that this application displays in |
private java.awt.datatransfer.Clipboard |
_clipboard
The clipboard |
private DocumentFactory |
_documentFactory
The factory that creates graph documents |
private java.util.HashMap |
_documentMap
Map documents to their views. |
private ListDataModel |
_documents
The list of documents |
private java.beans.PropertyChangeSupport |
_propertyChangeSupport
The support object for property changes |
private RelativeBundle |
_resources
The resources object |
private StoragePolicy |
_storagePolicy
Our storage policy |
private ListDataModel |
_views
The list of views |
Constructor Summary | |
---|---|
AbstractApplication(AppContext context)
Create an abstract application that resides in the given context (e.g. a frame or an applet). |
Method Summary | |
---|---|
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 list of documents currently known by this application. |
void |
addDocumentListener(javax.swing.event.ListDataListener listener)
Add a document listener to this application. |
javax.swing.JMenuItem |
addMenuItem(javax.swing.JMenu menu,
javax.swing.Action action,
int mnemonic,
java.lang.String tooltip)
Deprecated. Use method in GUIUtilities instead. |
javax.swing.JMenuItem |
addMenuItem(javax.swing.JMenu menu,
java.lang.String label,
javax.swing.Action action,
int mnemonic,
java.lang.String tooltip,
boolean isEnabled)
Deprecated. Use method in GUIUtilities instead. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this application. |
javax.swing.JButton |
addToolBarButton(javax.swing.JToolBar toolbar,
javax.swing.Action action,
java.lang.String tooltip,
javax.swing.Icon icon)
Deprecated. Use method in GUIUtilities instead. |
javax.swing.JButton |
addToolBarButton(javax.swing.JToolBar toolbar,
javax.swing.Action action,
java.lang.String tooltip,
javax.swing.Icon icon,
boolean isEnabled)
Deprecated. Use method in GUIUtilities instead. |
void |
addView(View v)
Add a view to the list of views currently known by this application. |
void |
addViewListener(javax.swing.event.ListDataListener listener)
Add a view listener to this application. |
boolean |
closeDocument(Document d)
Try to close the given document using the storage policy. |
boolean |
closeView(View v)
Try to close the given view using the storage policy. |
abstract View |
createView(Document d)
Create a view to display the given document. |
java.util.List |
documentList()
Get list of all document objects known by this application. |
javax.swing.Action |
getAction(java.lang.String name)
Get an action by name. |
AppContext |
getAppContext()
Get the frame that this application draws itself in. |
java.awt.datatransfer.Clipboard |
getClipboard()
Get the clipboard object for this application. |
View |
getCurrentView()
Get the current view. |
DocumentFactory |
getDocumentFactory()
Get the factory that creates new documents |
RelativeBundle |
getResources()
Get the resources object. |
StoragePolicy |
getStoragePolicy()
Get the storage policy of this application. |
abstract java.lang.String |
getTitle()
Get the title of this application |
boolean |
isVisible()
Test whether the application frame is visible. |
void |
removeDocument(Document d)
Remove a document from the list of documents currently known by this application, and remove all of the views associated with this document. |
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)
Remove a view from the list of views currently known by this application. |
void |
removeViewListener(javax.swing.event.ListDataListener listener)
Remove a view list listener from this application. |
protected void |
setAppContext(AppContext ac)
Set the app context that this application draws itself in. |
void |
setClipboard(java.awt.datatransfer.Clipboard clipboard)
Set the clipboard that is used by this application. |
void |
setCurrentView(View v)
Set the given view to be the current view. |
protected void |
setDocumentFactory(DocumentFactory df)
Set the factory that creates new documents for use by subclasses constructors only. |
void |
setStoragePolicy(StoragePolicy sp)
Set the storage policy of this application, for use by subclass constructors only |
void |
setVisible(boolean visible)
Set the visibility of the application's frame |
void |
showError(java.lang.String op,
java.lang.Exception e)
Show an error in a dialog box with stack trace. |
java.util.List |
viewList()
Get a list of all view objects known by this application. |
java.util.List |
viewList(Document d)
Get a list of all view objects known by this application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private RelativeBundle _resources
private java.beans.PropertyChangeSupport _propertyChangeSupport
private AppContext _appContext
private ListDataModel _documents
private ListDataModel _views
private java.util.HashMap _actions
private java.util.HashMap _documentMap
private DocumentFactory _documentFactory
private StoragePolicy _storagePolicy
private java.awt.datatransfer.Clipboard _clipboard
Constructor Detail |
---|
public AbstractApplication(AppContext context)
Method Detail |
---|
public java.util.Iterator actions()
actions
in interface Application
public void addAction(javax.swing.Action action)
addAction
in interface Application
public javax.swing.JMenuItem addMenuItem(javax.swing.JMenu menu, javax.swing.Action action, int mnemonic, java.lang.String tooltip)
public javax.swing.JMenuItem addMenuItem(javax.swing.JMenu menu, java.lang.String label, javax.swing.Action action, int mnemonic, java.lang.String tooltip, boolean isEnabled)
public javax.swing.JButton addToolBarButton(javax.swing.JToolBar toolbar, javax.swing.Action action, java.lang.String tooltip, javax.swing.Icon icon)
public javax.swing.JButton addToolBarButton(javax.swing.JToolBar toolbar, javax.swing.Action action, java.lang.String tooltip, javax.swing.Icon icon, boolean isEnabled)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface Application
public void addDocument(Document d)
addDocument
in interface Application
public void addView(View v)
addView
in interface Application
public void addDocumentListener(javax.swing.event.ListDataListener listener)
addDocumentListener
in interface Application
public void addViewListener(javax.swing.event.ListDataListener listener)
addViewListener
in interface Application
public boolean closeDocument(Document d)
closeDocument
in interface Application
public boolean closeView(View v)
closeView
in interface Application
public abstract View createView(Document d)
createView
in interface Application
public java.util.List documentList()
documentList
in interface Application
public javax.swing.Action getAction(java.lang.String name)
getAction
in interface Application
public AppContext getAppContext()
getAppContext
in interface Application
public java.awt.datatransfer.Clipboard getClipboard()
getClipboard
in interface Application
public View getCurrentView()
getCurrentView
in interface Application
public DocumentFactory getDocumentFactory()
getDocumentFactory
in interface Application
public RelativeBundle getResources()
public StoragePolicy getStoragePolicy()
getStoragePolicy
in interface Application
public abstract java.lang.String getTitle()
getTitle
in interface Application
public boolean isVisible()
isVisible
in interface Application
public void removeDocument(Document d)
removeDocument
in interface Application
public void removeView(View v)
removeView
in interface Application
public void removeDocumentListener(javax.swing.event.ListDataListener listener)
removeDocumentListener
in interface Application
public void removeViewListener(javax.swing.event.ListDataListener listener)
removeViewListener
in interface Application
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface Application
public void setClipboard(java.awt.datatransfer.Clipboard clipboard)
setClipboard(Toolkit.getDefaultToolkit().getSystemClipboard())
public void setCurrentView(View v)
setCurrentView
in interface Application
protected void setDocumentFactory(DocumentFactory df)
public void setStoragePolicy(StoragePolicy sp)
public void setVisible(boolean visible)
setVisible
in interface Application
public void showError(java.lang.String op, java.lang.Exception e)
showError
in interface Application
protected void setAppContext(AppContext ac)
public java.util.List viewList()
viewList
in interface Application
public java.util.List viewList(Document d)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |