com.tensegrity.gui.swt.document
Class SwtGraphDocument

java.lang.Object
  extended bycom.tensegrity.gui.document.AbstractDocument
      extended bycom.tensegrity.gui.swt.document.SwtDocument
          extended bycom.tensegrity.gui.swt.document.SwtGraphDocument
All Implemented Interfaces:
Container, Disposable, Document, GraphDocument, Observer

public class SwtGraphDocument
extends SwtDocument
implements GraphDocument

This class represents the GraphDocument implementation for SWT-based applications.

An instance of SwtGraphDocument has a 1:1 association with a dedicated instance of class SwtGraphPanel.

SwtGraphDocument instances hold an internal Control instance in order to ease the integration of a Document in a SWT context. This Control - accessible through the SwtDocument.getControl() method - is an instance of class SwtGraphPanel. Note that the internal SwtGraphPanel can also be accessed by means of the getGraphPanel() method.

Version:
$Id: SwtGraphDocument.java,v 1.36 2006/03/02 10:44:00 BurkhardWick Exp $
Author:
SebastienGuyon

Field Summary
 
Fields inherited from interface com.tensegrity.gui.graphdocument.GraphDocument
SETTING_ADJUSTVIEWAFTEROPEN, SETTING_ANTIALIAS, SETTING_COMPRESSIMAGES, SETTING_COMPRESSION, SETTING_DRAWINGORDER, SETTING_SAVEGEOMETRYDEFS, SETTING_SAVEGEOMETRYDEFSFILTER, SETTING_SAVEIMAGES, SETTING_SAVELAYOUT, SETTING_SAVELAYOUTDEFSFILTER, SETTING_SAVEPREVIEW, SETTING_SAVERULEDEFS, SETTING_SAVERULEDEFSFILTER, SETTING_SAVESTYLEDEFS, SETTING_SAVESTYLEDEFSFILTER, SETTING_SETDIRTYONVIEWCHANGES, SETTING_USEXMLENTITIES, SETTING_WARNWHENLOSINGINFOS_IMAGES, SETTING_WARNWHENLOSINGINFOS_LAYOUT, SETTING_WARNWHENLOSINGINFOS_RULES, SETTINGVALUE_COMPRESSION_GZIP, SETTINGVALUE_COMPRESSION_NONE, SETTINGVALUE_FILTER_ALL, SETTINGVALUE_FILTER_USED, SETTINGVALUE_WARNWHENLOSINGINFOS_CHANGED, SETTINGVALUE_WARNWHENLOSINGINFOS_NEVER, SETTINGVALUE_WARNWHENLOSINGINFOS_USED, SETTINGVALUE_WARNWHENLOSINGINFOS_USEDORCHANGED, SETTINGVALUE_WARNWHENLOSINGINFOS_USINGCHANGED
 
Fields inherited from interface com.tensegrity.gui.document.Document
GLUE_LEFTBOTTOM, GLUE_LEFTCENTEREXTEND, GLUE_LEFTTOP, GLUE_RIGHTBOTTOM, GLUE_RIGHTCENTEREXTEND, GLUE_RIGHTTOP, TYPE_FIXED_SIZE, TYPE_PACK_IS_OK, TYPE_TOOLDOCUMENT
 
Constructor Summary
SwtGraphDocument(java.lang.String name, ApplicationFrame applicationFrame, org.eclipse.swt.widgets.Composite parentContainer, DragContext dragContext)
          Deprecated. Use SwtGraphDocument(String, ApplicationFrame, Composite, DragContext) instead!
SwtGraphDocument(java.lang.String name, ApplicationFrame applicationFrame, GraphController graphcontroller, org.eclipse.swt.widgets.Composite parentContainer, VisualGraphView visualgraphview)
          Constructor for SwtGraphDocuments.
SwtGraphDocument(java.lang.String name, ApplicationFrame applicationFrame, GraphController graphcontroller, org.eclipse.swt.widgets.Composite parentContainer, VisualGraphView visualgraphview, DragContext dragContext)
          Constructor for SwtGraphDocuments.
SwtGraphDocument(java.lang.String name, GraphApplication graphapplication, org.eclipse.swt.widgets.Composite parentContainer, DragContext dragContext)
          Deprecated. Use SwtGraphDocument(String, ApplicationFrame, Composite, DragContext) instead!
SwtGraphDocument(java.lang.String name, GraphApplication graphapplication, GraphController graphcontroller, org.eclipse.swt.widgets.Composite parentContainer, VisualGraphView visualgraphview)
          Deprecated. Use SwtGraphDocument(String, ApplicationFrame, GraphController, Composite, VisualGraphView) instead!
SwtGraphDocument(java.lang.String name, GraphApplication graphapplication, GraphController graphcontroller, org.eclipse.swt.widgets.Composite parentContainer, VisualGraphView visualgraphview, DragContext dragContext)
          Deprecated. Use #SwtGraphDocument(String, ApplicationFrame, GraphApplication, GraphController, Composite, VisualGraphView, DragContext) instead!
 
