Class TableControlSWTRenderer
- java.lang.Object
-
- org.eclipse.emf.ecp.view.model.common.AbstractRenderer<VELEMENT>
-
- org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer<VCONTROL>
-
- org.eclipse.emf.ecp.view.spi.core.swt.AbstractControlSWTRenderer<VTableControl>
-
- org.eclipse.emf.ecp.view.spi.table.swt.TableControlSWTRenderer
-
- All Implemented Interfaces:
RootDomainModelChangeListener
- Direct Known Subclasses:
GridControlSWTRenderer
,RAPGridControlSWTRenderer
,TableControlDetailDialogSWTRenderer
,TableControlDetailPanelRenderer
,TableControlRCPRenderer
public class TableControlSWTRenderer extends AbstractControlSWTRenderer<VTableControl>
SWT Renderer for Table Control.- Author:
- Eugen Neufeld, Johannes Faltermeier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TableControlSWTRenderer.AutoSortModelChangeListener
Domain model change listener that re-sorts the table and reveals the added resp.protected class
TableControlSWTRenderer.CompactVerticallyTableControlSWTRendererCompositeBuilder
TableViewerCompositeBuilder
which calls the existing template method to create the validation label.class
TableControlSWTRenderer.ECPCellLabelProvider
ECP specific cell label provider that does also implementIColorProvider
in order to correctly.protected class
TableControlSWTRenderer.ECPTableViewerComparator
TheViewerComparator
for this table which allows 3 states for sort order: none, up and down.protected class
TableControlSWTRenderer.TableControlComparator
This class combines theViewerComparator
with theTableViewerComparator
.protected class
TableControlSWTRenderer.TableControlEditingSupportAndLabelProvider
ImplementsEditingSupportCreator
andCellLabelProviderFactory
for the table control swt renderer.protected class
TableControlSWTRenderer.TableControlSWTRendererCompositeBuilder
TableViewerCompositeBuilder
which calls the existing template method to create the validation label.protected class
TableControlSWTRenderer.TableControlSWTRendererTableViewerCreator
TableViewerCreator
for the table control swt renderer.
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
FIXED_COLUMNS
protected static java.lang.String
TABLE_CUSTOM_VARIANT
protected static org.eclipse.swt.graphics.Point
VALIDATION_PREFERRED_SIZE
-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description TableControlSWTRenderer(VTableControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabindingEMF emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport)
Deprecated.TableControlSWTRenderer(VTableControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabindingEMF emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport, EMFFormsLocalizationService localizationService)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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)
Deprecated.this method will be move toAddRowAction
in the futureprotected void
applyEnable()
Allows implementers to set a control to enabled.protected void
applyReadOnly()
Marks a controls as readonly.protected void
applyUnchangeableFeature()
This method is applied if the control's feature is configured as unchangeable.protected void
applyValidation()
Allows implementers to display the validation state of the control.protected void
applyValidation(VDiagnostic oldDiagnostic, VDiagnostic newDiagnostic)
Called before theAbstractSWTRenderer.applyValidation()
.protected boolean
canEditObject(java.lang.Object element)
Checks whether an element is editable or not.protected int
compare(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object left, java.lang.Object right, int direction, int propertyIndex)
Get called by theTableControlSWTRenderer.ECPTableViewerComparator
in order to compare the given objects.protected int
computeRequiredHeight(java.lang.Integer visibleLines)
Returns the height in pixels required to display the given number of table items.protected ActionConfiguration
configureActions(TableRendererViewerActionContext actionContext)
Configure the actions applicable to this table viewer.protected TableActionBar<? extends org.eclipse.jface.viewers.AbstractTableViewer>
createActionBar(TableRendererViewerActionContext actionContext, ActionConfiguration actionConfiguration)
Creates an action bar.protected org.eclipse.jface.viewers.CellEditor
createCellEditor(org.eclipse.emf.ecore.EObject tempInstance, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.swt.widgets.Composite table)
This is called in order to setup the editing support for a table column.protected org.eclipse.jface.viewers.CellLabelProvider
createCellLabelProvider(org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.jface.viewers.CellEditor cellEditor, org.eclipse.core.databinding.observable.map.IObservableMap attributeMap, VTableControl vTableControl, VDomainModelReference dmr, org.eclipse.swt.widgets.Control table)
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 VTBackgroundStyleProperty
createDefaultBackgroundStyleProperty()
Creates the defaultVTBackgroundStyleProperty
.protected VTFontPropertiesStyleProperty
createDefaultFontPropertiesStyleProperty()
Creates the defaultVTFontPropertiesStyleProperty
.protected VTTableStyleProperty
createDefaultTableStyleProperty()
Creates the defaultVTTableStyleProperty
.protected VTTableValidationStyleProperty
createDefaultTableValidationStyleProperty()
Creates the defaultVTTableValidationStyleProperty
.protected org.eclipse.swt.widgets.Control
createLabel(org.eclipse.swt.widgets.Composite parent)
Create theControl
displaying the label of the currentVControl
.protected TableControlSWTRenderer.TableControlComparator
createTableViewerComparator()
Creates a TableControlComparator.protected TableViewerCompositeBuilder
createTableViewerCompositeBuilder()
Creates theTableViewerCompositeBuilder
used to get Composite hierarchy for this table renderer.protected TableViewerSWTBuilder
createTableViewerSWTBuilder(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.databinding.observable.list.IObservableList list, org.eclipse.core.databinding.observable.value.IObservableValue labelText, org.eclipse.core.databinding.observable.value.IObservableValue labelTooltipText, TableViewerCompositeBuilder compositeBuilder, org.eclipse.jface.databinding.viewers.ObservableListContentProvider cp, TableControlSWTRenderer.ECPTableViewerComparator comparator, TableActionBar<? extends org.eclipse.jface.viewers.AbstractTableViewer> actionBar)
protected TableViewerSWTBuilder
createTableViewerSWTBuilder(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.databinding.observable.list.IObservableList list, org.eclipse.core.databinding.observable.value.IObservableValue labelText, org.eclipse.core.databinding.observable.value.IObservableValue labelTooltipText, TableViewerCompositeBuilder compositeBuilder, org.eclipse.jface.databinding.viewers.ObservableListContentProvider cp, org.eclipse.jface.viewers.ViewerComparator comparator, TableActionBar<? extends org.eclipse.jface.viewers.AbstractTableViewer> actionBar)
Creates a newTableViewerSWTBuilder
.protected TableRendererViewerActionContext
createViewerActionContext()
Create theViewerActionContext
for the table viewer.protected void
deleteRows(java.util.List<org.eclipse.emf.ecore.EObject> deletionList, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Deprecated.this method will be moved toRemoveRowAction
in the futureprotected void
deleteRowUserConfirmDialog(java.util.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)
Deprecated.this method will be moved toRemoveRowAction
in the futureprotected void
dispose()
Disposes all resources used by the renderer.protected java.lang.String
formatTooltipText(org.eclipse.emf.ecore.EClass eClass, java.lang.String messageKey)
Localize the message.protected org.eclipse.swt.widgets.Button
getAddButton()
Deprecated.usegetControlForAction(String)
insteadprotected VTBackgroundStyleProperty
getBackgroundStyleProperty()
Returns theVTBackgroundStyleProperty
.protected org.eclipse.emf.common.util.EList<VDomainModelReference>
getColumnDomainModelReferences()
Retrieves this table's column DMRs from the table DMR.protected org.eclipse.emf.ecore.EStructuralFeature
getColumnFeature(int propertyIndex)
Find the feature for a specific index.protected org.eclipse.swt.widgets.Item[]
getColumns()
Returns an array ofitems
which are the columns in the table.Optional<org.eclipse.swt.widgets.Control>
getControlForAction(java.lang.String actionId)
Returns the control created to trigger a certain action.protected VDomainModelReference
getDMRToMultiReference()
protected EMFFormsDatabindingEMF
getEMFFormsDatabinding()
TheEMFFormsDatabinding
to use.protected FeatureAwareComparator<org.eclipse.emf.common.util.Enumerator>
getEnumeratorComparator()
protected VTFontPropertiesStyleProperty
getFontPropertiesStyleProperty()
Returns theVTFontPropertiesStyleProperty
.SWTGridDescription
getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.protected org.eclipse.swt.widgets.ScrollBar
getHorizontalBar()
Returns the receiver's horizontal scroll bar if it has one, and null if it does not.protected org.eclipse.swt.graphics.Image
getImage(java.lang.String path)
Retrieve images from theImageRegistryService
using a bundle relative path.protected org.eclipse.swt.graphics.Image
getImage(java.net.URL url)
Retrieve images from theImageRegistryService
using anURL
.protected java.lang.String[]
getKeyBindingsForAction(java.lang.String actionId, java.lang.String... defaultKeybindings)
Helper to extract the configured key bindings form the view template model.protected java.lang.String
getReferenceDisplayName(org.eclipse.emf.ecore.EClassifier type)
Obtains a user-presentable name for the reference that I edit, to be used for example in button tool-tips.protected org.eclipse.swt.widgets.Button
getRemoveButton()
Deprecated.usegetControlForAction(String)
insteadprotected int
getSelectionIndex()
Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.protected Optional<org.eclipse.emf.ecore.EStructuralFeature.Setting>
getSettingFromObservable(VDomainModelReference dmr, org.eclipse.emf.ecore.EObject eObject)
Helper method which uses an EMFForms observable value to get the setting for the givenVDomainModelReference
.protected java.util.Optional<org.eclipse.emf.ecore.EStructuralFeature>
getSortColumnFeature()
Returns the current sort column feature.protected org.eclipse.swt.graphics.Color
getSWTColor(java.lang.String colorHex)
Returns theColor
specified by the provided String.protected int
getTableHeightHint()
Returns the preferred height for the table.protected VTTableStyleProperty
getTableStyleProperty()
Returns theVTTableStyleProperty
.protected VTTableValidationStyleProperty
getTableValidationStyleProperty()
Returns theVTTableValidationStyleProperty
.protected org.eclipse.jface.viewers.AbstractTableViewer
getTableViewer()
Returns the table viewer.protected AbstractTableViewerComposite
getTableViewerComposite()
Returns theAbstractTableViewerComposite
.protected TableViewerCreator<? extends org.eclipse.jface.viewers.AbstractTableViewer>
getTableViewerCreator()
Creates a new instance of theTableViewerCreator
to be used.protected org.eclipse.swt.widgets.ScrollBar
getVerticalBar()
Returns the receiver's vertical scroll bar if it has one, and null if it does not.protected void
postRefresh()
Post a request to refresh my viewer on the asynchronous refresh manager.protected void
postRefresh(java.lang.Runnable refreshRunnable)
Post a refresh request on the asynchronous refresh manager.protected org.eclipse.swt.widgets.Control
renderControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent)
Renders the passedVElement
.protected org.eclipse.swt.widgets.Control
renderTableControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent)
Renders the Table Control.boolean
reveal(java.lang.Object object)
Reeveal the givenobject
in my table.protected void
rootDomainModelChanged()
This method is called inAbstractControlSWTRenderer.notifyChange()
when the root domain model of the view model context changes.protected void
setSortColumnFeature(org.eclipse.emf.ecore.EStructuralFeature sortColumnFeature)
Set the column to use for sorting.protected void
setTableViewer(org.eclipse.jface.viewers.AbstractTableViewer tableViewer)
Sets the table viewer.protected boolean
shouldCreateCellEditor(java.lang.Object element)
Defined whether a cell editor should be created or not.protected void
updateActionBar()
Update this table control's action bar if it is present.protected void
viewerSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
This method gets called when the selection on theTableViewer
(seegetTableViewer()
) has changed.-
Methods inherited from class org.eclipse.emf.ecp.view.spi.core.swt.AbstractControlSWTRenderer
canHandleControlProcessor, createValidationIcon, defaultHandleControlProcessor, defaultHandleControlProcessorForCell, getDataBindingContext, getEditingDomain, getEMFFormsLabelProvider, getLabelStyleBits, getModelValue, getValidationBackgroundColor, getValidationBackgroundColor, getValidationForegroundColor, getValidationForegroundColor, getValidationIcon, getValidationIcon, getVTViewTemplateProvider, hasLeftLabelAlignment, isUnchangeableFeature, notifyChange, postInit, render
-
Methods inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
applyVisible, canReveal, finalizeRendering, getControls, getDefaultFontName, ignoreEnableOnReadOnly, init, isRenderingFinished, preInit, scrollToReveal, scrollToReveal, setControlEnabled
-
Methods inherited from class org.eclipse.emf.ecp.view.model.common.AbstractRenderer
checkRenderer, getRenderer, getReportService, getVElement, getViewModelContext, register
-
-
-
-
Field Detail
-
FIXED_COLUMNS
protected static final java.lang.String FIXED_COLUMNS
- Since:
- 1.10
- See Also:
- Constant Field Values
-
TABLE_CUSTOM_VARIANT
protected static final java.lang.String TABLE_CUSTOM_VARIANT
- Since:
- 1.10
- See Also:
- Constant Field Values
-
VALIDATION_PREFERRED_SIZE
protected static final org.eclipse.swt.graphics.Point VALIDATION_PREFERRED_SIZE
- Since:
- 1.17
-
-
Constructor Detail
-
TableControlSWTRenderer
@Deprecated public TableControlSWTRenderer(VTableControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabindingEMF emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport)
Deprecated.Legacy constructor for backwards compatibility.- Parameters:
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- TheEMFFormsDatabinding
emfFormsLabelProvider
- TheEMFFormsLabelProvider
reportService
- TheReportService
vtViewTemplateProvider
- TheVTViewTemplateProvider
imageRegistryService
- TheImageRegistryService
emfFormsEditSupport
- TheEMFFormsEditSupport
- Since:
- 1.8
-
TableControlSWTRenderer
@Inject public TableControlSWTRenderer(VTableControl vElement, ViewModelContext viewContext, ReportService reportService, EMFFormsDatabindingEMF emfFormsDatabinding, EMFFormsLabelProvider emfFormsLabelProvider, VTViewTemplateProvider vtViewTemplateProvider, ImageRegistryService imageRegistryService, EMFFormsEditSupport emfFormsEditSupport, EMFFormsLocalizationService localizationService)
Default constructor.- Parameters:
vElement
- the view model element to be renderedviewContext
- the view contextemfFormsDatabinding
- TheEMFFormsDatabinding
emfFormsLabelProvider
- TheEMFFormsLabelProvider
reportService
- TheReportService
vtViewTemplateProvider
- TheVTViewTemplateProvider
imageRegistryService
- TheImageRegistryService
emfFormsEditSupport
- TheEMFFormsEditSupport
localizationService
- TheEMFFormsLocalizationService
- Since:
- 1.22
-
-
Method Detail
-
getGridDescription
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
Description copied from class:AbstractSWTRenderer
Returns the GridDescription for this Renderer.- Specified by:
getGridDescription
in classAbstractSWTRenderer<VTableControl>
- Parameters:
gridDescription
- the currentSWTGridDescription
- Returns:
- the number of controls per row
-
getEMFFormsDatabinding
protected EMFFormsDatabindingEMF getEMFFormsDatabinding()
Description copied from class:AbstractControlSWTRenderer
TheEMFFormsDatabinding
to use.- Overrides:
getEMFFormsDatabinding
in classAbstractControlSWTRenderer<VTableControl>
- Returns:
- The EMFFormsDatabinding
-
renderControl
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Description copied from class:AbstractSWTRenderer
Renders the passedVElement
.- Specified by:
renderControl
in classAbstractSWTRenderer<VTableControl>
- Parameters:
gridCell
- 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
-
createLabel
protected org.eclipse.swt.widgets.Control createLabel(org.eclipse.swt.widgets.Composite parent)
Description copied from class:AbstractControlSWTRenderer
Create theControl
displaying the label of the currentVControl
.- Overrides:
createLabel
in classAbstractControlSWTRenderer<VTableControl>
- Parameters:
parent
- theComposite
to render onto- Returns:
- the created
Control
or null
-
renderTableControl
protected org.eclipse.swt.widgets.Control renderTableControl(SWTGridCell gridCell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Renders the Table Control. Renders the Table Control including title and validation whenRenderMode
is set toRenderMode.DEFAULT
. Only renders the Table Control without title and validation when renderMode is set toRenderMode.COMPACT_VERTICALLY
.- Parameters:
gridCell
- theSWTGridCell
.parent
- theComposite
.- Returns:
- the rendered
Control
. - Throws:
NoRendererFoundException
- theNoRendererFoundException
.NoPropertyDescriptorFoundExeption
- theNoPropertyDescriptorFoundExeption
.- Since:
- 1.14
-
createTableViewerComparator
protected TableControlSWTRenderer.TableControlComparator createTableViewerComparator()
Creates a TableControlComparator.- Returns:
- TableControlComparator
- Since:
- 1.22
-
createViewerActionContext
protected TableRendererViewerActionContext createViewerActionContext()
Create theViewerActionContext
for the table viewer.- Returns:
- the
TableRendererViewerActionContext
- Throws:
DatabindingFailedException
- Since:
- 1.18
-
configureActions
protected ActionConfiguration configureActions(TableRendererViewerActionContext actionContext)
Configure the actions applicable to this table viewer.- Parameters:
actionContext
- the action context- Returns:
- an
ActionConfigurationImpl
built using theActionConfigurationBuilder
- Since:
- 1.18
-
getKeyBindingsForAction
protected java.lang.String[] getKeyBindingsForAction(java.lang.String actionId, java.lang.String... defaultKeybindings)
Helper to extract the configured key bindings form the view template model.- Parameters:
actionId
- the ID of the action to extract the key bindings fordefaultKeybindings
- the default key bindings to use in case there are no bindings configured- Returns:
- an array of key bindings
- Since:
- 1.18
-
createActionBar
protected TableActionBar<? extends org.eclipse.jface.viewers.AbstractTableViewer> createActionBar(TableRendererViewerActionContext actionContext, ActionConfiguration actionConfiguration)
Creates an action bar.- Parameters:
actionContext
- theViewerActionContext
to useactionConfiguration
- theActionConfiguration
to use- Returns:
- a action bar builder
- Since:
- 1.18
-
createTableViewerCompositeBuilder
protected TableViewerCompositeBuilder createTableViewerCompositeBuilder()
Creates theTableViewerCompositeBuilder
used to get Composite hierarchy for this table renderer. This method can be overwritten by sub classes to customize the layout.- Returns:
- The
TableViewerCompositeBuilder
- Since:
- 1.13
-
createTableViewerSWTBuilder
@Deprecated protected TableViewerSWTBuilder createTableViewerSWTBuilder(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.databinding.observable.list.IObservableList list, org.eclipse.core.databinding.observable.value.IObservableValue labelText, org.eclipse.core.databinding.observable.value.IObservableValue labelTooltipText, TableViewerCompositeBuilder compositeBuilder, org.eclipse.jface.databinding.viewers.ObservableListContentProvider cp, TableControlSWTRenderer.ECPTableViewerComparator comparator, TableActionBar<? extends org.eclipse.jface.viewers.AbstractTableViewer> actionBar)
Deprecated.Creates a newTableViewerSWTBuilder
.- Parameters:
parent
- the parentComposite
list
- the input objectlabelText
- the titlelabelTooltipText
- the tooltipcompositeBuilder
- theTableViewerCompositeBuilder
cp
- the content providercomparator
- theViewerComparator
; has no effect if move up/down functionality is enabledactionBar
- theActionBar
- Returns:
- the
TableViewerSWTBuilder
- Since:
- 1.18
-
createTableViewerSWTBuilder
protected TableViewerSWTBuilder createTableViewerSWTBuilder(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.databinding.observable.list.IObservableList list, org.eclipse.core.databinding.observable.value.IObservableValue labelText, org.eclipse.core.databinding.observable.value.IObservableValue labelTooltipText, TableViewerCompositeBuilder compositeBuilder, org.eclipse.jface.databinding.viewers.ObservableListContentProvider cp, org.eclipse.jface.viewers.ViewerComparator comparator, TableActionBar<? extends org.eclipse.jface.viewers.AbstractTableViewer> actionBar)
Creates a newTableViewerSWTBuilder
.- Parameters:
parent
- the parentComposite
list
- the input objectlabelText
- the titlelabelTooltipText
- the tooltipcompositeBuilder
- theTableViewerCompositeBuilder
cp
- the content providercomparator
- theViewerComparator
; has no effect if move up/down functionality is enabledactionBar
- theActionBar
- Returns:
- the
TableViewerSWTBuilder
- Since:
- 1.22
-
getTableViewerCreator
protected TableViewerCreator<? extends org.eclipse.jface.viewers.AbstractTableViewer> getTableViewerCreator()
Creates a new instance of theTableViewerCreator
to be used.- Returns:
- the
TableViewerCreator
- Since:
- 1.10
-
addAdditionalColumns
protected int addAdditionalColumns(TableViewerSWTBuilder tableViewerSWTBuilder)
Override this method to add additional static columns at the beginning of the table.- Parameters:
tableViewerSWTBuilder
- the builder- Returns:
- the number of columns added
- Since:
- 1.9
-
getSelectionIndex
protected int getSelectionIndex()
Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.- Returns:
- the index of the selected item
- Since:
- 1.10
-
getColumns
protected org.eclipse.swt.widgets.Item[] getColumns()
Returns an array ofitems
which are the columns in the table.- Returns:
- the columns of the table
- Since:
- 1.10
-
getHorizontalBar
protected org.eclipse.swt.widgets.ScrollBar getHorizontalBar()
Returns the receiver's horizontal scroll bar if it has one, and null if it does not.- Returns:
- the horizontal scroll bar (or null)
- Since:
- 1.10
-
getVerticalBar
protected org.eclipse.swt.widgets.ScrollBar getVerticalBar()
Returns the receiver's vertical scroll bar if it has one, and null if it does not.- Returns:
- the vertical scroll bar (or null)
- Since:
- 1.10
-
getDMRToMultiReference
protected VDomainModelReference getDMRToMultiReference()
- Returns:
- the
VDomainModelReference
which ends at the table setting - Since:
- 1.11
-
addButtonsToButtonBar
protected int addButtonsToButtonBar(org.eclipse.swt.widgets.Composite buttonComposite)
Allows to add additional buttons to the button bar of the table control.The default implementation does not add additional buttons.
- Parameters:
buttonComposite
- the composite where the buttons are added- Returns:
- the total number of buttons added
-
createControlComposite
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.- Parameters:
composite
- the parent composite including the title/button bar- Returns:
- the parent for the table viewer
-
getTableHeightHint
protected int getTableHeightHint()
Returns the preferred height for the table. This will be passed to the layoutdata.- Returns:
- the height in px
-
computeRequiredHeight
protected int computeRequiredHeight(java.lang.Integer visibleLines)
Returns the height in pixels required to display the given number of table items. If the visible items are not specified, the height required to display all the table items is returned.- Parameters:
visibleLines
- the number of visible table items- Returns:
- the required height
- Since:
- 1.13
-
getTableViewer
protected org.eclipse.jface.viewers.AbstractTableViewer getTableViewer()
Returns the table viewer.- Returns:
- the viewer
- Since:
- 1.10
-
getTableViewerComposite
protected AbstractTableViewerComposite getTableViewerComposite()
Returns theAbstractTableViewerComposite
.- Returns:
- the table viewer composite
- Since:
- 1.13
-
setTableViewer
protected void setTableViewer(org.eclipse.jface.viewers.AbstractTableViewer tableViewer)
Sets the table viewer.- Parameters:
tableViewer
- the viewer- Since:
- 1.10
-
viewerSelectionChanged
protected void viewerSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
This method gets called when the selection on theTableViewer
(seegetTableViewer()
) has changed.If you override this method make sure to call super.
- Parameters:
event
- theSelectionChangedEvent
-
getImage
protected org.eclipse.swt.graphics.Image getImage(java.net.URL url)
Retrieve images from theImageRegistryService
using anURL
.- Parameters:
url
- TheURL
pointing to the image- Returns:
- The retrieved Image
- Since:
- 1.6
-
getImage
protected org.eclipse.swt.graphics.Image getImage(java.lang.String path)
Retrieve images from theImageRegistryService
using a bundle relative path.- Parameters:
path
- The bundle relative path pointing to the image- Returns:
- The retrieved Image
- Since:
- 1.6
-
getTableValidationStyleProperty
protected VTTableValidationStyleProperty getTableValidationStyleProperty()
Returns theVTTableValidationStyleProperty
.- Returns:
- the
VTTableValidationStyleProperty
- Since:
- 1.14
-
createDefaultTableValidationStyleProperty
protected VTTableValidationStyleProperty createDefaultTableValidationStyleProperty()
Creates the defaultVTTableValidationStyleProperty
.- Returns:
- the default
VTTableValidationStyleProperty
- Since:
- 1.14
-
getBackgroundStyleProperty
protected VTBackgroundStyleProperty getBackgroundStyleProperty()
Returns theVTBackgroundStyleProperty
.- Returns:
- the
VTBackgroundStyleProperty
- Since:
- 1.10
-
createDefaultBackgroundStyleProperty
protected VTBackgroundStyleProperty createDefaultBackgroundStyleProperty()
Creates the defaultVTBackgroundStyleProperty
.- Returns:
- the default
VTBackgroundStyleProperty
- Since:
- 1.14
-
getTableStyleProperty
protected VTTableStyleProperty getTableStyleProperty()
Returns theVTTableStyleProperty
.- Returns:
- the
VTTableStyleProperty
- Since:
- 1.14
-
createDefaultTableStyleProperty
protected VTTableStyleProperty createDefaultTableStyleProperty()
Creates the defaultVTTableStyleProperty
.- Returns:
- the default
VTTableStyleProperty
- Since:
- 1.14
-
getFontPropertiesStyleProperty
protected VTFontPropertiesStyleProperty getFontPropertiesStyleProperty()
Returns theVTFontPropertiesStyleProperty
.- Returns:
- the
VTFontPropertiesStyleProperty
- Since:
- 1.10
-
createDefaultFontPropertiesStyleProperty
protected VTFontPropertiesStyleProperty createDefaultFontPropertiesStyleProperty()
Creates the defaultVTFontPropertiesStyleProperty
.- Returns:
- the default
VTFontPropertiesStyleProperty
- Since:
- 1.14
-
getSWTColor
protected org.eclipse.swt.graphics.Color getSWTColor(java.lang.String colorHex)
Returns theColor
specified by the provided String.- Parameters:
colorHex
- the Hex String describing the color- Returns:
- the
Color
- Since:
- 1.10
-
getColumnDomainModelReferences
protected org.eclipse.emf.common.util.EList<VDomainModelReference> getColumnDomainModelReferences()
Retrieves this table's column DMRs from the table DMR.- Returns:
- The domain model references defining the columns of this table.
- Since:
- 1.19
-
createCellEditor
protected org.eclipse.jface.viewers.CellEditor createCellEditor(org.eclipse.emf.ecore.EObject tempInstance, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.swt.widgets.Composite table)
This is called in order to setup the editing support for a table column.- Parameters:
tempInstance
- the temporary input instance of the tablefeature
- the feature of the columntable
- the table/parent- Returns:
- the cell editor
- Since:
- 1.10
-
deleteRowUserConfirmDialog
@Deprecated protected void deleteRowUserConfirmDialog(java.util.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)
Deprecated.this method will be moved toRemoveRowAction
in the futureThis method shows a user confirmation dialog when the user attempts to delete a row in the table.- Parameters:
deletionList
- the list of selected EObjects to deleteeObject
- The containment referenceEObject
structuralFeature
- The containment referenceEStructuralFeature
addButton
- the add buttonremoveButton
- the remove button- Since:
- 1.6
-
deleteRows
@Deprecated protected void deleteRows(java.util.List<org.eclipse.emf.ecore.EObject> deletionList, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Deprecated.this method will be moved toRemoveRowAction
in the futureThis is called by#deleteRowUserConfirmDialog(List)
after the user confirmed to delete the selected elements.- Parameters:
deletionList
- the list ofEObjects
to deleteeObject
- The containment referenceEObject
structuralFeature
- The containment referenceEStructuralFeature
- Since:
- 1.6
-
addRow
@Deprecated protected void addRow(org.eclipse.emf.ecore.EClass clazz, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
Deprecated.this method will be move toAddRowAction
in the futureThis method is called to add a new entry in the domain model and thus to create a new row in the table. The element to create is defined by the provided class. You can override this method but you have to call super nonetheless.- Parameters:
clazz
- theEClass
defining the EObject to createeObject
- The containment referenceEObject
structuralFeature
- The containment referenceEStructuralFeature
- Since:
- 1.6
-
applyValidation
protected void applyValidation(VDiagnostic oldDiagnostic, VDiagnostic newDiagnostic)
Description copied from class:AbstractSWTRenderer
Called before theAbstractSWTRenderer.applyValidation()
. This method allows to create a diff between the old diagnostic and the new diagnostic and thus improve the performance of the overlay apply by triggering it only on the relevant elements.- Overrides:
applyValidation
in classAbstractSWTRenderer<VTableControl>
- Parameters:
oldDiagnostic
- The previousVDiagnostic
newDiagnostic
- The currentVDiagnostic
-
applyValidation
protected void applyValidation()
Description copied from class:AbstractSWTRenderer
Allows implementers to display the validation state of the control. The default implementation does nothing.- Overrides:
applyValidation
in classAbstractSWTRenderer<VTableControl>
-
postRefresh
protected void postRefresh()
Post a request to refresh my viewer on the asynchronous refresh manager.- Since:
- 1.21
- See Also:
getTableViewer()
,ViewerRefreshManager
-
postRefresh
protected void postRefresh(java.lang.Runnable refreshRunnable)
Post a refresh request on the asynchronous refresh manager.- Parameters:
refreshRunnable
- the refresh operation to execute- Since:
- 1.21
- See Also:
ViewerRefreshManager
-
getAddButton
@Deprecated protected org.eclipse.swt.widgets.Button getAddButton()
Deprecated.usegetControlForAction(String)
insteadReturns the add button created by the framework.- Returns:
- the addButton
- Since:
- 1.6
-
getRemoveButton
@Deprecated protected org.eclipse.swt.widgets.Button getRemoveButton()
Deprecated.usegetControlForAction(String)
insteadReturns the remove button created by the framework.- Returns:
- the removeButton
- Since:
- 1.6
-
getControlForAction
public Optional<org.eclipse.swt.widgets.Control> getControlForAction(java.lang.String actionId)
Returns the control created to trigger a certain action.- Parameters:
actionId
- the action ID of the action that is bound to the control- Returns:
- an optional for the control of the given action ID
- Since:
- 1.18
-
getSettingFromObservable
protected Optional<org.eclipse.emf.ecore.EStructuralFeature.Setting> getSettingFromObservable(VDomainModelReference dmr, org.eclipse.emf.ecore.EObject eObject)
Helper method which uses an EMFForms observable value to get the setting for the givenVDomainModelReference
.- Parameters:
dmr
- theVDomainModelReference
eObject
- theEObject
to get the setting for- Returns:
- an Optional
- Since:
- 1.17
-
applyEnable
protected void applyEnable()
Description copied from class:AbstractControlSWTRenderer
Allows implementers to set a control to enabled.- Overrides:
applyEnable
in classAbstractControlSWTRenderer<VTableControl>
- See Also:
AbstractSWTRenderer.applyEnable()
-
applyReadOnly
protected void applyReadOnly()
Description copied from class:AbstractControlSWTRenderer
Marks a controls as readonly.- Overrides:
applyReadOnly
in classAbstractControlSWTRenderer<VTableControl>
- See Also:
AbstractSWTRenderer.applyReadOnly()
-
applyUnchangeableFeature
protected void applyUnchangeableFeature()
Description copied from class:AbstractControlSWTRenderer
This method is applied if the control's feature is configured as unchangeable. The renderer is usually disabled when feature is not changeable.- Overrides:
applyUnchangeableFeature
in classAbstractControlSWTRenderer<VTableControl>
-
updateActionBar
protected void updateActionBar()
Update this table control's action bar if it is present.- Since:
- 1.20
-
dispose
protected void dispose()
Description copied from class:AbstractSWTRenderer
Disposes all resources used by the renderer. Don't forget to call super.dispose if overwriting this method.- Overrides:
dispose
in classAbstractControlSWTRenderer<VTableControl>
-
compare
protected int compare(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object left, java.lang.Object right, int direction, int propertyIndex)
Get called by theTableControlSWTRenderer.ECPTableViewerComparator
in order to compare the given objects.- Parameters:
viewer
- the table viewerleft
- the first object of the comparisonright
- 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
- 0 (no sorting = insertion order :=SWT.NONE
), 1 (ascending :=SWT.DOWN
) or 2 (descending :=SWT.UP
) according to the indication displayed at the table column.- Returns:
- a negative number if the first element is less than the
second element; the value
0
if the first element is equal to the second element; and a positive number if the first element is greater than the second element - Since:
- 1.8
-
rootDomainModelChanged
protected void rootDomainModelChanged() throws DatabindingFailedException
Description copied from class:AbstractControlSWTRenderer
This method is called inAbstractControlSWTRenderer.notifyChange()
when the root domain model of the view model context changes.- Overrides:
rootDomainModelChanged
in classAbstractControlSWTRenderer<VTableControl>
- Throws:
DatabindingFailedException
- If the databinding failed
-
canEditObject
protected boolean canEditObject(java.lang.Object element)
Checks whether an element is editable or not.- Parameters:
element
- The list entry to be checked- Returns:
- True if the element can be edited, false otherwise
- Since:
- 1.11
-
shouldCreateCellEditor
protected boolean shouldCreateCellEditor(java.lang.Object element)
Defined whether a cell editor should be created or not.- Parameters:
element
- The table entry to be checked- Returns:
- True if a CellEditor should be created, false otherwise
- Since:
- 1.12
-
createCellLabelProvider
protected org.eclipse.jface.viewers.CellLabelProvider createCellLabelProvider(org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.jface.viewers.CellEditor cellEditor, org.eclipse.core.databinding.observable.map.IObservableMap attributeMap, VTableControl vTableControl, VDomainModelReference dmr, org.eclipse.swt.widgets.Control table)
- Parameters:
feature
- the feature of the columncellEditor
- the cell editor for the columnattributeMap
- the attribute map displayed in the tablevTableControl
- the table view model elementdmr
- the domain model reference of the columntable
- the table control- Returns:
- the
CellLabelProvider
of the column - Since:
- 1.12
-
getEnumeratorComparator
protected FeatureAwareComparator<org.eclipse.emf.common.util.Enumerator> getEnumeratorComparator()
- Returns:
- The
FeatureAwareComparator
used to compareenum values
when sorting the table - Since:
- 1.22
-
reveal
public boolean reveal(java.lang.Object object)
Reeveal the givenobject
in my table.- Parameters:
object
- an object to reveal- Returns:
- whether I succeeded in revealing it
- Since:
- 1.22
-
formatTooltipText
protected java.lang.String formatTooltipText(org.eclipse.emf.ecore.EClass eClass, java.lang.String messageKey)
Localize the message.- Parameters:
eClass
- The EClass of the table setting.messageKey
- key of the string- Returns:
- tooltip.
- Since:
- 1.26
-
getSortColumnFeature
protected java.util.Optional<org.eclipse.emf.ecore.EStructuralFeature> getSortColumnFeature()
Returns the current sort column feature.- Returns:
- an
Optional
containing the feature used for sorting - Since:
- 1.22
-
setSortColumnFeature
protected void setSortColumnFeature(org.eclipse.emf.ecore.EStructuralFeature sortColumnFeature)
Set the column to use for sorting.- Parameters:
sortColumnFeature
- an optional containing the feature to use for sorting- Since:
- 1.22
-
getColumnFeature
protected org.eclipse.emf.ecore.EStructuralFeature getColumnFeature(int propertyIndex)
Find the feature for a specific index.- Parameters:
propertyIndex
- The index to find the feature for- Returns:
- The
EStructuralFeature
for the provided index - Since:
- 1.22
-
getReferenceDisplayName
protected java.lang.String getReferenceDisplayName(org.eclipse.emf.ecore.EClassifier type)
Obtains a user-presentable name for the reference that I edit, to be used for example in button tool-tips.- Returns:
- the reference display name
- Since:
- 1.25
-
-