com.tensegrity.gui.document
Class MDIDelegate

java.lang.Object
  extended bycom.tensegrity.gui.document.MDIDelegate
All Implemented Interfaces:
Evaluable, MDIComponent, Observable

public class MDIDelegate
extends java.lang.Object
implements MDIComponent, Observable

This class is a delegate wrapper for the mdi documents class. It is useful to intercept certain calls on the mdi component or for aggregating an MDIComponent.

Version:
$Id: MDIDelegate.java,v 1.11 2004/03/02 16:51:05 sr Exp $
Author:
Stepan Rutz

Constructor Summary
MDIDelegate(MDIComponent delegated)
          Constructs an mdi delegate.
 
Method Summary
 void addDocument(Document document)
          Adds the given Document to the container.
 void addDocumentListener(DocumentListener documentlistener)
          Adds a document listener.
 void addObserver(Observer observer)
          Adds an observer to the internally managed list of observers of this observable.
 void applyEvList()
          This method delegates the call to the internal mdicomponent instance.
 void clearChanged()
          Sets the state to unchanged.
 void deleteObserver(Observer observer)
          Deletes an observer from the internally managed list of observers of this observable.
 void deleteObservers()
          Deletes all of the observers registered with this observable.
 void fireDocumentDataChanged(Document document)
          Fires the document data changed event from the outside world.
 Document getActiveDocument()
          Returns the active document.
 int getDocumentCount()
          Returns the number of currently open documents.
 java.util.List getDocuments()
          Returns a List containing all active documents.
 MDIComponent getMDIComponent()
          Returns a reference to the mdi component that is the receiver of delegation.
 Observable getObservable()
          Returns the Observable instance.
 java.util.Collection getObservers()
          Returns a collection of the observers currently registered with this observable.
 void indicateModifiedDocument(Document document)
          The mdi component shall indicate visually that the given document was modified.
 void indicateUnmodifiedDocument(Document document)
          The mdi component shall indicate visually that the given document was not modified.
 void installEvList()
          This method delegates the call to the internal mdicomponent instance.
 void notifyObservers()
          Performs a notify on all registered observers, if the state has changed since the last notification.
 void notifyObservers(java.lang.Object arg)
          Performs a notify on all registered observers, if the state has changed since the last notification.
 void postValidate()
          Invoked by the framework after the MDIComponent was shown on the screen.
 void removeActiveDocument()
          Closes the active document.
 void removeDocument(Document document)
          Closes the given document and removes it from the mdi container.
 void removeDocumentListener(DocumentListener documentlistener)
          Removes a document listener.
 void renameDocument(Document document, java.lang.String name)
          Renames a document.
 void setActiveDocument(Document document)
          Sets the active document.
 void setChanged()
          Sets the state to changed.
 void setDocumentListener(DocumentListener documentlistener)
          Sets a single document listener.
 void setMDIComponent(MDIComponent mdicomponent)
          Sets the mdi component that is the receiver of delegation.
 void setObservable(Observable observable)
          Sets an observable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDIDelegate

public MDIDelegate(MDIComponent delegated)
Constructs an mdi delegate.

Parameters:
delegated - the actual mdi component that is delegated all the work.
Method Detail

getMDIComponent

public MDIComponent getMDIComponent()
Returns a reference to the mdi component that is the receiver of delegation.

Returns:
reference to the mdi component that is the receiver of delegation.

setMDIComponent

public void setMDIComponent(MDIComponent mdicomponent)
Sets the mdi component that is the receiver of delegation.

Parameters:
mdicomponent - the receiving mdi component.

getDocumentCount

public int getDocumentCount()
Description copied from interface: MDIComponent
Returns the number of currently open documents.

Specified by:
getDocumentCount in interface MDIComponent
Returns:
the number of currently open documents.

getDocuments

public java.util.List getDocuments()
Description copied from interface: MDIComponent
Returns a List containing all active documents.

Specified by:
getDocuments in interface MDIComponent
Returns:
the list of currently active documents.

addDocument

public void addDocument(Document document)
Description copied from interface: MDIComponent
Adds the given Document to the container.

Specified by:
addDocument in interface MDIComponent
Parameters:
document - the document to add to the container.

removeDocument

public void removeDocument(Document document)
Description copied from interface: MDIComponent
Closes the given document and removes it from the mdi container.

Specified by:
removeDocument in interface MDIComponent
Parameters:
document - the document to close and remove.

getActiveDocument

public Document getActiveDocument()
Description copied from interface: MDIComponent
Returns the active document.

Specified by:
getActiveDocument in interface MDIComponent
Returns:
the active document.

setActiveDocument

public void setActiveDocument(Document document)
Description copied from interface: MDIComponent
Sets the active document. The given document must be in the container.

Specified by:
setActiveDocument in interface MDIComponent
Parameters:
document - the document to activate.

removeActiveDocument

