Interface PerspectiveManager

  • All Known Implementing Classes:
    PerspectiveManagerImpl

    public interface PerspectiveManager
    The PerspectiveManager is responsible for the process of starting up a perspective, shutting down the current perspective, and switching between perspectives. This includes a sequence of asynchronous operations such as fetching any stored definition the current user has for the new perspective, and saving the definition when the user has modified it (for example, by dragging and dropping components, launching new activities, and so on).

    Structurally, the PerspectiveManager performs actions at the request of the PlaceManager, and it accomplishes these actions by delegating to the PanelManager and WorkbenchServicesProxy.

    • Method Detail

      • getCurrentPerspective

        PerspectiveActivity getCurrentPerspective()
        Returns the current perspective's PerspectiveActivity. When the app first starts, this will be null. Once the workbench has bootstrapped, the return value will not be null again.
      • getLivePerspectiveDefinition

        org.uberfire.workbench.model.PerspectiveDefinition getLivePerspectiveDefinition()
        Returns a description of the current perspective which reflects the current visible state of the user interface.
      • savePerspectiveState

        void savePerspectiveState​(org.uberfire.mvp.Command doWhenFinished)
        Saves the current live perspective definition to the server. Saved perspective definitions override the default definition produced by the PerspectiveActivity.getDefaultPerspectiveLayout() when switching to a new perspective. This method has no effect if the current perspective is transient.
        Parameters:
        doWhenFinished - action to execute after the save is complete (or immediately in the case of a transient perspective). Must not be null. To do nothing, use Commands.DO_NOTHING.
        See Also:
        WorkbenchPerspective.isTransient(), PerspectiveActivity.isTransient()
      • switchToPerspective

        void switchToPerspective​(org.uberfire.mvp.PlaceRequest placeRequest,
                                 PerspectiveActivity perspective,
                                 org.uberfire.mvp.ParameterizedCommand<org.uberfire.workbench.model.PerspectiveDefinition> doWhenFinished)
        This method should only be invoked by PlaceManager. To launch a perspective within an UberFire app, pass a PlaceRequest for that perspective to PlaceManager.goTo(org.uberfire.mvp.PlaceRequest).

        Closes all current panels in the PanelManager (they must have already had their parts removed), then builds up the new panel arrangement based on the PerspectiveDefinition associated with the given perspective activity. If the given perspective is transient, its default perspective definition will always be used. Otherwise, the PerspectiveManager will first attempt to retrieve the current user's saved PerspectiveDefinition from the server, falling back on the default if none is found.

        Parameters:
        placeRequest - the placeRequest that originated the perspective to switch to. Must not be null.
        perspective - the perspective to switch to. Must not be null.
        doWhenFinished - The command to execute once the new perspective's panels have been created. Must not be null.

        When the callback is invoked, the panels will be set up in their correct positions, but no parts will have been added.

      • loadPerspectiveStates

        void loadPerspectiveStates​(org.uberfire.mvp.ParameterizedCommand<Set<org.uberfire.workbench.model.PerspectiveDefinition>> doWhenFinished)
        Retrieves the definitions of all the persisted perspectives.
        Parameters:
        doWhenFinished - The command to execute once the perspective definitions are retrieved.
      • removePerspectiveState

        void removePerspectiveState​(String perspectiveId,
                                    org.uberfire.mvp.Command doWhenFinished)
        This method removes any persisted definition for the given perspective. Subsequent requests for a previously persisted perspective should load the Perspective definition from the applicable object.
        Parameters:
        doWhenFinished - The command to execute once the perspective state have been removed. Must not be null.
      • removePerspectiveStates

        void removePerspectiveStates​(org.uberfire.mvp.Command doWhenFinished)
        This method removes all persisted Perspective definitions. Subsequent requests for previously persisted perspectives should load the Perspective definition from the applicable object.
        Parameters:
        doWhenFinished - The command to execute once the perspective states have been removed. Must not be null.
      • getDefaultPerspectiveIdentifier

        String getDefaultPerspectiveIdentifier()
        Fetches the current default perspective identifier.
        Returns:
        The default perspective identifier of the workbench, if one exists.
      • getCurrentPerspectivePlaceRequest

        org.uberfire.mvp.PlaceRequest getCurrentPerspectivePlaceRequest()