Method Summary
 void closeHandler()
          This method is a callback that is invoked before the document is closed.
 GraphPanel getGraphPanel()
          Returns the reference to the internally embedded GraphPanel instance.
 BasePageFormat getPageFormat()
          Returns the this documents PageFormat instance.
 ViewBuilderFilter getViewBuilderFilter()
          Returns the active ViewBuilderFilter of this GraphDocument instance.
 ViewSerializerFilter getViewSerializerFilter()
          Returns the active ViewSerializerFilter of this GraphDocument instance.
 void registerViewBuilderFilter(ViewBuilderFilter filterBuildView)
          Registers a ViewBuilderFilter for later use in this GraphDocument.
 void registerViewSerializerFilter(ViewSerializerFilter filterSerializeView)
          Registers a ViewSerializerFilter for later use in this GraphDocument.
 void setDocumentSetting(java.lang.String key, java.lang.Object value)
          Stores the value for an application defined document setting.
 void setModified()
          Sets the modified flag to true.
 void setPageFormat(BasePageFormat format)
          Sets a PageFormat for this document.
 void setUnmodified()
          Sets the modified flag to false.
 void setVisualGraphView(VisualGraphView visualgraphview, GraphController graphcontroller)
          Sets the VisualGraphView to be shown in the this GraphDocument.
 
Methods inherited from class com.tensegrity.gui.swt.document.SwtDocument
dispose, getApplicationFrame, getControl, setControl, update
 
Methods inherited from class com.tensegrity.gui.document.AbstractDocument
getCopyCounter, getDocumentDataProvider, getDocumentSetting, getDocumentSettings, getFile, getFlags, getName, isModified, setDocumentSettings, setFile, setName, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tensegrity.gui.document.Document
getCopyCounter, getDocumentDataProvider, getDocumentSetting, getDocumentSettings, getFile, getFlags, isModified, setDocumentSettings, setFile
 
Methods inherited from interface com.tensegrity.generic.util.Observer
update
 
Methods inherited from interface com.tensegrity.gui.container.Container
getApplicationFrame, getName, setName, setSelected
 

Constructor Detail

SwtGraphDocument

public SwtGraphDocument(java.lang.String name,
                        GraphApplication graphapplication,
                        GraphController graphcontroller,
                        org.eclipse.swt.widgets.Composite parentContainer,
                        VisualGraphView visualgraphview)
Deprecated. Use SwtGraphDocument(String, ApplicationFrame, GraphController, Composite, VisualGraphView) instead!

Constructor for SwtGraphDocuments. Internally a SwtGraphPanel instance is managed.

Parameters:
name - the document name
graphapplication - reference to the application
graphcontroller - the graph controller that manages the document
parentContainer - the parent Composite of the internal SwtGraphPanel
visualgraphview - the VisualGraphView to display

SwtGraphDocument

public SwtGraphDocument(java.lang.String name,
                        ApplicationFrame applicationFrame,
                        GraphController graphcontroller,
                        org.eclipse.swt.widgets.Composite parentContainer,
                        VisualGraphView visualgraphview)
Constructor for SwtGraphDocuments. Internally a SwtGraphPanel instance is managed.

Parameters:
name - the document name
applicationFrame - reference to the application frame
graphcontroller - the graph controller that manages the document
parentContainer - the parent Composite of the internal SwtGraphPanel
visualgraphview - the VisualGraphView to display

SwtGraphDocument

public SwtGraphDocument(java.lang.String name,
                        GraphApplication graphapplication,
                        GraphController graphcontroller,
                        org.eclipse.swt.widgets.Composite parentContainer,
                        VisualGraphView visualgraphview,
                        DragContext dragContext)
Deprecated. Use #SwtGraphDocument(String, ApplicationFrame, GraphApplication, GraphController, Composite, VisualGraphView, DragContext) instead!

Constructor for SwtGraphDocuments. Internally a SwtGraphPanel instance is managed. The created instance is registered as observer of the passed graphcontroller.

Parameters:
name - the document name
graphapplication - reference to the application
graphcontroller - the graph controller that manages the document
parentContainer - the parent Composite of the internal SwtGraphPanel
visualgraphview - the VisualGraphView to display
dragContext - the drag context, which provides useful information during the drag and drop operation

SwtGraphDocument

public SwtGraphDocument(java.lang.String name,
                        ApplicationFrame applicationFrame,
                        GraphController graphcontroller,
                        org.eclipse.swt.widgets.Composite parentContainer,
                        VisualGraphView visualgraphview,
                        DragContext dragContext)
Constructor for SwtGraphDocuments. Internally a SwtGraphPanel instance is managed. The created instance is registered as observer of the passed graphcontroller.

Parameters:
name - the document name
applicationFrame - reference to the application frame
graphcontroller - the graph controller that manages the document
parentContainer - the parent Composite of the internal SwtGraphPanel
visualgraphview - the VisualGraphView to display
dragContext - the drag context, which provides useful information during the drag and drop operation

SwtGraphDocument

public SwtGraphDocument(java.lang.String name,
                        GraphApplication graphapplication,
                        org.eclipse.swt.widgets.Composite parentContainer,
                        DragContext dragContext)
