Runtime

org.eclipse.gmf.runtime.diagram.ui.view.factories
Class AbstractViewFactory

java.lang.Object
  extended byorg.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractViewFactory
All Implemented Interfaces:
ViewFactory
Direct Known Subclasses:
BasicNodeViewFactory, ConnectionViewFactory

public abstract class AbstractViewFactory
extends java.lang.Object
implements ViewFactory

The abstract implementation of the ViewFactory interface. This class could be the base class for any generic View


Constructor Summary
AbstractViewFactory()
           
 
Method Summary
protected  java.util.List createStyles(View view)
          creates styles for the passed view and return them as List; the returned list could be empty if the view does not need any style
abstract  View createView(IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, boolean persisted, PreferencesHint thePreferencesHint)
          factory method, that will be called by the view service to creat the view
protected  org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain(EObject semanticElement, View containerView)
          Determines the editing domain for the view creation.
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()
          Method getViewService.
protected  void initializeFromPreferences(View view)
          Initialize the passed view from the preference store
protected  boolean requiresElement(EObject semanticElement, View view)
          Indicates if the passed view requires an element inside it or it can use its container's element
protected  boolean requiresElement(IAdaptable semanticAdapter, View view)
          Indicates if the passed view requires an element inside it or it can use its container's element
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

AbstractViewFactory

public AbstractViewFactory()
Method Detail

createView

public abstract View createView(IAdaptable semanticAdapter,
                                View containerView,
                                java.lang.String semanticHint,
                                int index,
                                boolean persisted,
                                PreferencesHint thePreferencesHint)
Description copied from interface: ViewFactory
factory method, that will be called by the view service to creat the view

Specified by:
createView in interface ViewFactory
Parameters:
semanticAdapter - semanitc element of the view, it can be null
containerView - the view to contain the connection
semanticHint - a semantic hint to reflect the view type, it can be empty
index - position with parent's child collection
persisted - persisted flag, this will indicate if the created view will be a presisted or transient view, transient views never get serialized
Returns:
the new view

createStyles

protected java.util.List createStyles(View view)
creates styles for the passed view and return them as List; the returned list could be empty if the view does not need any style

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

requiresElement

protected boolean requiresElement(IAdaptable semanticAdapter,
                                  View view)
Indicates if the passed view requires an element inside it or it can use its container's element

Parameters:
semanticAdapter -
Returns:

requiresElement

protected boolean requiresElement(EObject semanticElement,
                                  View view)
Indicates if the passed view requires an element inside it or it can use its container's element

Returns:

initializeFromPreferences

protected void initializeFromPreferences(View view)
Initialize the passed view from the preference store

Parameters:
view - the view to initialize

getViewService

protected static ViewService getViewService()
Method getViewService. a utility function 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

getEditingDomain

protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain(EObject semanticElement,
                                                                                  View containerView)
Determines the editing domain for the view creation.

Parameters:
semanticElement - the semantic elemement; may be null
containerView - the container view
Returns:
the editing domain

Runtime

Guidelines for using Eclipse APIs.

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