public void removeActiveDocument()
Description copied from interface: MDIComponent
Closes the active document.

Specified by:
removeActiveDocument in interface MDIComponent

renameDocument

public void renameDocument(Document document,
                           java.lang.String name)
Description copied from interface: MDIComponent
Renames a document.

Specified by:
renameDocument in interface MDIComponent
Parameters:
document - the document to rename.
name - the new name for the document.

indicateModifiedDocument

public void indicateModifiedDocument(Document document)
Description copied from interface: MDIComponent
The mdi component shall indicate visually that the given document was modified. This is needed by application that likes to visually point out that a document was modified and thus may require saving before the application is exited.

Specified by:
indicateModifiedDocument in interface MDIComponent
Parameters:
document - the modified document.

indicateUnmodifiedDocument

public void indicateUnmodifiedDocument(Document document)
Description copied from interface: MDIComponent
The mdi component shall indicate visually that the given document was not modified.

Specified by:
indicateUnmodifiedDocument in interface MDIComponent
Parameters:
document - the unmodified document.

postValidate

public void postValidate()
Description copied from interface: MDIComponent
Invoked by the framework after the MDIComponent was shown on the screen. This is a callback and the application that uses the MDIComponent is responsible for invoking this method at the specified moments in time.

Specified by:
postValidate in interface MDIComponent

addObserver

public void addObserver(Observer observer)
Description copied from interface: Observable
Adds an observer to the internally managed list of observers of this observable.

Specified by:
addObserver in interface Observable
Parameters:
observer - the observer to add to the internal list.

deleteObserver

public void deleteObserver(Observer observer)
Description copied from interface: Observable
Deletes an observer from the internally managed list of observers of this observable.

Specified by:
deleteObserver in interface Observable
Parameters:
observer - the observer to delete from the internal list.

setChanged

public void setChanged()
Description copied from interface: Observable
Sets the state to changed. Affects the next notification.

Specified by:
setChanged in interface Observable

clearChanged

public void clearChanged()
Description copied from interface: Observable
Sets the state to unchanged. Affects the next notification.

Specified by:
clearChanged in interface Observable

getObservers

public java.util.Collection getObservers()
Description copied from interface: Observable
Returns a collection of the observers currently registered with this observable.

Specified by:
getObservers in interface Observable
Returns:
collection of the observers.

notifyObservers

public void notifyObservers()
Description copied from interface: Observable
Performs a notify on all registered observers, if the state has changed since the last notification.

Specified by:
notifyObservers in interface Observable
See Also:
Observable.setChanged()

notifyObservers

public void notifyObservers(java.lang.Object arg)
Description copied from interface: Observable
Performs a notify on all registered observers, if the state has changed since the last notification.

Specified by:
notifyObservers in interface Observable
Parameters:
arg - additional argument to pass to the observers.
See Also:
Observable.setChanged()

getObservable

public Observable getObservable()
Description copied from interface: MDIComponent
Returns the Observable instance. Useful if current MDIComponent gives away responsibility for them.

Specified by:
getObservable in interface MDIComponent
Returns:
the observable of this mdi component.

setObservable

public void setObservable(Observable observable)
Description copied from interface: MDIComponent
Sets an observable. Useful during switch of MDIComponents.

Specified by:
setObservable in interface MDIComponent
Parameters:
observable - the observable to set for the mdi component.

deleteObservers

public void deleteObservers()
Description copied from interface: Observable
Deletes all of the observers registered with this observable.

Specified by:
deleteObservers in interface Observable

installEvList

public void installEvList()
This method delegates the call to the internal mdicomponent instance.

Specified by:
installEvList in interface Evaluable
See Also:
Evaluable.installEvList()

applyEvList

public void applyEvList()
This method delegates the call to the internal mdicomponent instance.

Specified by:
applyEvList in interface Evaluable
See Also:
Evaluable.applyEvList()

setDocumentListener

public void setDocumentListener(DocumentListener documentlistener)
Description copied from interface: MDIComponent
Sets a single document listener. Use with caution.

Specified by:
setDocumentListener in interface MDIComponent
Parameters:
documentlistener - the documentlistener to set.

addDocumentListener

public void addDocumentListener(DocumentListener documentlistener)
Description copied from interface: MDIComponent
Adds a document listener.

Specified by:
addDocumentListener in interface MDIComponent
Parameters:
documentlistener - the documentlistener to add.

removeDocumentListener

public void removeDocumentListener(DocumentListener documentlistener)
Description copied from interface: MDIComponent
Removes a document listener.

Specified by:
removeDocumentListener in interface MDIComponent
Parameters:
documentlistener - the documentlistener to remove.

fireDocumentDataChanged

public void fireDocumentDataChanged(Document document)
Description copied from interface: MDIComponent
Fires the document data changed event from the outside world.

Specified by:
fireDocumentDataChanged in interface MDIComponent
Parameters:
document - the document whose data has changed.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.