Package org.uberfire.client.mvp
Class PlaceManagerImpl
- java.lang.Object
-
- org.uberfire.client.mvp.PlaceManagerImpl
-
- All Implemented Interfaces:
PlaceManager
@SharedSingleton public class PlaceManagerImpl extends Object implements PlaceManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePlaceManagerImpl.AppFormerActivityLoader
-
Constructor Summary
Constructors Constructor Description PlaceManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanCloseAllPlaces()booleancanClosePlace(org.uberfire.mvp.PlaceRequest place)voidcloseAllPlaces()booleancloseAllPlacesOrNothing()voidclosePlace(String id)voidclosePlace(org.uberfire.mvp.PlaceRequest placeToClose)voidclosePlace(org.uberfire.mvp.PlaceRequest placeToClose, org.uberfire.mvp.Command doAfterClose)voidforceCloseAllPlaces()voidforceClosePlace(String id)voidforceClosePlace(org.uberfire.mvp.PlaceRequest placeToClose)Collection<org.uberfire.mvp.PlaceRequest>getActivePlaceRequests()Returns all the PlaceRequests that map to activies that are currently in the open state and accessible somewhere in the current perspective.Collection<org.uberfire.mvp.impl.PathPlaceRequest>getActivePlaceRequestsWithPath()Returns all the PathPlaceRequests that map to activies that are currently in the open state and accessible somewhere in the current perspective.Collection<SplashScreenActivity>getActiveSplashScreens()Collection<org.uberfire.mvp.impl.PathPlaceRequest>getActivitiesForResourceType(org.uberfire.workbench.type.ResourceTypeDefinition type)Finds the currently open PlaceRequests for Activities that handle the given ResourceTypeDefinition.ActivitygetActivity(org.uberfire.mvp.PlaceRequest place)Finds the currently open activity that handles the given PlaceRequest by ID.List<org.uberfire.mvp.Command>getOnCloseCallbacks(org.uberfire.mvp.PlaceRequest place)List<org.uberfire.mvp.Command>getOnOpenCallbacks(org.uberfire.mvp.PlaceRequest place)PlaceStatusgetStatus(String id)PlaceStatusgetStatus(org.uberfire.mvp.PlaceRequest place)List<org.uberfire.mvp.PlaceRequest>getUncloseablePlaces()voidgoTo(String identifier)voidgoTo(String id, org.jboss.errai.common.client.dom.HTMLElement addTo)voidgoTo(String identifier, org.uberfire.workbench.model.PanelDefinition panel)voidgoTo(org.uberfire.backend.vfs.Path path)voidgoTo(org.uberfire.backend.vfs.Path path, org.uberfire.mvp.PlaceRequest placeRequest)voidgoTo(org.uberfire.backend.vfs.Path path, org.uberfire.mvp.PlaceRequest placeRequest, org.uberfire.workbench.model.PanelDefinition panel)voidgoTo(org.uberfire.backend.vfs.Path path, org.uberfire.workbench.model.PanelDefinition panel)voidgoTo(org.uberfire.mvp.PlaceRequest place)voidgoTo(org.uberfire.mvp.PlaceRequest place, com.google.gwt.user.client.ui.HasWidgets addTo)Locates the Activity associated with the given place, and if that activity is not already part of the workbench, starts it and adds its view to the given widget container.voidgoTo(org.uberfire.mvp.PlaceRequest place, elemental2.dom.HTMLElement addTo)voidgoTo(org.uberfire.mvp.PlaceRequest place, org.jboss.errai.common.client.dom.HTMLElement addTo)voidgoTo(org.uberfire.mvp.PlaceRequest place, org.uberfire.workbench.model.PanelDefinition panel)voidgoTo(org.uberfire.workbench.model.PartDefinition part, org.uberfire.workbench.model.PanelDefinition panel)voidinitPlaceHistoryHandler()voidregisterOnCloseCallback(org.uberfire.mvp.PlaceRequest place, org.uberfire.mvp.Command callback)voidregisterOnOpenCallback(org.uberfire.mvp.PlaceRequest place, org.uberfire.mvp.Command callback)voidregisterPerspectiveCloseChain(String perspectiveIdentifier, org.uberfire.mvp.BiParameterizedCommand<org.uberfire.mvp.Command,org.uberfire.mvp.PlaceRequest> closeChain)Registers a callback interceptor that uses a chain approach to execute code before a PlaceRequest is closed, if the perspective passed as a parameter is currently opened.voidtryClosePlace(org.uberfire.mvp.PlaceRequest placeToClose, org.uberfire.mvp.Command onAfterClose)voidunregisterOnCloseCallbacks(org.uberfire.mvp.PlaceRequest place)voidunregisterOnOpenCallbacks(org.uberfire.mvp.PlaceRequest place)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.uberfire.client.mvp.PlaceManager
executeOnCloseCallbacks, executeOnOpenCallbacks
-
-
-
-
Method Detail
-
initPlaceHistoryHandler
@PostConstruct public void initPlaceHistoryHandler()
-
goTo
public void goTo(String identifier, org.uberfire.workbench.model.PanelDefinition panel)
- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(String identifier)
- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.mvp.PlaceRequest place)
- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.backend.vfs.Path path, org.uberfire.workbench.model.PanelDefinition panel)- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.backend.vfs.Path path)
- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.backend.vfs.Path path, org.uberfire.mvp.PlaceRequest placeRequest, org.uberfire.workbench.model.PanelDefinition panel)- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.backend.vfs.Path path, org.uberfire.mvp.PlaceRequest placeRequest)- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.mvp.PlaceRequest place, org.uberfire.workbench.model.PanelDefinition panel)- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.mvp.PlaceRequest place, com.google.gwt.user.client.ui.HasWidgets addTo)Description copied from interface:PlaceManagerLocates the Activity associated with the given place, and if that activity is not already part of the workbench, starts it and adds its view to the given widget container. If the activity is already part of the current workbench, it will be selected, and it will not be moved from its current location.The activity will be properly shut down in any of the following scenarios:
- by a call to one of the PlaceManager methods for closing a place:
PlaceManager.closePlace(PlaceRequest),PlaceManager.closePlace(String), orPlaceManager.closeAllPlaces() - by switching to another perspective, which has the side effect of closing all places
- by removing the activity's view from the DOM, either using the GWT Widget API, or by direct DOM manipulation.
- by opening another place on the same container.
- Specified by:
goToin interfacePlaceManageraddTo- The container to add the widget's view to. Its corresponding DOM element must have a CSS position setting of relative or absolute and an explicit size set. This can be accomplished through direct use of CSS, or through theLayouts.setToFillParent(com.google.gwt.user.client.ui.Widget)call.
- by a call to one of the PlaceManager methods for closing a place:
-
goTo
public void goTo(String id, org.jboss.errai.common.client.dom.HTMLElement addTo)
- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.mvp.PlaceRequest place, org.jboss.errai.common.client.dom.HTMLElement addTo)- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.mvp.PlaceRequest place, elemental2.dom.HTMLElement addTo)- Specified by:
goToin interfacePlaceManager
-
goTo
public void goTo(org.uberfire.workbench.model.PartDefinition part, org.uberfire.workbench.model.PanelDefinition panel)- Specified by:
goToin interfacePlaceManager
-
getActivity
public Activity getActivity(org.uberfire.mvp.PlaceRequest place)
Description copied from interface:PlaceManagerFinds the currently open activity that handles the given PlaceRequest by ID. No attempt is made to match by path, but seeActivityManagerImpl#resolveExistingParts(PlaceRequest)for a variant that does. (TODO: should this method care about paths? if not, should the other method be added to the interface?)- Specified by:
getActivityin interfacePlaceManager- Parameters:
place- the PlaceRequest whose activity to search for- Returns:
- the activity that currently exists in service of the given PlaceRequest's ID. Null if no current activity handles the given PlaceRequest.
-
getStatus
public PlaceStatus getStatus(String id)
- Specified by:
getStatusin interfacePlaceManager
-
getStatus
public PlaceStatus getStatus(org.uberfire.mvp.PlaceRequest place)
- Specified by:
getStatusin interfacePlaceManager
-
closePlace
@JsMethod public void closePlace(String id)
- Specified by:
closePlacein interfacePlaceManager
-
closePlace
@JsMethod public void closePlace(org.uberfire.mvp.PlaceRequest placeToClose)
- Specified by:
closePlacein interfacePlaceManager
-
closePlace
public void closePlace(org.uberfire.mvp.PlaceRequest placeToClose, org.uberfire.mvp.Command doAfterClose)- Specified by:
closePlacein interfacePlaceManager
-
tryClosePlace
public void tryClosePlace(org.uberfire.mvp.PlaceRequest placeToClose, org.uberfire.mvp.Command onAfterClose)- Specified by:
tryClosePlacein interfacePlaceManager
-
forceClosePlace
public void forceClosePlace(String id)
- Specified by:
forceClosePlacein interfacePlaceManager
-
forceClosePlace
public void forceClosePlace(org.uberfire.mvp.PlaceRequest placeToClose)
- Specified by:
forceClosePlacein interfacePlaceManager
-
closeAllPlaces
public void closeAllPlaces()
- Specified by:
closeAllPlacesin interfacePlaceManager
-
forceCloseAllPlaces
public void forceCloseAllPlaces()
- Specified by:
forceCloseAllPlacesin interfacePlaceManager
-
closeAllPlacesOrNothing
public boolean closeAllPlacesOrNothing()
- Specified by:
closeAllPlacesOrNothingin interfacePlaceManager
-
getUncloseablePlaces
public List<org.uberfire.mvp.PlaceRequest> getUncloseablePlaces()
- Specified by:
getUncloseablePlacesin interfacePlaceManager- Returns:
- All opened PlaceRequests that cannot be closed (@onMayClose method returns false).
-
registerOnOpenCallback
public void registerOnOpenCallback(org.uberfire.mvp.PlaceRequest place, org.uberfire.mvp.Command callback)- Specified by:
registerOnOpenCallbackin interfacePlaceManager
-
unregisterOnOpenCallbacks
public void unregisterOnOpenCallbacks(org.uberfire.mvp.PlaceRequest place)
- Specified by:
unregisterOnOpenCallbacksin interfacePlaceManager
-
registerOnCloseCallback
public void registerOnCloseCallback(org.uberfire.mvp.PlaceRequest place, org.uberfire.mvp.Command callback)- Specified by:
registerOnCloseCallbackin interfacePlaceManager
-
unregisterOnCloseCallbacks
public void unregisterOnCloseCallbacks(org.uberfire.mvp.PlaceRequest place)
- Specified by:
unregisterOnCloseCallbacksin interfacePlaceManager
-
registerPerspectiveCloseChain
public void registerPerspectiveCloseChain(String perspectiveIdentifier, org.uberfire.mvp.BiParameterizedCommand<org.uberfire.mvp.Command,org.uberfire.mvp.PlaceRequest> closeChain)
Description copied from interface:PlaceManagerRegisters a callback interceptor that uses a chain approach to execute code before a PlaceRequest is closed, if the perspective passed as a parameter is currently opened. It will not be executed in the case of a forced close.- Specified by:
registerPerspectiveCloseChainin interfacePlaceManager- Parameters:
perspectiveIdentifier- Perspective identifier for which the close chain must be called when it is being closed.closeChain- Callback to be called when a PlaceRequest is being closed. The callback command must invoke the chain to proceed with the closing operation.
-
getActiveSplashScreens
public Collection<SplashScreenActivity> getActiveSplashScreens()
- Specified by:
getActiveSplashScreensin interfacePlaceManager
-
getActivitiesForResourceType
public Collection<org.uberfire.mvp.impl.PathPlaceRequest> getActivitiesForResourceType(org.uberfire.workbench.type.ResourceTypeDefinition type)
Description copied from interface:PlaceManagerFinds the currently open PlaceRequests for Activities that handle the given ResourceTypeDefinition.- Specified by:
getActivitiesForResourceTypein interfacePlaceManager- Parameters:
type- the ResourceTypeDefinition whose activity to search for- Returns:
- an unmodifiable collection of PlaceRequests for the currently open WorkbenchEditorActivities that can handle the ResourceTypeDefinition. Returns an empty collection if no match was found.
-
getActivePlaceRequests
public Collection<org.uberfire.mvp.PlaceRequest> getActivePlaceRequests()
Returns all the PlaceRequests that map to activies that are currently in the open state and accessible somewhere in the current perspective.- Returns:
- an unmodifiable view of the current active place requests. This view may or may not update after further calls into PlaceManager that modify the workbench state. It's best not to hold on to the returned set; instead, call this method again for current information.
-
getActivePlaceRequestsWithPath
public Collection<org.uberfire.mvp.impl.PathPlaceRequest> getActivePlaceRequestsWithPath()
Returns all the PathPlaceRequests that map to activies that are currently in the open state and accessible somewhere in the current perspective.- Returns:
- an unmodifiable view of the current active place requests. This view may or may not update after further calls into PlaceManager that modify the workbench state. It's best not to hold on to the returned set; instead, call this method again for current information.
-
canClosePlace
public boolean canClosePlace(org.uberfire.mvp.PlaceRequest place)
- Specified by:
canClosePlacein interfacePlaceManager
-
canCloseAllPlaces
public boolean canCloseAllPlaces()
- Specified by:
canCloseAllPlacesin interfacePlaceManager
-
getOnOpenCallbacks
public List<org.uberfire.mvp.Command> getOnOpenCallbacks(org.uberfire.mvp.PlaceRequest place)
- Specified by:
getOnOpenCallbacksin interfacePlaceManager
-
getOnCloseCallbacks
public List<org.uberfire.mvp.Command> getOnCloseCallbacks(org.uberfire.mvp.PlaceRequest place)
- Specified by:
getOnCloseCallbacksin interfacePlaceManager
-
-