Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Action: Clean upp AppContext and SubAppContext from methods used internally only.

...

Packaging

The current packaging needs to be rethought.

Classes belonging to the App Framework are located in:

info.magnolia.ui.framework.app

  • interfaces for AppController, AppContext, SubAppContext
  • AbstractApp and AbstractSubApp implementations
  • launcherlayout: AppLauncher interfaces and classes
  • builder: Configuration by code for Apps and subApps
  • registry: AppDescriptor Definitions and registry

info.magnolia.ui.admincentral.app.simple

  • implementations of AppController, AppContext, SubAppContext

 

 

  • According to Concept - Alternative ui-project organisation
    • move the package info.magnolia.ui.admincentral.app.simple into module magnolia-ui-framework e.g. info.magnolia.ui.framework.app.api (NOTE: this contradicts decision made for shell apps, see further down)
    • or just out of the simple subpackage
    info.magnolia.ui.admincentral.app.simple.AppContextImpl
    • general problem: used heavily by the appController and also for the app itself to get contextual information: serving two needs. see http://jira.magnolia-cms.com/browse/MGNLUI-403
    • The idea of AppContext is to expose functionality to the App. That is, to an instance of an app.

      It should not expose methods that are only used by AppControllerImpl. These should be hidden from all other classes.

      If necessary AppControllerImpl#runningApps should be changed to <String, AppContextImpl>. Also if the intention of AppContextImpl is unclear it should be renamed to reflect the fact that is not just the default implementation of AppContext, it does much more and in fact fullfils much of the contract defined by AppController.

    • rename the AppController to AppLauncher or similar, introduce a new AppController class which takes care of the contract to the AppLauncher and keep the AppContext as thin as possible, only serving contextual information to the actual App
    • Move some of the functionality of AppContext into the info.magnolia.ui.framework.app.launcherlayout.AppLauncherGroupEntry
    • info.magnolia.ui.admincentral.app.simple.AppContextImpl#getDefaultSubAppDescriptor
    • info.magnolia.ui.admincentral.app.simple.AppContextImpl#getSubAppDescriptorById

AppController

References

UML Diagram

...

  • The AppController takes care of LocationChangedEvents coming from info.magnolia.ui.admincentral.app.simple.AppControllerImpl#onLocationChanged which can for example be fired by the info.magnolia.ui.framework.location.LocationController#goTo when clicking on icon in the AppLauncher. It takes the Location passed and extracts AppName and subAppId and gets the corresponding AppDescriptor from the info.magnolia.ui.framework.app.launcherlayout.AppLauncherLayoutManager.
  • It creates a new AppContext for the App
  • keeps history of running app and currently focused app
  • used by the MagnoliaShell to query the current Status of the appController
  • Used by FieldBuilders to get the AppContext and ComponentProviders for opening ChooseDialogs.

...

Current Issues

The AppController is in general in a good shape. Interface is well defined and usages are legit.

...

AppContext

References

UML

Abstract

The AppContext serves multiple different purposes:

  • An app uses the AppContext to interact with the App Framework. Some examples:
    • resolve the configured App Label for setting the correct title in the tab.
    • send notification Messages to the MessagesManager
  • The AppController uses it to delegate handling of location changes and to the app and subApp
  • Takes care of reading subApp configurations and mapping locations to to the correct subApp
  • creates both componentProviders for App and subApp

Issues

There is definitely room for improvement in this class. 

The general problem: used heavily by the appController and also for the app itself to get contextual information: serving multiple needs. see 

Jira
serverMagnolia
keyMGNLUI-403

  • The idea of AppContext is to expose functionality to the App. That is, to an instance of an app.

    It should not expose methods that are only used by AppControllerImpl. These should be hidden from all other classes.

    If necessary AppControllerImpl#runningApps should be changed to <String, AppContextImpl>. Also if the intention of AppContextImpl is unclear it should be renamed to reflect the fact that is not just the default implementation of AppContext, it does much more and in fact fullfils much of the contract defined by AppController.

  • rename the AppController to AppLauncher or similar, introduce a new AppController class which takes care of the contract to the AppLauncher and keep the AppContext as thin as possible, only serving contextual information to the actual App
  • Move some of the functionality of AppContext into the info.magnolia.ui.framework.app.launcherlayout.AppLauncherGroupEntry
    • info.magnolia.ui.admincentral.app.simple.AppContextImpl#getDefaultSubAppDescriptor
    • info.magnolia.ui.admincentral.app.simple.AppContextImpl#getSubAppDescriptorById

Shell Apps

Q: Do we plan any improvements here?

...