Class ControlGridSWTRenderer
- java.lang.Object
-
- org.eclipse.emf.ecp.view.model.common.AbstractRenderer<VELEMENT>
-
- org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer<VControlGrid>
-
- org.eclipse.emfforms.spi.swt.controlgrid.renderer.ControlGridSWTRenderer
-
public class ControlGridSWTRenderer extends AbstractSWTRenderer<VControlGrid>
SWT Renderer forVControlGrid.- Author:
- Johannes Faltermeier
-
-
Field Summary
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description ControlGridSWTRenderer(VControlGrid vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsRendererFactory rendererFactory)Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.eclipse.swt.layout.GridDatacreateGridDataForControlWithHorizontalGrab(SWTGridDescription swtGridDescription, SWTGridCell swtGridCell, org.eclipse.swt.widgets.Control control, int hSpan)Creates theGridDatawhich will be set on control which will take up horizontal space an will span over the given amount of columns.protected org.eclipse.swt.layout.GridDatacreateGridDataForControlWithoutHorizontalGrab(SWTGridDescription swtGridDescription, SWTGridCell swtGridCell, org.eclipse.swt.widgets.Control control)Creates theGridDatawhich will be set on control which will take a span of 1 column an have no horizontal grab.protected SWTGridDescriptioncreateGridDescriptionForEmptyCells(java.util.Collection<SWTGridDescription> values)SWTGridDescriptiongetGridDescription(SWTGridDescription gridDescription)Returns the GridDescription for this Renderer.protected intgetHorizontalSpacing()Returns the hint for the horizontal spacing.protected Optional<java.lang.Integer>getPixelGridSize()When this returns a non-empty optional all non-spanning/grabbing controls in a spanning/grabbing parent will have a width which is a multiple of this pixel grid size.protected EMFFormsRendererFactorygetRendererFactory()Returns theEMFFormsRendererFactory.protected org.eclipse.swt.widgets.ControlrenderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent)Renders the passedVElement.-
Methods inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
applyEnable, applyReadOnly, applyValidation, applyValidation, applyVisible, canReveal, dispose, finalizeRendering, getControls, getDefaultFontName, ignoreEnableOnReadOnly, init, isRenderingFinished, postInit, preInit, render, scrollToReveal, scrollToReveal, setControlEnabled
-
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
-
-
-
-
Constructor Detail
-
ControlGridSWTRenderer
@Inject public ControlGridSWTRenderer(VControlGrid vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsRendererFactory rendererFactory)
Default Constructor.- Parameters:
vElement- the view element to be renderedviewContext- The view model contextreportService- the ReportService to userendererFactory- therenderer factory
-
-
Method Detail
-
getRendererFactory
protected EMFFormsRendererFactory getRendererFactory()
Returns theEMFFormsRendererFactory.- Returns:
- the renderer factory
-
getGridDescription
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
Description copied from class:AbstractSWTRendererReturns the GridDescription for this Renderer.- Specified by:
getGridDescriptionin classAbstractSWTRenderer<VControlGrid>- Parameters:
gridDescription- the currentSWTGridDescription- Returns:
- the number of controls per row
-
renderControl
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Description copied from class:AbstractSWTRendererRenders the passedVElement.- Specified by:
renderControlin classAbstractSWTRenderer<VControlGrid>- Parameters:
cell- theGridCellof the control to renderparent- theCompositeto render on- Returns:
- the rendered
Control - Throws:
NoRendererFoundException- this is thrown when a renderer cannot be foundNoPropertyDescriptorFoundExeption- this is thrown when no property descriptor can be found
-
getPixelGridSize
protected Optional<java.lang.Integer> getPixelGridSize()
When this returns a non-empty optional all non-spanning/grabbing controls in a spanning/grabbing parent will have a width which is a multiple of this pixel grid size. To be more specific, the preferred size of the control will be rounded up to match this criteria.- Returns:
- the grid size in pixels
- Since:
- 1.16
-
getHorizontalSpacing
protected int getHorizontalSpacing()
Returns the hint for the horizontal spacing.- Returns:
- the spacing
- Since:
- 1.8
-
createGridDataForControlWithoutHorizontalGrab
protected org.eclipse.swt.layout.GridData createGridDataForControlWithoutHorizontalGrab(SWTGridDescription swtGridDescription, SWTGridCell swtGridCell, org.eclipse.swt.widgets.Control control)
Creates theGridDatawhich will be set on control which will take a span of 1 column an have no horizontal grab.- Parameters:
swtGridDescription- theSWTGridDescriptionswtGridCell- the currentSWTGridCellof the descriptioncontrol- theControl- Returns:
- the layout data
- Since:
- 1.8
-
createGridDataForControlWithHorizontalGrab
protected org.eclipse.swt.layout.GridData createGridDataForControlWithHorizontalGrab(SWTGridDescription swtGridDescription, SWTGridCell swtGridCell, org.eclipse.swt.widgets.Control control, int hSpan)
Creates theGridDatawhich will be set on control which will take up horizontal space an will span over the given amount of columns.- Parameters:
swtGridDescription- theSWTGridDescriptionswtGridCell- the currentSWTGridCellof the descriptioncontrol- theControlhSpan- the horizontal span- Returns:
- the layout data
- Since:
- 1.8
-
createGridDescriptionForEmptyCells
protected SWTGridDescription createGridDescriptionForEmptyCells(java.util.Collection<SWTGridDescription> values)
- Parameters:
values- the collected grid description of the renderers- Returns:
- a
SWTGridDescriptionwhich will be used to create empty cells. Please note that therendererof this description will be ignored, so it is fine to passnullas a renderer - Since:
- 1.16
-
-