Class TreeMasterDetailSWTBuilder
- java.lang.Object
-
- org.eclipse.emfforms.spi.swt.treemasterdetail.TreeMasterDetailSWTBuilder
-
public final class TreeMasterDetailSWTBuilder extends java.lang.ObjectThe TreeMasterDetailSWTBuilder is initialized with a default behaviour. It offers methods to customize certain aspects of the tree master detail.- Author:
- Johannes Faltermeier
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TreeMasterDetailCompositecreate()Call this method after all desired customizations have been passed to the builder.TreeMasterDetailSWTBuildercustomizeCildCreation(CreateElementCallback createElementCallback)Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked.TreeMasterDetailSWTBuildercustomizeContentProvider(ContentProviderProvider contentProvider)Use this method to set a customIContentProvideron the tree viewer.TreeMasterDetailSWTBuildercustomizeContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)Use this method to set a customIContentProvideron the tree viewer.TreeMasterDetailSWTBuildercustomizeDelete(DeleteActionBuilder deleteActionBuilder)Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked.TreeMasterDetailSWTBuildercustomizeDetailComposite(DetailCompositeBuilder detailComposite)Use this method to create the parent composite, which will contain the detail composite.TreeMasterDetailSWTBuildercustomizeDragAndDrop(DNDProvider dnd)Use this method to add a customized drag and drop behaviour to the tree or to remove drag and drop functionality.TreeMasterDetailSWTBuildercustomizeInitialSelection(InitialSelectionProvider selection)Use this method to customize which element should be selected after the initial rendering.TreeMasterDetailSWTBuildercustomizeInitialTreeWidth(int width)Use this method to influence the width of the composite which hosts theTreeViewer.TreeMasterDetailSWTBuildercustomizeLabelDecorator(LabelDecoratorProvider provider)Use this method to add aILabelDecoratorfor decorating the labels of the label provider.TreeMasterDetailSWTBuildercustomizeLabelDecorator(org.eclipse.jface.viewers.ILabelDecorator decorator)Use this method to add aILabelDecoratorfor decorating the labels of the label provider.TreeMasterDetailSWTBuildercustomizeLabelProvider(LabelProviderProvider provider)Use this method a add a customIBaseLabelProviderto the tree.TreeMasterDetailSWTBuildercustomizeLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider provider)Use this method a add a customIBaseLabelProviderto the tree.TreeMasterDetailSWTBuildercustomizeMenu(MenuProvider menu)Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked.TreeMasterDetailSWTBuildercustomizeMenuItems(java.util.Collection<MasterDetailAction> rightClickActions)Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked.TreeMasterDetailSWTBuildercustomizeReadOnly(boolean readOnly)Use this method to specify whether the tree and its details should be rendered as read-only.TreeMasterDetailSWTBuildercustomizeTree(TreeViewerBuilder tree)Use this method to create theTreeViewerwhich is part of the tree master detail.TreeMasterDetailSWTBuildercustomizeUpdateDelay(int updateDelay)Use this method to specify the time between a detected selection change and updating the detail panel.TreeMasterDetailSWTBuildercustomizeViewerFilters(org.eclipse.jface.viewers.ViewerFilter[] filters)Use this method to addViewerFilterson the tree.TreeMasterDetailSWTBuildercustomizeViewModelServices(ViewModelServiceProvider viewServiceProvider)Use this method to specify whichViewModelServiceswill be added when the detail views are rendered.
-
-
-
Method Detail
-
customizeContentProvider
public TreeMasterDetailSWTBuilder customizeContentProvider(ContentProviderProvider contentProvider)
Use this method to set a customIContentProvideron the tree viewer. The default implementation will use anAdapterFactoryContentProvider.- Parameters:
contentProvider- the desired behavior- Returns:
- self
-
customizeContentProvider
public TreeMasterDetailSWTBuilder customizeContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)
Use this method to set a customIContentProvideron the tree viewer. If the content provider requires more dispose code than callingIContentProvider.dispose()usecustomizeContentProvider(ContentProviderProvider)instead. The default implementation will use anAdapterFactoryContentProvider.- Parameters:
contentProvider- the content provider to add- Returns:
- self
-
customizeDetailComposite
public TreeMasterDetailSWTBuilder customizeDetailComposite(DetailCompositeBuilder detailComposite)
Use this method to create the parent composite, which will contain the detail composite. The default implementation will create aScrolledCompositewhich allows vertical and horizontal scrolling.- Parameters:
detailComposite- the desired behavior- Returns:
- self
-
customizeDragAndDrop
public TreeMasterDetailSWTBuilder customizeDragAndDrop(DNDProvider dnd)
Use this method to add a customized drag and drop behaviour to the tree or to remove drag and drop functionality. The default implementation supportsDND#DROP_COPY,DND#DROP_MOVEandDND#DROP_LINKbased on EMF Edit.- Parameters:
dnd- the desired behavior- Returns:
- self
-
customizeLabelProvider
public TreeMasterDetailSWTBuilder customizeLabelProvider(LabelProviderProvider provider)
Use this method a add a customIBaseLabelProviderto the tree. The default implementation uses anAdapterFactoryLabelProvider.- Parameters:
provider- the desired behavior- Returns:
- self
-
customizeLabelProvider
public TreeMasterDetailSWTBuilder customizeLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider provider)
Use this method a add a customIBaseLabelProviderto the tree. If the label provider requires more dispose code than a call toIBaseLabelProvider.dispose()usecustomizeLabelProvider(LabelProviderProvider)instead. The default implementation uses anAdapterFactoryLabelProvider.- Parameters:
provider- the label provider to add- Returns:
- self
-
customizeLabelDecorator
public TreeMasterDetailSWTBuilder customizeLabelDecorator(LabelDecoratorProvider provider)
Use this method to add aILabelDecoratorfor decorating the labels of the label provider. The default implementation does not use a decorator.- Parameters:
provider- theLabelDecoratorProviderwhich will be used to create the decorator- Returns:
- self
- Since:
- 1.9
-
customizeLabelDecorator
public TreeMasterDetailSWTBuilder customizeLabelDecorator(org.eclipse.jface.viewers.ILabelDecorator decorator)
Use this method to add aILabelDecoratorfor decorating the labels of the label provider. The default implementation does not use a decorator.- Parameters:
decorator- the decorator instance to be used- Returns:
- self
- Since:
- 1.9
-
customizeMenu
public TreeMasterDetailSWTBuilder customizeMenu(MenuProvider menu)
Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked. The default implementation will offer menu entries to create new elements based on EMF Edit and to delete elements.- Parameters:
menu- the desired behavior- Returns:
- self
-
customizeMenuItems
public TreeMasterDetailSWTBuilder customizeMenuItems(java.util.Collection<MasterDetailAction> rightClickActions)
Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked. Use this method to add additional menu entries.- Parameters:
rightClickActions- the additional right click actions which will be shown in the context menu- Returns:
- self
- Since:
- 1.8
-
customizeCildCreation
public TreeMasterDetailSWTBuilder customizeCildCreation(CreateElementCallback createElementCallback)
Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked. Use this method to influence the way new children are created.- Parameters:
createElementCallback- a callback which gets notified when a new child is created. this allows to veto the creation or to change the object to be added- Returns:
- self
- Since:
- 1.8
-
customizeDelete
public TreeMasterDetailSWTBuilder customizeDelete(DeleteActionBuilder deleteActionBuilder)
Use this method to customize theMenuwhich is shown when an element in the tree is right-clicked. Use this method to change the way elements are deleted.- Parameters:
deleteActionBuilder- the delete action which will be added to the context menu- Returns:
- self
- Since:
- 1.8
-
customizeInitialSelection
public TreeMasterDetailSWTBuilder customizeInitialSelection(InitialSelectionProvider selection)
Use this method to customize which element should be selected after the initial rendering. The default bahviour is to select the root node, if it is displayed in the tree.- Parameters:
selection- the desired behavior- Returns:
- self
-
customizeTree
public TreeMasterDetailSWTBuilder customizeTree(TreeViewerBuilder tree)
Use this method to create theTreeViewerwhich is part of the tree master detail. The default implementation creates a regularTreeViewerwith anexpand levelof 3.- Parameters:
tree- the desired behavior- Returns:
- self
-
customizeInitialTreeWidth
public TreeMasterDetailSWTBuilder customizeInitialTreeWidth(int width)
Use this method to influence the width of the composite which hosts theTreeViewer. The default is 300px.- Parameters:
width- the desired width- Returns:
- self
-
customizeViewerFilters
public TreeMasterDetailSWTBuilder customizeViewerFilters(org.eclipse.jface.viewers.ViewerFilter[] filters)
Use this method to addViewerFilterson the tree. The default implementation does not add filters.- Parameters:
filters- the filters to add- Returns:
- self
-
customizeViewModelServices
public TreeMasterDetailSWTBuilder customizeViewModelServices(ViewModelServiceProvider viewServiceProvider)
Use this method to specify whichViewModelServiceswill be added when the detail views are rendered. The default implementation does not add any services.- Parameters:
viewServiceProvider- the desired behavior- Returns:
- self
-
customizeUpdateDelay
public TreeMasterDetailSWTBuilder customizeUpdateDelay(int updateDelay)
Use this method to specify the time between a detected selection change and updating the detail panel. The default is 100ms.- Parameters:
updateDelay- the new update delay in ms- Returns:
- self
- Since:
- 1.11
-
customizeReadOnly
public TreeMasterDetailSWTBuilder customizeReadOnly(boolean readOnly)
Use this method to specify whether the tree and its details should be rendered as read-only. The default is false. Setting the tree master detail as read-only has the following implications:- Set all detail views as read-only
- Disable the tree's context menu
- Deactivate drag and drop in the tree
- Parameters:
readOnly-trueto make the tree master detail read-only.- Returns:
- self
- Since:
- 1.22
-
create
public TreeMasterDetailComposite create()
Call this method after all desired customizations have been passed to the builder. The will create a newTreeMasterDetailCompositewith the desired customizations.- Returns:
- the
TreeMasterDetailComposite
-
-