Deprecated. Use SwtGraphDocument(String, ApplicationFrame, Composite, DragContext) instead!

Constructor for SwtGraphDocuments. Internally a SwtGraphPanel instance is managed.

Parameters:
name - the document name
graphapplication - reference to the application
parentContainer - the parent Composite of the internal SwtGraphPanel
dragContext - the drag context, which provides useful information during the drag and drop operation

SwtGraphDocument

public SwtGraphDocument(java.lang.String name,
                        ApplicationFrame applicationFrame,
                        org.eclipse.swt.widgets.Composite parentContainer,
                        DragContext dragContext)
Deprecated. Use SwtGraphDocument(String, ApplicationFrame, Composite, DragContext) instead!

Constructor for SwtGraphDocuments. Internally a SwtGraphPanel instance is managed.

Parameters:
name - the document name
applicationFrame - reference to the application frame
parentContainer - the parent Composite of the internal SwtGraphPanel
dragContext - the drag context, which provides useful information during the drag and drop operation
Method Detail

getGraphPanel

public GraphPanel getGraphPanel()
Description copied from interface: GraphDocument
Returns the reference to the internally embedded GraphPanel instance.

Specified by:
getGraphPanel in interface GraphDocument
Returns:
the underlying GraphPanel instance.

setVisualGraphView

public void setVisualGraphView(VisualGraphView visualgraphview,
                               GraphController graphcontroller)
Description copied from interface: GraphDocument
Sets the VisualGraphView to be shown in the this GraphDocument.

Specified by:
setVisualGraphView in interface GraphDocument
Parameters:
visualgraphview - the VisualGraphView to show in this GraphDocument.
graphcontroller - the GraphController to use in this GraphDocument.

registerViewSerializerFilter

public void registerViewSerializerFilter(ViewSerializerFilter filterSerializeView)
Description copied from interface: GraphDocument
Registers a ViewSerializerFilter for later use in this GraphDocument.

Specified by:
registerViewSerializerFilter in interface GraphDocument
Parameters:
filterSerializeView - ViewSerializerFilter for later use in this GraphDocument

getViewSerializerFilter

public ViewSerializerFilter getViewSerializerFilter()
Description copied from interface: GraphDocument
Returns the active ViewSerializerFilter of this GraphDocument instance.

Specified by:
getViewSerializerFilter in interface GraphDocument
Returns:
the active ViewSerializerFilter of this GraphDocument instance.

registerViewBuilderFilter

public void registerViewBuilderFilter(ViewBuilderFilter filterBuildView)
Description copied from interface: GraphDocument
Registers a ViewBuilderFilter for later use in this GraphDocument.

Specified by:
registerViewBuilderFilter in interface GraphDocument
Parameters:
filterBuildView - ViewBuilderFilter for later use in this GraphDocument

getViewBuilderFilter

public ViewBuilderFilter getViewBuilderFilter()
Description copied from interface: GraphDocument
Returns the active ViewBuilderFilter of this GraphDocument instance.

Specified by:
getViewBuilderFilter in interface GraphDocument
Returns:
the active ViewBuilderFilter of this GraphDocument instance.

closeHandler

public void closeHandler()
Description copied from interface: Document
This method is a callback that is invoked before the document is closed. It allows the document to clean up and properly dispose of any resources it had acquired and/or allocated.

Specified by:
closeHandler in interface Document
Overrides:
closeHandler in class AbstractDocument

setModified

public void setModified()
Description copied from interface: Document
Sets the modified flag to true.

Specified by:
setModified in interface Document
Overrides:
setModified in class AbstractDocument

setUnmodified

public void setUnmodified()
Description copied from interface: Document
Sets the modified flag to false.

Specified by:
setUnmodified in interface Document
Overrides:
setUnmodified in class AbstractDocument

getPageFormat

public BasePageFormat getPageFormat()
Description copied from interface: GraphDocument
Returns the this documents PageFormat instance. Providing such a Format instance is optional. If this method returns null a default format is used instead.

Specified by:
getPageFormat in interface GraphDocument
Returns:
either an instance of CustomPageFormat or null if a default format is used.
See Also:
CustomPageFormat, PrintUtil.getPageFormat(String, int)

setPageFormat

public void setPageFormat(BasePageFormat format)
Description copied from interface: GraphDocument
Sets a PageFormat for this document. If no such Format will be set, the default format will be used.

Specified by:
setPageFormat in interface GraphDocument
Parameters:
format - an instance of class BasePageFormat.

setDocumentSetting

public void setDocumentSetting(java.lang.String key,
                               java.lang.Object value)
Description copied from interface: Document
Stores the value for an application defined document setting. Depending on the type of the document and its implementation this can be an information like a creation date or a visualization option for the document contents. The key has to be a valid name for an attribute and the value has to be a valid value that can be serialized and built by the framework persistence (GraphDocumentReader and GraphDocumentWriter). You may pass null as value to remove the setting from the document.

Specified by:
setDocumentSetting in interface Document
Overrides:
setDocumentSetting in class AbstractDocument


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