Class TreeMasterDetailSWTRenderer
- java.lang.Object
-
- org.eclipse.emf.ecp.view.model.common.AbstractRenderer<VELEMENT>
-
- org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer<VTreeMasterDetail>
-
- org.eclipse.emf.ecp.view.spi.treemasterdetail.ui.swt.TreeMasterDetailSWTRenderer
-
public class TreeMasterDetailSWTRenderer extends AbstractSWTRenderer<VTreeMasterDetail>
SWT Renderer for aVTreeMasterDetail
element.- Since:
- 1.5
- Author:
- Anas Chakfeh, Eugen Neufeld
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DETAIL_KEY
The detail key passed to the view model context.static java.lang.String
GLOBAL_ADDITIONS
Menu separator ID for the group to which additional menu contributions are added in the tree's context menu.static java.lang.String
ROOT_KEY
Context key for the root.-
Fields inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
CUSTOM_VARIANT
-
-
Constructor Summary
Constructors Constructor Description TreeMasterDetailSWTRenderer(VTreeMasterDetail vElement, ViewModelContext viewContext, ReportService reportService)
Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyEnable()
Allows implementers to set a control to enabled.protected void
applyValidation(VDiagnostic oldDia, VDiagnostic newDia)
Called before theAbstractSWTRenderer.applyValidation()
.protected void
cleanCustomOnSelectionChange()
Gets called after a detail composite was disposed.protected void
createHeader(org.eclipse.swt.widgets.Composite parent)
Adds the header to a parent composite.protected org.eclipse.swt.widgets.Composite
createMasterDetailForm(org.eclipse.swt.widgets.Composite parent)
Create the parent of the master detail form.protected org.eclipse.swt.widgets.Composite
createMasterPanel(org.eclipse.swt.custom.SashForm sash)
Creates the composite for the master panel.protected org.eclipse.jface.viewers.TreeViewer
createMasterTree(org.eclipse.swt.widgets.Composite masterPanel)
Creates the tree viewer for the master.protected org.eclipse.swt.custom.ScrolledComposite
createRightPanelContent(org.eclipse.swt.widgets.Composite parent)
Creates the composite holding the details.protected org.eclipse.swt.custom.SashForm
createSash(org.eclipse.swt.widgets.Composite parent)
Creates the sashform for the master detail colums.protected void
dispose()
Disposes all resources used by the renderer.protected java.lang.String
getDefaultFontName(org.eclipse.swt.widgets.Control control)
protected org.eclipse.swt.widgets.Composite
getDetailContainer()
Returns the composite for the detail.ViewModelContext
getDetailContext()
Obtain the current detail context, if any.SWTGridDescription
getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.protected org.eclipse.jface.viewers.ILabelProvider
getLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider adapterFactoryLabelProvider)
Returns the label provider.org.eclipse.jface.viewers.TreePath
getTreePathFor(java.lang.Object object)
Get a path to an in my tree.protected boolean
hasContextMenu()
Return true if a context menu should be shown in the tree.protected boolean
hasDnDSupport()
Return true if the tree should support DnD.boolean
hasPath(org.eclipse.jface.viewers.TreePath path)
Query whether the givenpath
exists in my tree.protected java.lang.Object
manipulateSelection(java.lang.Object treeSelected)
Allows to manipulate the selection by returning a specific child.protected void
manipulateViewContext(ViewModelContext viewContext)
Allows to manipulate the view context for the selected element that is about to be rendered.protected java.util.List<MasterDetailAction>
readMasterDetailActions()
Returns a list of allMasterDetailActions
which shall be displayed in the context menu of the master treeviewer.protected void
relayoutDetail()
Relayouts the detail composite.protected org.eclipse.swt.widgets.Control
renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent)
Renders the passedVElement
.boolean
reveal(java.lang.Object object)
Reveal the givenobject
in my tree.boolean
reveal(org.eclipse.jface.viewers.TreePath path)
Reveal the givenpath
in my tree.-
Methods inherited from class org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer
applyReadOnly, applyValidation, applyVisible, canReveal, finalizeRendering, getControls, 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
-
-
-
-
Field Detail
-
DETAIL_KEY
public static final java.lang.String DETAIL_KEY
The detail key passed to the view model context.- See Also:
- Constant Field Values
-
GLOBAL_ADDITIONS
public static final java.lang.String GLOBAL_ADDITIONS
Menu separator ID for the group to which additional menu contributions are added in the tree's context menu.- See Also:
- Constant Field Values
-
ROOT_KEY
public static final java.lang.String ROOT_KEY
Context key for the root.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TreeMasterDetailSWTRenderer
@Inject public TreeMasterDetailSWTRenderer(VTreeMasterDetail vElement, ViewModelContext viewContext, ReportService reportService)
Default Constructor.- Parameters:
vElement
- the view element to be renderedviewContext
- The view model contextreportService
- the ReportService to use- Since:
- 1.6
-
-
Method Detail
-
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 classAbstractSWTRenderer<VTreeMasterDetail>
-
getGridDescription
public SWTGridDescription getGridDescription(SWTGridDescription gridDescription)
Returns the GridDescription for this Renderer.- Specified by:
getGridDescription
in classAbstractSWTRenderer<VTreeMasterDetail>
- Parameters:
gridDescription
- the currentSWTGridDescription
- Returns:
- the number of controls per row
- See Also:
AbstractSWTRenderer.getGridDescription(SWTGridDescription)
-
renderControl
protected org.eclipse.swt.widgets.Control renderControl(SWTGridCell cell, org.eclipse.swt.widgets.Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption
Renders the passedVElement
.- Specified by:
renderControl
in classAbstractSWTRenderer<VTreeMasterDetail>
- 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- See Also:
AbstractSWTRenderer.renderControl(org.eclipse.emfforms.spi.swt.core.layout.SWTGridCell, org.eclipse.swt.widgets.Composite)
-
createSash
protected org.eclipse.swt.custom.SashForm createSash(org.eclipse.swt.widgets.Composite parent)
Creates the sashform for the master detail colums.- Parameters:
parent
- the parent- Returns:
- the sash
-
createMasterDetailForm
protected org.eclipse.swt.widgets.Composite createMasterDetailForm(org.eclipse.swt.widgets.Composite parent)
Create the parent of the master detail form.- Parameters:
parent
- the parent- Returns:
- the composite
-
createMasterTree
protected org.eclipse.jface.viewers.TreeViewer createMasterTree(org.eclipse.swt.widgets.Composite masterPanel)
Creates the tree viewer for the master.- Parameters:
masterPanel
- the parent- Returns:
- the tree viewer
-
hasContextMenu
protected boolean hasContextMenu()
Return true if a context menu should be shown in the tree.- Returns:
- true if a context menu should be shown, false otherwise
-
hasDnDSupport
protected boolean hasDnDSupport()
Return true if the tree should support DnD.- Returns:
- true if DnD should be supported , false otherwise
-
getLabelProvider
protected org.eclipse.jface.viewers.ILabelProvider getLabelProvider(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider adapterFactoryLabelProvider)
Returns the label provider.- Parameters:
adapterFactoryLabelProvider
- the adaper factory label provider- Returns:
- the label provider to use for the tree
-
createMasterPanel
protected org.eclipse.swt.widgets.Composite createMasterPanel(org.eclipse.swt.custom.SashForm sash)
Creates the composite for the master panel.- Parameters:
sash
- the parent- Returns:
- the composite
-
createHeader
protected void createHeader(org.eclipse.swt.widgets.Composite parent)
Adds the header to a parent composite.- Parameters:
parent
- the parent
-
createRightPanelContent
protected org.eclipse.swt.custom.ScrolledComposite createRightPanelContent(org.eclipse.swt.widgets.Composite parent)
Creates the composite holding the details.- Parameters:
parent
- the parent- Returns:
- the right panel/detail composite
-
getDefaultFontName
protected java.lang.String getDefaultFontName(org.eclipse.swt.widgets.Control control)
- Overrides:
getDefaultFontName
in classAbstractSWTRenderer<VTreeMasterDetail>
- Parameters:
control
- The control to derive the default font name from- Returns:
- String the default font name on the system.
-
readMasterDetailActions
protected java.util.List<MasterDetailAction> readMasterDetailActions()
Returns a list of allMasterDetailActions
which shall be displayed in the context menu of the master treeviewer.- Returns:
- the actions
-
manipulateViewContext
protected void manipulateViewContext(ViewModelContext viewContext)
Allows to manipulate the view context for the selected element that is about to be rendered.- Parameters:
viewContext
- the view context.
-
getDetailContainer
protected org.eclipse.swt.widgets.Composite getDetailContainer()
Returns the composite for the detail.- Returns:
- the composite
-
manipulateSelection
protected java.lang.Object manipulateSelection(java.lang.Object treeSelected)
Allows to manipulate the selection by returning a specific child.- Parameters:
treeSelected
- the selected element in the tree- Returns:
- the object that should be used as a selection
-
cleanCustomOnSelectionChange
protected void cleanCustomOnSelectionChange()
Gets called after a detail composite was disposed. Allows for further cleanup.
-
relayoutDetail
protected void relayoutDetail()
Relayouts the detail composite.
-
reveal
public boolean reveal(java.lang.Object object)
Reveal the givenobject
in my tree.- Parameters:
object
- an object to reveal- Returns:
- whether I succeeded in revealing it
- Since:
- 1.22
-
getTreePathFor
public org.eclipse.jface.viewers.TreePath getTreePathFor(java.lang.Object object)
Get a path to an in my tree.- Parameters:
object
- an object in my tree- Returns:
- a path to it
- Since:
- 1.22
-
reveal
public boolean reveal(org.eclipse.jface.viewers.TreePath path)
Reveal the givenpath
in my tree.- Parameters:
path
- a tree path to reveal- Returns:
- whether I succeeded in revealing it
- Since:
- 1.22
-
hasPath
public boolean hasPath(org.eclipse.jface.viewers.TreePath path)
Query whether the givenpath
exists in my tree.- Parameters:
path
- a tree path- Returns:
- whether the path locates an element that exists in my tree
- Since:
- 1.22
-
getDetailContext
public ViewModelContext getDetailContext()
Obtain the current detail context, if any.- Returns:
- the view-model context of the details currently being presented,
or
null
if none (usually because there is no selection in the tree) - Since:
- 1.22
-
applyEnable
protected void applyEnable()
Description copied from class:AbstractSWTRenderer
Allows implementers to set a control to enabled.- Overrides:
applyEnable
in classAbstractSWTRenderer<VTreeMasterDetail>
-
applyValidation
protected void applyValidation(VDiagnostic oldDia, VDiagnostic newDia)
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<VTreeMasterDetail>
- Parameters:
oldDia
- The previousVDiagnostic
newDia
- The currentVDiagnostic
- Since:
- 1.14
- See Also:
AbstractSWTRenderer.applyValidation()
-
-