org.eclipse.emf.ecp.view.spi.swt
Class AbstractSWTRenderer<VELEMENT extends VElement>

java.lang.Object
  extended by org.eclipse.emf.ecp.view.model.common.AbstractRenderer<VELEMENT>
      extended by org.eclipse.emf.ecp.view.spi.swt.AbstractSWTRenderer<VELEMENT>
Type Parameters:
VELEMENT - the actual type of the VElement to be drawn
Direct Known Subclasses:
AbstractAdditionalSWTRenderer, AbstractControlSWTRenderer, AbstractJFaceTreeRenderer, AbstractSWTTabRenderer, ContainerSWTRenderer, CustomControlSWTRenderer, EmbeddedGroupSWTRenderer, GroupedGridSWTRenderer, HorizontalLayoutSWTRenderer, LabelSWTRenderer, SWTCategorizationRenderer, TreeMasterDetailSWTRenderer, UnknownVElementSWTRenderer

public abstract class AbstractSWTRenderer<VELEMENT extends VElement>
extends AbstractRenderer<VELEMENT>

Common base class for all SWT specific renderer classes. init(VElement, ViewModelContext) is called by the framework when providing the renderer. You don't need to call this. A renderer using other renderers to render its contents must call this methods in this order:

  getGridDescription(SWTGridDescription)
  for each SWTGridCell
        render(SWTGridCell, Composite)
 finalizeRendering(Composite)
 
If you don't call finalizeRendering(Composite) after the rendering, the automatic disposing of the renderer will not work, as well as the initial validation check.

Since:
1.2
Author:
Eugen Neufeld

Constructor Summary
AbstractSWTRenderer()
          Default constructor.
 
Method Summary
 void finalizeRendering(org.eclipse.swt.widgets.Composite parent)
          Called by the framework to initialize listener.
abstract  SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
          Returns the GridDescription for this Renderer.
 void init(VELEMENT vElement, ViewModelContext viewContext)
          Initialize the control.
 org.eclipse.swt.widgets.Control render(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent)
          Renders the passed VElement.
 
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
getVElement, getViewModelContext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSWTRenderer

public AbstractSWTRenderer()
Default constructor.

Method Detail

getGridDescription

public abstract SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.

Parameters:
gridDescription - the current GridDescription
Returns:
the number of controls per row
Since:
1.3

init

public final void init(VELEMENT vElement,
                       ViewModelContext viewContext)
Initialize the control. This can only be called once.

Overrides:
init in class AbstractRenderer<VELEMENT extends VElement>
Parameters:
vElement - the VElement to be rendered
viewContext - the ViewModelContext to use
Since:
1.3
See Also:
AbstractRenderer.init(org.eclipse.emf.ecp.view.spi.model.VElement, org.eclipse.emf.ecp.view.spi.context.ViewModelContext)

render

public org.eclipse.swt.widgets.Control render(SWTGridCell cell,
                                              org.eclipse.swt.widgets.Composite parent)
                                       throws NoRendererFoundException,
                                              NoPropertyDescriptorFoundExeption
Renders the passed VElement.

Parameters:
cell - the SWTGridCell of the control to render
parent - the Composite to render on
Returns:
the rendered Control
Throws:
NoRendererFoundException - this is thrown when a renderer cannot be found
NoPropertyDescriptorFoundExeption - this is thrown when no property descriptor can be found
Since:
1.3

finalizeRendering

public final void finalizeRendering(org.eclipse.swt.widgets.Composite parent)
Called by the framework to initialize listener.

Parameters:
parent - the parent used during render
Since:
1.3


Copyright © 2014. All Rights Reserved.