Runtime

## org.eclipse.gmf.runtime.diagram.ui.view.factories
Class DiagramViewFactory

    java.lang.Object
      org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory

All Implemented Interfaces:
  DiagramFactory

public class DiagramViewFactory
extends java.lang.Object
implements DiagramFactory

This is the bas factory class for all Diagram views, it will create the `Diagram` and decorate it using the default decorations you can subclass it to add more decorations, or customize the way it looks, like adding new style

See Also:
  `DiagramViewFactory.createDiagram(IAdaptable, String, PreferencesHint)`, `DiagramViewFactory.decorateView(View, IAdaptable, String)`, `#createStyles()`

Constructor Summary
`DiagramViewFactory()`

Method Summary
`Diagram` `createDiagram(IAdaptable semanticAdapter, java.lang.String diagramKind, PreferencesHint thePreferencesHint)` factory method, that will be called by the view service to creat the `Diagram`
`protected java.util.List` `createStyles(View view)` this method is called by @link #createView(IAdaptable, View, String, int, boolean) to create the styles for the view that will be created, you can override this method in you factory sub class to provide additional styles
`protected void` `decorateView(View view, IAdaptable semanticAdapter, java.lang.String diagramKind)` This method is responsible for decorating the created view, it get called by the Factory method @link #createView(IAdaptable, View, String, int, boolean), it will intiliaze the view with the default preferences also it will create the default elements of the `View` if it had any
`protected MeasurementUnit` `getMeasurementUnit()` Clients should override if they wish to initialize their `Diagram` to have a different coordinate system then the default `Himetric`.
`protected PreferencesHint` `getPreferencesHint()` Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values.
`protected static ViewService` `getViewService()` a utility method to return the view service instance
`protected void` `initializeFromPreferences(View view)` Initialize the newly created view from the preference store, this method get called by @link #decorateView(View, IAdaptable, String)
`protected void` `setPreferencesHint(PreferencesHint preferencesHint)` Sets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DiagramViewFactory

    public DiagramViewFactory()

Method Detail

### createDiagram

    public Diagram createDiagram(IAdaptable semanticAdapter,
                                 java.lang.String diagramKind,
                                 PreferencesHint thePreferencesHint)

  factory method, that will be called by the view service to creat the `Diagram`

  Specified by:
    `createDiagram` in interface `DiagramFactory`
  Parameters:
    `semanticAdapter` - semanitc element of the diagram, it can be null
    `diagramKind` - a semantic hint to reflect the diagram type, it can be empty
    `thePreferencesHint` - The preference hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.
  Returns:

### getMeasurementUnit

    protected MeasurementUnit getMeasurementUnit()

  Clients should override if they wish to initialize their `Diagram` to have a different coordinate system then the default `Himetric`.

  Returns:
    the `MeasurementUnit` that will be used to initialize the `Diagram` object that is being created by the factory.

### decorateView

    protected void decorateView(View view,
                                IAdaptable semanticAdapter,
                                java.lang.String diagramKind)

  This method is responsible for decorating the created view, it get called by the Factory method @link #createView(IAdaptable, View, String, int, boolean), it will intiliaze the view with the default preferences also it will create the default elements of the `View` if it had any

  Parameters:
    `view` - the view itself
    `semanticAdapter` - the semantic elemnent of the view (it could be null)
    `diagramKind` - the semantic hint of the diagram

### createStyles

    protected java.util.List createStyles(View view)

  this method is called by @link #createView(IAdaptable, View, String, int, boolean) to create the styles for the view that will be created, you can override this method in you factory sub class to provide additional styles

  Returns:
    a list of style for the newly created view or an empty list if none (do not return null)

### initializeFromPreferences

    protected void initializeFromPreferences(View view)

  Initialize the newly created view from the preference store, this method get called by @link #decorateView(View, IAdaptable, String)

  Parameters:
    `view` - the view to initialize

### getViewService

    protected static ViewService getViewService()

  a utility method to return the view service instance

  Returns:
    ViewService

### getPreferencesHint

    protected PreferencesHint getPreferencesHint()

  Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.

  Returns:
    the preferences hint

### setPreferencesHint

    protected void setPreferencesHint(PreferencesHint preferencesHint)

  Sets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.

  Parameters:
    `preferencesHint` - the preferences hint

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.