public class TableControlSWTRenderer extends AbstractControlSWTRenderer<VTableControl>
Modifier and Type | Class and Description |
---|---|
class |
TableControlSWTRenderer.ECPCellLabelProvider
ECP specficic cell label provider that does also implement
IColorProvider in
order to correctly. |
CUSTOM_VARIANT
Constructor and Description |
---|
TableControlSWTRenderer(VTableControl vElement,
ViewModelContext viewContext,
ReportService reportService,
EMFFormsDatabindingEMF emfFormsDatabinding,
EMFFormsLabelProvider emfFormsLabelProvider,
VTViewTemplateProvider vtViewTemplateProvider,
ImageRegistryService imageRegistryService,
EMFFormsEditSupport emfFormsEditSupport)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected int |
addAdditionalColumns(TableViewerSWTBuilder tableViewerSWTBuilder)
Override this method to add additional static columns at the beginning of the table.
|
protected int |
addButtonsToButtonBar(org.eclipse.swt.widgets.Composite buttonComposite)
Allows to add additional buttons to the button bar of the table control.
|
protected void |
addRow(org.eclipse.emf.ecore.EClass clazz,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
This method is called to add a new entry in the domain model and thus to create a new row in the table.
|
protected void |
applyEnable()
Allows implementers to set a control to enabled.
|
protected void |
applyReadOnly()
Marks a controls as readonly.
|
protected void |
applyValidation()
Allows implementers to display the validation state of the control.
|
protected int |
compare(org.eclipse.jface.viewers.Viewer viewer,
Object e1,
Object e2,
int direction,
int propertyIndex)
Get called by the
ECPTableViewerComparator in order to compare the given objects. |
protected org.eclipse.jface.viewers.CellEditor |
createCellEditor(org.eclipse.emf.ecore.EObject tempInstance,
org.eclipse.emf.ecore.EStructuralFeature feature,
org.eclipse.swt.widgets.Table table)
This is called in order to setup the editing support for a table column.
|
protected org.eclipse.swt.widgets.Composite |
createControlComposite(org.eclipse.swt.widgets.Composite composite)
Creates and returns the composite which will be the parent for the table viewer.
|
protected void |
deleteRows(List<org.eclipse.emf.ecore.EObject> deletionList,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
This is called by
#deleteRowUserConfirmDialog(List) after the user confirmed to delete the selected
elements. |
protected void |
deleteRowUserConfirmDialog(List<org.eclipse.emf.ecore.EObject> deletionList,
org.eclipse.emf.ecore.EObject eObject,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature,
org.eclipse.swt.widgets.Button addButton,
org.eclipse.swt.widgets.Button removeButton)
This method shows a user confirmation dialog when the user attempts to delete a row in the table.
|
protected void |
dispose()
Disposes all resources used by the renderer.
|
protected org.eclipse.swt.widgets.Button |
getAddButton()
Returns the add button created by the framework.
|
protected EMFFormsDatabindingEMF |
getEMFFormsDatabinding()
The
EMFFormsDatabinding to use. |
SWTGridDescription |
getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.
|
protected org.eclipse.swt.graphics.Image |
getImage(String path)
Retrieve images from the
ImageRegistryService using a bundle relative path. |
protected org.eclipse.swt.graphics.Image |
getImage(URL url)
Retrieve images from the
ImageRegistryService using an URL . |
protected org.eclipse.swt.widgets.Button |
getRemoveButton()
Returns the remove button created by the framework.
|
protected int |
getTableHeightHint()
Returns the preferred height for the table.
|
protected org.eclipse.jface.viewers.TableViewer |
getTableViewer()
Returns the table viewer.
|
protected org.eclipse.swt.widgets.Control |
renderControl(SWTGridCell gridCell,
org.eclipse.swt.widgets.Composite parent)
Renders the passed
VElement . |
protected void |
rootDomainModelChanged()
This method is called in
AbstractControlSWTRenderer.notifyChange() when the root domain model of the view model context changes. |
protected void |
setTableViewer(org.eclipse.jface.viewers.TableViewer tableViewer)
Sets the table viewer.
|
protected void |
viewerSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
This method gets called when the selection on the
TableViewer (see getTableViewer() ) has
changed. |
canHandleControlProcessor, createLabel, createValidationIcon, defaultHandleControlProcessor, defaultHandleControlProcessorForCell, getDataBindingContext, getEditingDomain, getEMFFormsLabelProvider, getModelValue, getValidationBackgroundColor, getValidationIcon, getVTViewTemplateProvider, hasLeftLabelAlignment, notifyChange, postInit, render
applyVisible, finalizeRendering, getControls, getDefaultFontName, init, preInit, setControlEnabled
checkRenderer, getReportService, getVElement, getViewModelContext
@Inject public TableControlSWTRenderer(VTableControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabindingEMF emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport)
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- The EMFFormsDatabinding
emfFormsLabelProvider
- The EMFFormsLabelProvider
reportService
- The ReportService
vtViewTemplateProvider
- The VTViewTemplateProvider
imageRegistryService
- The ImageRegistryService
emfFormsEditSupport
- The EMFFormsEditSupport
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
AbstractSWTRenderer
getGridDescription
in class AbstractSWTRenderer<VTableControl>
gridDescription
- the current SWTGridDescription
protected EMFFormsDatabindingEMF getEMFFormsDatabinding()
EMFFormsDatabinding
to use.getEMFFormsDatabinding
in class AbstractControlSWTRenderer<VTableControl>
AbstractControlSWTRenderer.getEMFFormsDatabinding()
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
AbstractSWTRenderer
VElement
.renderControl
in class AbstractSWTRenderer<VTableControl>
gridCell
- the GridCell
of the control to renderparent
- the Composite
to render onControl
NoRendererFoundException
- this is thrown when a renderer cannot be foundNoPropertyDescriptorFoundExeption
- this is thrown when no property descriptor can be foundprotected int addAdditionalColumns(TableViewerSWTBuilder tableViewerSWTBuilder)
tableViewerSWTBuilder
- the builderprotected int addButtonsToButtonBar(org.eclipse.swt.widgets.Composite buttonComposite)
The default implementation does not add additional buttons.
buttonComposite
- the composite where the buttons are addedprotected org.eclipse.swt.widgets.Composite createControlComposite(org.eclipse.swt.widgets.Composite composite)
composite
- the parent composite including the title/button barprotected int getTableHeightHint()
protected org.eclipse.jface.viewers.TableViewer getTableViewer()
protected void setTableViewer(org.eclipse.jface.viewers.TableViewer tableViewer)
tableViewer
- the viewerprotected void viewerSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
TableViewer
(see getTableViewer()
) has
changed.
If you override this method make sure to call super.
event
- the SelectionChangedEvent
protected org.eclipse.swt.graphics.Image getImage(URL url)
ImageRegistryService
using an URL
.url
- The URL
pointing to the imageprotected org.eclipse.swt.graphics.Image getImage(String path)
ImageRegistryService
using a bundle relative path.path
- The bundle relative path pointing to the imageprotected org.eclipse.jface.viewers.CellEditor createCellEditor(org.eclipse.emf.ecore.EObject tempInstance, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.swt.widgets.Table table)
tempInstance
- the temporary input instance of the tablefeature
- the feature of the columntable
- the table/parentprotected void deleteRowUserConfirmDialog(List<org.eclipse.emf.ecore.EObject> deletionList, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature, org.eclipse.swt.widgets.Button addButton, org.eclipse.swt.widgets.Button removeButton)
deletionList
- the list of selected EObjects to deleteeObject
- The containment reference EObject
structuralFeature
- The containment reference EStructuralFeature
addButton
- the add buttonremoveButton
- the remove buttonprotected void deleteRows(List<org.eclipse.emf.ecore.EObject> deletionList, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
#deleteRowUserConfirmDialog(List)
after the user confirmed to delete the selected
elements.deletionList
- the list of EObjects
to deleteeObject
- The containment reference EObject
structuralFeature
- The containment reference EStructuralFeature
protected void addRow(org.eclipse.emf.ecore.EClass clazz, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
clazz
- the EClass
defining the EObject to createeObject
- The containment reference EObject
structuralFeature
- The containment reference EStructuralFeature
protected void applyValidation()
AbstractSWTRenderer
applyValidation
in class AbstractSWTRenderer<VTableControl>
protected org.eclipse.swt.widgets.Button getAddButton()
protected org.eclipse.swt.widgets.Button getRemoveButton()
protected void applyEnable()
applyEnable
in class AbstractControlSWTRenderer<VTableControl>
AbstractSWTRenderer.applyEnable()
protected void applyReadOnly()
applyReadOnly
in class AbstractSWTRenderer<VTableControl>
AbstractSWTRenderer.applyReadOnly()
protected void dispose()
dispose
in class AbstractControlSWTRenderer<VTableControl>
AbstractSWTRenderer.dispose()
protected int compare(org.eclipse.jface.viewers.Viewer viewer, Object e1, Object e2, int direction, int propertyIndex)
ECPTableViewerComparator
in order to compare the given objects.viewer
- the tavle viewere1
- the first object of the comparisone2
- the second object of the comparisonpropertyIndex
- index of the selection column. the index is aligned with the index of the associated column
domain model referencedirection
- SWT.NONE
, SWT.UP
or SWT.DOWN
according to the indication displayed at
the table column.0
if the first element is
equal to the second element; and a positive number if the first
element is greater than the second elementprotected void rootDomainModelChanged() throws DatabindingFailedException
AbstractControlSWTRenderer.notifyChange()
when the root domain model of the view model context changes.rootDomainModelChanged
in class AbstractControlSWTRenderer<VTableControl>
DatabindingFailedException
- If the databinding failedAbstractControlSWTRenderer.rootDomainModelChanged()
Copyright © 2016. All rights reserved.