Runtime

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

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

public class BasicNodeViewFactory
extends AbstractViewFactory

This is the base factory class for all Node 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), BasicNodeViewFactory.decorateView(View, View, IAdaptable, String, int, boolean), AbstractViewFactory.createStyles(View)

Constructor Summary
BasicNodeViewFactory()
           
 
Method Summary
protected  LayoutConstraint createLayoutConstraint()
          Method used to create the layout constraint that will get set on the created view.
protected  Node createNode()
          method to create the Notation meta model Node object that represents the view, you can override this method in your own factories to create you own node while extends the Node class this method is invoked by @link #createView(IAdaptable, View, String, int, boolean)
 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 semanticAdapter, java.lang.String semanticHint, int index, boolean persisted)
          This method is responsible for decorating the created view, it get called by the Factory method
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
createStyles, getEditingDomain, getPreferencesHint, getViewService, initializeFromPreferences, requiresElement, requiresElement, setPreferencesHint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicNodeViewFactory

public BasicNodeViewFactory()
Method Detail

createView

public 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

Specified by:
createView in interface ViewFactory
Specified by:
createView in class AbstractViewFactory
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

decorateView

protected void decorateView(View containerView,
                            View view,
                            IAdaptable semanticAdapter,
                            java.lang.String semanticHint,
                            int index,
                            boolean persisted)
This method is responsible for decorating the created view, it get called by the Factory method

Parameters:
containerView - the container of the view
view - the view itself
semanticAdapter - 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

createLayoutConstraint

protected LayoutConstraint createLayoutConstraint()
Method used to create the layout constraint that will get set on the created view. You can override this method in your own factory to change the default constraint. This method is called by @link #createView(IAdaptable, View, String, int, boolean)

Returns:
a new layout constraint for the view

createNode

protected Node createNode()
method to create the Notation meta model Node object that represents the view, you can override this method in your own factories to create you own node while extends the Node class this method is invoked by @link #createView(IAdaptable, View, String, int, boolean)

Returns:
the created Node

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.