public class AppControllerImpl extends Object implements AppController, LocationChangedEvent.Handler, LocationChangeRequestedEvent.Handler, CloseAppEvent.Handler
AppController
.
The App controller that manages the lifecycle of running apps and raises callbacks to the app.
It provides methods to start, stop and focus already running App
s.
Registers handlers to the following location change events triggered by the LocationController
:
LocationController
,
AppContext
,
App
Constructor and Description |
---|
AppControllerImpl(info.magnolia.objectfactory.ComponentProvider componentProvider,
AppDescriptorRegistry appDescriptorRegistry,
LocationController locationController,
info.magnolia.event.EventBus admincentralEventBus,
MessagesManager messagesManager,
info.magnolia.i18nsystem.SimpleTranslator i18n)
Deprecated.
|
AppControllerImpl(info.magnolia.objectfactory.ComponentProvider componentProvider,
AppDescriptorRegistry appDescriptorRegistry,
LocationController locationController,
info.magnolia.event.EventBus admincentralEventBus,
MessagesManager messagesManager,
info.magnolia.i18nsystem.SimpleTranslator i18n,
info.magnolia.context.Context context)
|
Modifier and Type | Method and Description |
---|---|
void |
focusCurrentApp() |
Location |
getAppLocation(String appName)
Returns the current location of a running app instance or null, if it is not running.
|
App |
getCurrentApp() |
Optional<AppContext> |
getCurrentAppContext()
Return instance controller of the app currently visible to the user.
|
Location |
getCurrentAppLocation()
Returns the current location of the focused app.
|
Map<String,AppContext> |
getRunningApps()
Return the list of all running apps.
|
boolean |
isAppStarted(String appName) |
void |
onCloseApp(CloseAppEvent event) |
void |
onLocationChanged(LocationChangedEvent event)
Takes care of
LocationChangedEvent s by:
Obtaining the AppDescriptor associated with the Location .
Creating a new AppContext if not running, otherwise obtain it from the running apps.
Updating the and redirecting in case of missing subAppId.
Starting the App.
Adding the AppContext to the appHistory.
Setting the viewport and updating the current running app.
|
void |
onLocationChangeRequested(LocationChangeRequestedEvent event) |
void |
openChooseDialog(String appName,
UiContext uiContext,
String selectedId,
ChooseDialogCallback callback) |
void |
openChooseDialog(String appName,
UiContext uiContext,
String targetTreeRootPath,
String selectedId,
ChooseDialogCallback callback) |
void |
setViewport(Viewport viewport) |
App |
startIfNotAlreadyRunningThenFocus(String appName,
Location location)
This method can be called to launch an
App and then delegate it to the LocationController . |
void |
stopApp(String appName) |
void |
stopCurrentApp() |
@Deprecated public AppControllerImpl(info.magnolia.objectfactory.ComponentProvider componentProvider, AppDescriptorRegistry appDescriptorRegistry, LocationController locationController, @Named(value="admincentral") info.magnolia.event.EventBus admincentralEventBus, MessagesManager messagesManager, info.magnolia.i18nsystem.SimpleTranslator i18n, info.magnolia.context.Context context)
@Deprecated public AppControllerImpl(info.magnolia.objectfactory.ComponentProvider componentProvider, AppDescriptorRegistry appDescriptorRegistry, LocationController locationController, @Named(value="admincentral") info.magnolia.event.EventBus admincentralEventBus, MessagesManager messagesManager, info.magnolia.i18nsystem.SimpleTranslator i18n)
AppControllerImpl(ComponentProvider, AppDescriptorRegistry, LocationController, EventBus, MessagesManager, SimpleTranslator, Context)
instead.public void setViewport(Viewport viewport)
setViewport
in interface AppController
public void onCloseApp(CloseAppEvent event)
onCloseApp
in interface CloseAppEvent.Handler
public App startIfNotAlreadyRunningThenFocus(String appName, Location location)
App
and then delegate it to the LocationController
.
It should have the same effect as calling the LocationController
directly.appName
- of the App
to start.location
- holds information about the subApp to use and the parameters.public void stopApp(String appName)
stopApp
in interface AppController
public void stopCurrentApp()
stopCurrentApp
in interface AppController
public boolean isAppStarted(String appName)
isAppStarted
in interface AppController
public void focusCurrentApp()
focusCurrentApp
in interface AppController
public App getCurrentApp()
getCurrentApp
in interface AppController
public Location getCurrentAppLocation()
getCurrentAppLocation
in interface AppController
LocationController.getWhere()
public Location getAppLocation(String appName)
getAppLocation
in interface AppController
public void onLocationChanged(LocationChangedEvent event)
LocationChangedEvent
s by:
AppDescriptor
associated with the Location
.AppContext
if not running, otherwise obtain it from the running apps.AppContext
to the appHistory.onLocationChanged
in interface LocationChangedEvent.Handler
public void onLocationChangeRequested(LocationChangeRequestedEvent event)
onLocationChangeRequested
in interface LocationChangeRequestedEvent.Handler
public void openChooseDialog(String appName, UiContext uiContext, String selectedId, ChooseDialogCallback callback)
openChooseDialog
in interface AppController
public void openChooseDialog(String appName, UiContext uiContext, String targetTreeRootPath, String selectedId, ChooseDialogCallback callback)
openChooseDialog
in interface AppController
public Optional<AppContext> getCurrentAppContext()
AppController
getCurrentAppContext
in interface AppController
public Map<String,AppContext> getRunningApps()
AppController
getRunningApps
in interface AppController
Copyright © 2021 Magnolia International Ltd.. All rights reserved.