public class DetailViewManager extends Object implements DetailViewCache
| Modifier and Type | Field and Description |
|---|---|
static String |
DETAIL_PROPERTY
Name of a boolean-valued view model property
indicating that the view model is being rendered as a detail in a master-detail
presentation.
|
DETAIL_VIEW_CACHE_SIZE, EMPTY| Constructor and Description |
|---|
DetailViewManager(org.eclipse.swt.widgets.Composite parent)
Initializes me.
|
DetailViewManager(org.eclipse.swt.widgets.Composite parent,
Function<? super org.eclipse.emf.ecore.EObject,? extends VView> detailView)
Initializes me with explicit detail views.
|
| Modifier and Type | Method and Description |
|---|---|
ECPSWTView |
activate(org.eclipse.emf.ecore.EObject eObject)
Present the previously cached view for an object.
|
void |
cacheCurrentDetail()
Cache the currently presented detail view, if any, and remove it from the UI.
|
boolean |
cacheView(ECPSWTView ecpView)
Caches the provided
ECPSWTView to allow it to be reused later, if there is
room for it the cache. |
void |
clear()
Dispose all cached views, emptying the cache.
|
void |
dispose()
Dispose of me and my UI resources.
|
ECPSWTView |
getCachedView(org.eclipse.emf.ecore.EObject selection)
Returns the previously cached view for the provided selection.
|
ECPSWTView |
getCurrentDetail()
Obtain the currently presented detail view.
|
org.eclipse.swt.widgets.Control |
getDetailContainer()
Obtain the control that contains the rendered details.
|
VViewModelProperties |
getDetailProperties()
Obtain the view-model properties used for loading the detail view model.
|
VView |
getDetailView(org.eclipse.emf.ecore.EObject object)
Obtain the detail view for an
object selected in the master view. |
protected VView |
getDetailView(org.eclipse.emf.ecore.EObject object,
VViewModelProperties properties)
Get the view provided by the framework for details of the given
object. |
VView |
getDetailView(ViewModelContext masterContext,
org.eclipse.emf.ecore.EObject object)
Obtain the detail view in the context of the given master view-model context for a selected
object in the master view. |
VView |
getDetailView(ViewModelContext masterContext,
org.eclipse.emf.ecore.EObject object,
Consumer<? super VViewModelProperties> propertiesManipulator)
Obtain the detail view in the context of the given master view-model context for a selected
object in the master view. |
protected ECPSWTView |
getNoDetailsControl()
Obtain the renderer control showing a hint that there is no selection or
no details for the current selection.
|
protected VView |
getNoDetailView()
Obtain a view to use as placeholder when the framework provides no view for the
detail of the selection or when there is no selection.
|
boolean |
isCached(org.eclipse.emf.ecore.EObject selection)
Checks whether there is already a cached view available.
|
boolean |
isDisposed()
Queries whether I have been disposed.
|
org.eclipse.swt.widgets.Composite |
layoutDetailParent(org.eclipse.swt.widgets.Composite composite)
Apply a reasonable default layout for the parent
composite of a detail container
where the only thing contained in that parent is the detail container. |
ECPSWTView |
render(ViewModelContext context,
DetailRenderingFunction renderer)
Render the detail view for a given
context in the specified parent composite. |
ECPSWTView |
render(ViewModelContext masterContext,
VElement masterView,
org.eclipse.emf.ecore.EObject object)
Render the detail view for a given
object in the specified master context. |
void |
setCache(DetailViewCache cache)
Set the detail-view cache to use.
|
void |
setDetailReadOnly(boolean readOnly)
Set the current detail view read-only or not, unless it is intrinsically read-only,
in which case it will remain so (this method will have no effect).
|
void |
setFocus()
Set focus to the currently presented detail view.
|
void |
setNoDetailMessage(String noDetailMessage)
Set a message to display to the user when there is no detail to show, either
because there is no selection in the master or because it has no details.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateCachepublic static final String DETAIL_PROPERTY
public DetailViewManager(org.eclipse.swt.widgets.Composite parent)
parent - the composite in which to create the detail containerpublic DetailViewManager(org.eclipse.swt.widgets.Composite parent,
Function<? super org.eclipse.emf.ecore.EObject,? extends VView> detailView)
parent - the composite in which to create the detail containerdetailView - the detail-view provider functionpublic void dispose()
public boolean isDisposed()
public org.eclipse.swt.widgets.Control getDetailContainer()
public void setCache(DetailViewCache cache)
cache - the DetailViewCache to use, or null to use no cachepublic ECPSWTView activate(org.eclipse.emf.ecore.EObject eObject)
eObject - the object to presentIllegalStateException - if there is no view cached for the objectisCached(EObject)public ECPSWTView render(ViewModelContext context, DetailRenderingFunction renderer)
context in the specified parent composite.
If a cached rendering is available for the domain model,
then it is re-used and the context is disposed.
Otherwise, the supplied rendering function is used to render the detail view.context - the context to present in the detail viewrenderer - if needed to render a new detail view controlpublic ECPSWTView render(ViewModelContext masterContext, VElement masterView, org.eclipse.emf.ecore.EObject object)
object in the specified master context.masterContext - the master context in which the object is selectedmasterView - the master view in which context to render the detail viewobject - the selected object for which to present the detailpublic final ECPSWTView getCurrentDetail()
null if nonepublic void cacheCurrentDetail()
public void setFocus()
public VViewModelProperties getDetailProperties()
detail property.public VView getDetailView(ViewModelContext masterContext, org.eclipse.emf.ecore.EObject object)
object in the master view.masterContext - the master view-model contextobject - the selection in the master view for which to get a detail viewpublic VView getDetailView(ViewModelContext masterContext, org.eclipse.emf.ecore.EObject object, Consumer<? super VViewModelProperties> propertiesManipulator)
object in the master view.masterContext - the master view-model contextobject - the selection in the master view for which to get a detail viewpropertiesManipulator - an optional hook with which to inject properties to assist/filter the detail view
model resolutionpublic VView getDetailView(org.eclipse.emf.ecore.EObject object)
object selected in the master view. This method
is useful for master-detail presentations in which the master is not managed by a
Form in a ViewModelContext but explicitly by some custom UI control.object - the master view selectionobjectpublic void setDetailReadOnly(boolean readOnly)
readOnly - true to set the detail view read-only;
false to let its intrinsic read-only state prevailprotected VView getDetailView(org.eclipse.emf.ecore.EObject object, VViewModelProperties properties)
object.object - the object for which to get the detail viewproperties - the properties to use for loading the viewnull, even if the framework provides nothing)protected VView getNoDetailView()
protected ECPSWTView getNoDetailsControl()
public org.eclipse.swt.widgets.Composite layoutDetailParent(org.eclipse.swt.widgets.Composite composite)
composite of a detail container
where the only thing contained in that parent is the detail container.composite - the detail parent compositecomposite, for convenience of call chainingpublic void setNoDetailMessage(String noDetailMessage)
noDetailMessage - the "no details" message to set, or null
for the default localized string
("No selection or no details available for selection.")public boolean isCached(org.eclipse.emf.ecore.EObject selection)
DetailViewCacheisCached in interface DetailViewCacheselection - The new master object selectiontrue if there is a cached view for the provided selection; false otherwisepublic ECPSWTView getCachedView(org.eclipse.emf.ecore.EObject selection)
DetailViewCachegetCachedView in interface DetailViewCacheselection - The new master object selectionnull if none is cachedDetailViewCache.isCached(EObject)public boolean cacheView(ECPSWTView ecpView)
DetailViewCache
Caches the provided ECPSWTView to allow it to be reused later, if there is
room for it the cache.
Note that a view is cached when it is no longer required, usually because another detail view is taking its place in the editor. Consequently, if the cache is size-limited and cannot actually cache the view, it must dispose that view.
cacheView in interface DetailViewCacheecpView - the ECPSWTView to cachetrue if the view was added to the cache; false otherwise (in which
case it would be disposed)public void clear()
DetailViewCacheclear in interface DetailViewCacheCopyright © 2019. All rights reserved.