|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.bs.mdi.Document
The Document class manages data and views.
A document consists of two major components:
its data and one or more views, which are represented by the
RootData and RootView classes.
The combination of data and views is called a Document.
| Constructor Summary | |
protected |
Document(Application app)
|
| Method Summary | |
void |
addView(RootView view)
Associates the specified view with this document. |
boolean |
close()
Tries to close this document. |
int |
countViews()
Returns the number of views associated with this document. |
static Document |
createNew()
Creates a new document. |
String |
getBaseFilename()
Returns the basename of the document's filename. |
RootData |
getData()
Returns the data associated with this document. |
String |
getFilename()
Returns the document's filename. |
Printer |
getPrinter()
Convenience method for getting the RootData's printer. |
UndoManager |
getUndoManager()
Gets the UndoManager of this Document. |
RootView |
getView(int index)
Gets the specified view. |
Iterator |
getViewIterator()
Gets an iterator for all views associated with this document. |
RootView[] |
getViews()
Gets an array containing all root views. |
boolean |
isDirty()
Returns if this document is "dirty", i.e. contains unsaved data. |
boolean |
isFileExistent()
Returns true if the document's filename already exists. |
boolean |
isOpened()
Tells if this document is still opened. |
boolean |
isRedoPossible()
Convenience function for calling getUndoManager().isRedoPossible(); |
boolean |
isUndoPossible()
Convenience function for calling getUndoManager().isUndoPossible(); |
static Document |
open(String filename)
Opens an existing document. |
Action |
redo()
Convenience function for calling getUndoManager().redo(); |
void |
removeView(RootView view)
Removes the specified view from this document. |
void |
save(String filename)
Saves this document to a file. |
void |
setDirty(boolean dirty)
Set's the "dirty" status of a document. |
protected void |
setFilename(String filename)
Sets the filename and the baseFilename. |
void |
syncViewsWithData()
Synchronize all root views with the data. |
Action |
undo()
Convenience function for calling getUndoManager().undo(); |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected Document(Application app)
| Method Detail |
public boolean isDirty()
public boolean isFileExistent()
public String getFilename()
Note that every document has a filename, even if the document has not yet been saved. The filename of a newly created document could be "Untitled-1", for example.
public String getBaseFilename()
public RootData getData()
public RootView getView(int index)
index - the index of the view
public RootView[] getViews()
public Iterator getViewIterator()
public int countViews()
public void addView(RootView view)
view - the view to be associated with this documentpublic void removeView(RootView view)
view - the view to be removedpublic void syncViewsWithData()
View.syncWithData() for every associated root view.
public UndoManager getUndoManager()
public Printer getPrinter()
getData().getPrinter().
public void setDirty(boolean dirty)
A document is dirty if it contains unsaved modifications.
dirty - true if the document should be considered dirty, false otherwisepublic static Document createNew()
public static Document open(String filename)
throws FileIOException
filename - the document's filename
FileIOException
public void save(String filename)
throws FileIOException
filename - the filename to be used
FileIOExceptionpublic boolean isOpened()
public boolean close()
close() method succeed.
public Action undo()
public Action redo()
public boolean isUndoPossible()
public boolean isRedoPossible()
protected void setFilename(String filename)
filename - the new filename
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||