|
JHotDraw 7.0.9 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DocumentView
Provides a view to a document inside of a document oriented Application.
A DocumentView usually goes through the following method calls after its creation: init), {@code setEnabled(false)}, ({@code clear} or {@code read}), {@code setEnabled(true)}, {@code start}
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener. |
void |
clear()
Clears the contents of the document view. |
void |
destroy()
Called by the WindowManager to inform this view that it is being reclaimed and that it should destroy of any resources that it has allocated. |
void |
execute(java.lang.Runnable worker)
Executes the specified runnable on the worker thread of the view. |
javax.swing.Action |
getAction(java.lang.String id)
Returns the action with the specified id. |
javax.swing.JComponent |
getComponent()
Returns the visual component of the view. |
java.io.File |
getFile()
Returns the file which is associated to this document view. |
java.lang.String |
getName()
Returns the name of the view. |
javax.swing.JFileChooser |
getOpenChooser()
Gets the open file chooser for the document view. |
javax.swing.JFileChooser |
getSaveChooser()
Gets the save file chooser for the document view. |
void |
init()
Called by the WindowManager to inform this view that it has been loaded into the system. |
boolean |
isEnabled()
Determines whether this view is enabled. |
boolean |
isModified()
Returns true, if the document view has unsaved changes. |
void |
putAction(java.lang.String id,
javax.swing.Action action)
Puts an action with the specified id. |
void |
read(java.io.File f)
Reads contents for the document view from the specified file. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener. |
void |
setEnabled(boolean newValue)
Sets the enabled state of the view. |
void |
setFile(java.io.File newValue)
Associates the document view with a file. |
void |
setModified(boolean newValue)
Sets the modified state of the document view. |
void |
setName(java.lang.String newValue)
Sets the name of the view. |
void |
start()
Called by the WindowManager to inform this view that it should start its execution. |
void |
stop()
Called by the WindowManager to inform this view that it should stop its execution. |
void |
write(java.io.File f)
Writes the contents of the view to the specified file. |
Method Detail |
---|
javax.swing.JComponent getComponent()
void setName(java.lang.String newValue)
newValue
- the new name of the viewjava.lang.String getName()
void init()
start
method is called.
void destroy()
stop
method will always be called before
destroy
.
void start()
init
method and each
time the window wich contains the view is made visible or restored from
minimized state.
void stop()
boolean isEnabled()
Actions that act on the view must check in their actionPerformed method whether the view is enabled. If the document view is disabled, they must do nothing. Ideally, Actions which perform on a view, couple their enabled state with the enabled state of the view.
void setEnabled(boolean newValue)
The enabled state is used to prevent parallel invocation of actions on the document view. If an action consists of a sequential part and a concurrent part, it must disable the document view only for the sequential part. This is a bound property.
void execute(java.lang.Runnable worker)
javax.swing.Action getAction(java.lang.String id)
void putAction(java.lang.String id, javax.swing.Action action)
void addPropertyChangeListener(java.beans.PropertyChangeListener l)
void removePropertyChangeListener(java.beans.PropertyChangeListener l)
java.io.File getFile()
the
- file associated with this document view, or null.void setFile(java.io.File newValue)
Changing the value of this property does not trigger file loading or saving.
file
- the file associated with this document view. Null
values are allowed.void clear() throws java.io.IOException
The cleared contents does not need to be entirely empty. A view may read a template from the file system or another slow media, to get its cleared state.
By convention this method is never invoked on the AWT Event Dispatcher Thread. The view needs to be disabled before this method is invoked, and needs to be enabled afterwards.
java.io.IOException
void write(java.io.File f) throws java.io.IOException
By convention this method is never invoked on the AWT Event Dispatcher Thread. The view needs to be disabled before this method is invoked, and needs to be enabled afterwards.
f
- The file.
java.io.IOException
void read(java.io.File f) throws java.io.IOException
By convention this method is never invoked on the AWT Event Dispatcher Thread. The view needs to be disabled before this method is invoked, and needs to be enabled afterwards.
f
- The file.
java.io.IOException
javax.swing.JFileChooser getOpenChooser()
The document view can accessorize the file chooser. The document view should keep the file chooser instance over multiple invocations of this method, so that it remembers its state.
javax.swing.JFileChooser getSaveChooser()
The document view can accessorize the file chooser. The document view should keep the file chooser instance over multiple invocations of this method, so that it remembers its state.
boolean isModified()
void setModified(boolean newValue)
A view should change its modified state by itself, when its contents is modified.
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |