Runtime

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

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

public class ConnectionViewFactory
extends AbstractViewFactory
implements ViewFactory

This is the bas factory class for all connection views, it will create the view 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:
#createView(IAdaptable, View, String, int, boolean, String), ConnectionViewFactory.decorateView(View, View, IAdaptable, String, int, boolean), #createStyles()

Constructor Summary
ConnectionViewFactory()
           
 
Method Summary
protected  Bendpoints createBendpoints()
          this method will create the default bend point on the connection, connections are created as Straight linem you can override this method in your own factory that subclass this class and change this behavior by adding extra bend points or returning a new list of bend points.
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
 View createView(IAdaptable semanticAdapter, View containerView, java.lang.String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint)
          factory method, that will be called by the view service to creat the view
protected  void decorateView(View containerView, View view, IAdaptable element, java.lang.String semanticHint, int index, boolean persisted)
          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  void initializeFromPreferences(View view)
          Initialize the passed view from the preference store
protected static boolean isUnProtectedSilentTransactionInProgress(org.eclipse.emf.transaction.TransactionalEditingDomain domain)
          Checks if the current active transaction is a unprotected amd silent
 
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractViewFactory
getEditingDomain, getPreferencesHint, getViewService, requiresElement, requiresElement, setPreferencesHint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionViewFactory

public ConnectionViewFactory()
Method Detail

createView

public View createView(IAdaptable semanticAdapter,
                       View containerView,
                       java.lang.String semanticHint,
                       int index,
                       boolean persisted,
                       PreferencesHint preferencesHint)
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
Specified by:
createView in class AbstractViewFactory

createBendpoints

protected Bendpoints createBendpoints()
this method will create the default bend point on the connection, connections are created as Straight linem you can override this method in your own factory that subclass this class and change this behavior by adding extra bend points or returning a new list of bend points. This method get called by @link #createView(IAdaptable, View, String, int, boolean)

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

decorateView

protected void decorateView(View containerView,
                            View view,
                            IAdaptable element,
                            java.lang.String semanticHint,
                            int index,
                            boolean persisted)
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:
containerView - the container of the view
view - the view itself
element - the semantic elemnent of the view (it could be null)
semanticHint - the semantic hint of the view
index - the index of the view
persisted - flag indicating the the view was created as persisted or not

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

Overrides:
createStyles in class AbstractViewFactory
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)
Description copied from class: AbstractViewFactory
Initialize the passed view from the preference store

Overrides:
initializeFromPreferences in class AbstractViewFactory
Parameters:
view - the view to initialize

isUnProtectedSilentTransactionInProgress

protected static boolean isUnProtectedSilentTransactionInProgress(org.eclipse.emf.transaction.TransactionalEditingDomain domain)
Checks if the current active transaction is a unprotected amd silent

Parameters:
domain - , the domain to use during the check
Returns:
true if the current active transaction is unprotected and silent

Runtime

Guidelines for using Eclipse APIs.

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