jcreek.cke.document
Interface CreekDocument

All Superinterfaces:
Context, java.io.Serializable
All Known Implementing Classes:
SerializeGraphDocument

public interface CreekDocument
extends Context

This defines the interface for which all document classes will implement. Classes that implement this interface can act as the document objects within the Creek program, coordinating the model, view, and disk files associated with a graph.

Version:
Author:

Method Summary
 void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Registers an UndoableEditListener with this document.
 void close()
          This is provided as a convenience to the document so it may free any resources its been using or remove objects from change lists.
 CreekModel getModel()
          Returns the reference to the object acting as the model for this document.
 java.lang.String getTitle()
          Returns the Title of the document is reading and writing to.
 ConceptView getView()
          Returns the reference to the object acting as the view for this document.
 boolean isDirty()
          Returns the current dirty status of this document.
 boolean isTitled()
          Returns true if the document is currently named.
 void open()
          The document is opened.
 boolean performCommand(CreekCommand command)
          Perform the given command and fire an undoable edit event.
 void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Removes an UndoableEditListener from this document.
 boolean revert()
          Reverts this document (the graph data) to the last-saved version of the knowledgeModel.
 boolean revert(Graph g, java.lang.String title)
           
 void setTitle(java.lang.String title)
          Returns the reference to the file object for this document.
 void setTitled(boolean titled)
          Tells the document whether it has a title or not.
 void setView(ConceptView view)
          Sets the view this document is associated with.
 
Methods inherited from interface jcreek.representation.Context
getKnowledgeModel
 

Method Detail

addUndoableEditListener

public void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
Registers an UndoableEditListener with this document. As commands are performed on the document undoable edit events will be sent out to all the listeners.

Parameters:
l - listern to add to this document
See Also:
removeUndoableEditListener(javax.swing.event.UndoableEditListener)

open

public void open()
The document is opened.


close

public void close()
This is provided as a convenience to the document so it may free any resources its been using or remove objects from change lists. It should not try to save the document at this time.


getModel

public CreekModel getModel()
Returns the reference to the object acting as the model for this document. The particular implementation of this model depends on the implemention of CreekDocument.

Returns:
reference to model object

getTitle

public java.lang.String getTitle()
Returns the Title of the document is reading and writing to.

Returns:
name of the document

getView

public ConceptView getView()
Returns the reference to the object acting as the view for this document. The particular implementation of this view depends on the implemention of CreekDocument.

Returns:
reference to view object

isDirty

public boolean isDirty()
Returns the current dirty status of this document. If the document is dirty and needs to be saved, true will be returned.

Returns:
true if dirty, false if not dirty

isTitled

public boolean isTitled()
Returns true if the document is currently named.

Returns:
true if titled, false if unnamed

performCommand

public boolean performCommand(CreekCommand command)
Perform the given command and fire an undoable edit event.

Parameters:
command - command to be performed
Returns:
true if command was performed successfully

removeUndoableEditListener

public void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
Removes an UndoableEditListener from this document.

Parameters:
l - listern to remove from this document
See Also:
addUndoableEditListener(javax.swing.event.UndoableEditListener)

revert

public boolean revert()
Reverts this document (the graph data) to the last-saved version of the knowledgeModel.

Returns:
true if successful, false if error

revert

public boolean revert(Graph g,
                      java.lang.String title)

setTitled

public void setTitled(boolean titled)
Tells the document whether it has a title or not.

Parameters:
titled - true if document has a titled

setView

public void setView(ConceptView view)
Sets the view this document is associated with. Documents should not allow setting the view more than once.

Parameters:
view - view object

setTitle

public void setTitle(java.lang.String title)
Returns the reference to the file object for this document.

Returns:
reference to file object


Created at IDI, NTNU by the Artificial Intelligence and Learning group