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.GridData
createGridDataForControlWithHorizontalGrab(SWTGridDescription swtGridDescription, SWTGridCell swtGridCell, org.eclipse.swt.widgets.Control control, int hSpan)
Creates theGridData
which 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.GridData
createGridDataForControlWithoutHorizontalGrab(SWTGridDescription swtGridDescription, SWTGridCell swtGridCell, org.eclipse.swt.widgets.Control control)
Creates theGridData
which will be set on control which will take a span of 1 column an have no horizontal grab.protected SWTGridDescription
createGridDescriptionForEmptyCells(java.util.Collection<SWTGridDescription> values)
SWTGridDescription
getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.protected int
getHorizontalSpacing()
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 EMFFormsRendererFactory
getRendererFactory()
Returns theEMFFormsRendererFactory
.protected org.eclipse.swt.widgets.Control
renderControl(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:AbstractSWTRenderer
Returns the GridDescription for this Renderer.- Specified by:
getGridDescription
in 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:AbstractSWTRenderer
Renders the passedVElement
.- Specified by:
renderControl
in classAbstractSWTRenderer<VControlGrid>
- Parameters:
cell
- theGridCell
of the control to renderparent
- theComposite
to 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 theGridData
which will be set on control which will take a span of 1 column an have no horizontal grab.- Parameters:
swtGridDescription
- theSWTGridDescription
swtGridCell
- the currentSWTGridCell
of 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 theGridData
which will be set on control which will take up horizontal space an will span over the given amount of columns.- Parameters:
swtGridDescription
- theSWTGridDescription
swtGridCell
- the currentSWTGridCell
of the descriptioncontrol
- theControl
hSpan
- 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
SWTGridDescription
which will be used to create empty cells. Please note that therenderer
of this description will be ignored, so it is fine to passnull
as a renderer - Since:
- 1.16
-
-