Class BookmarkableUrlHelper


  • public class BookmarkableUrlHelper
    extends Object
    A bookmarkable URL has the following form:

    http://url/index.html#FWidgets|$PagedTableScreen[WSimpleDockScreen,],~WiresPropertiesScreen$PagedTableScreen

    between the '#' and '|' there is the perspective name between the '|' and '$' there is the CSV list of the screens opened when loading the perspective between the '[' and ']'there is the CSV list of the docked Screens after the '$' there is the CSV list of the screens not belonging to the current perspective

    '~' denotes a closed screen

    In this unit we have the basic methods used to compose such URLs

    • Constructor Detail

      • BookmarkableUrlHelper

        public BookmarkableUrlHelper()
    • Method Detail

      • registerOpenedScreen

        public static String registerOpenedScreen​(String bookmarkableUrl,
                                                  org.uberfire.mvp.PlaceRequest placeRequest)
        Add a screen to the bookmarkable URL. If the screen belongs to the currently opened perspective we add it to the list between the '|' and '$', otherwise we add it after the '$'.

        We add the '|' or the '$' when needed

        Parameters:
        bookmarkableUrl -
        placeRequest -
        Returns:
      • registerClose

        public static String registerClose​(String bookmarkableUrl,
                                           String screenName)
        Update the bookmarkable URL, marking a screen or editor closed. Basically if the screen belongs to the currently opened perspective the we prefix the screen with a '~'; if the screen doesn't belong to the current perspective, that is, after the '$', the it is simply removed.

        We remove the '$' when needed

        Parameters:
        screenName -
      • getPerspectiveFromPlace

        public static org.uberfire.mvp.PlaceRequest getPerspectiveFromPlace​(org.uberfire.mvp.PlaceRequest place)
        Given a bookmarkable URL this methods returns a PlaceRequest with the perspective
        Parameters:
        place - \
        Returns:
      • isPerspectiveScreen

        public static boolean isPerspectiveScreen​(String bookmarkableUrl,
                                                  String screen)
        Check whether the screen belongs to the currently opened perspective
        Parameters:
        screen -
        Returns:
      • isPerspectiveInUrl

        public static boolean isPerspectiveInUrl​(String url)
        Returns true if the perspective is present in the URL
        Returns:
      • urlContainsExtraPerspectiveScreen

        public static boolean urlContainsExtraPerspectiveScreen​(String bookmarkableUrl)
        Check if the URL contains screens not belonging to the current perspective
        Returns:
      • getUrlToken

        public static String getUrlToken​(String bookmarkableUrl,
                                         String screen)
        Given a screen name, this method extracts the corresponding token in the URL, that is the screen name with optional parameters and markers
        Parameters:
        screen -
        Returns:
      • getDockedScreensFromUrl

        public static Set<String> getDockedScreensFromUrl​(String url)
        Return the docked screens in the URL
        Parameters:
        url -
        Returns:
      • getDockedScreensFromPlace

        public static Set<String> getDockedScreensFromPlace​(org.uberfire.mvp.PlaceRequest place)
        Return all the docked screens
        Parameters:
        place -
        Returns:
      • getScreensFromPlace

        public static Set<String> getScreensFromPlace​(org.uberfire.mvp.PlaceRequest place)
        Return all the screens (opened or closed) that is, everything after the perspective declaration
        Parameters:
        place -
        Returns:
      • getClosedScreenFromPlace

        public static Set<String> getClosedScreenFromPlace​(org.uberfire.mvp.PlaceRequest place)
        Get the opened screens in the given place request
        Parameters:
        place -
        Returns:
      • getOpenedScreenFromPlace

        public static Set<String> getOpenedScreenFromPlace​(org.uberfire.mvp.PlaceRequest place)
        Get the opened screens in the given place request
        Parameters:
        place -
        Returns:
      • isScreenClosed

        public static boolean isScreenClosed​(String bookmarkableUrl,
                                             String screen)
        Return true if the given screen is already closed.
        Parameters:
        screen -
        Returns:
      • registerOpenedPerspective

        public static String registerOpenedPerspective​(String currentBookmarkableURLStatus,
                                                       org.uberfire.mvp.PlaceRequest place)
      • registerOpenedDock

        public static String registerOpenedDock​(String currentBookmarkableURLStatus,
                                                UberfireDock targetDock)
      • registerClosedDock

        public static String registerClosedDock​(String currentBookmarkableURLStatus,
                                                UberfireDock targetDock)
      • registerCloseEditor

        public static String registerCloseEditor​(String currentBookmarkableURLStatus,
                                                 org.uberfire.mvp.PlaceRequest place)
        Remove the editor reference from the URL
        Parameters:
        currentBookmarkableURLStatus -
        place -
        Returns: