Package org.uberfire.client.mvp
Class BookmarkableUrlHelper
- java.lang.Object
-
- org.uberfire.client.mvp.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
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLOSED_DOCK_PREFIXstatic StringCLOSED_PREFIXstatic StringDOCK_BEGIN_SEPstatic StringDOCK_CLOSE_SEPstatic intMAX_NAV_URL_SIZEstatic StringOTHER_SCREEN_SEPstatic StringPERSPECTIVE_SEPstatic StringSEPARATOR
-
Constructor Summary
Constructors Constructor Description BookmarkableUrlHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<String>getClosedScreenFromPlace(org.uberfire.mvp.PlaceRequest place)Get the opened screens in the given place requeststatic Set<String>getDockedScreensFromPlace(org.uberfire.mvp.PlaceRequest place)Return all the docked screensstatic Set<String>getDockedScreensFromUrl(String url)Return the docked screens in the URLstatic Set<String>getOpenedScreenFromPlace(org.uberfire.mvp.PlaceRequest place)Get the opened screens in the given place requeststatic org.uberfire.mvp.PlaceRequestgetPerspectiveFromPlace(org.uberfire.mvp.PlaceRequest place)Given a bookmarkable URL this methods returns a PlaceRequest with the perspectivestatic Set<String>getScreensFromPlace(org.uberfire.mvp.PlaceRequest place)Return all the screens (opened or closed) that is, everything after the perspective declarationstatic StringgetUrlToken(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 markersstatic booleanisPerspectiveInUrl(String url)Returns true if the perspective is present in the URLstatic booleanisPerspectiveScreen(String bookmarkableUrl, String screen)Check whether the screen belongs to the currently opened perspectivestatic booleanisScreenClosed(String bookmarkableUrl, String screen)Return true if the given screen is already closed.static StringregisterClose(String bookmarkableUrl, String screenName)Update the bookmarkable URL, marking a screen or editor closed.static StringregisterClosedDock(String currentBookmarkableURLStatus, UberfireDock targetDock)static StringregisterCloseEditor(String currentBookmarkableURLStatus, org.uberfire.mvp.PlaceRequest place)Remove the editor reference from the URLstatic StringregisterOpenedDock(String currentBookmarkableURLStatus, UberfireDock targetDock)static StringregisterOpenedPerspective(String currentBookmarkableURLStatus, org.uberfire.mvp.PlaceRequest place)static StringregisterOpenedScreen(String bookmarkableUrl, org.uberfire.mvp.PlaceRequest placeRequest)Add a screen to the bookmarkable URL.static booleanurlContainsExtraPerspectiveScreen(String bookmarkableUrl)Check if the URL contains screens not belonging to the current perspective
-
-
-
Field Detail
-
PERSPECTIVE_SEP
public static final String PERSPECTIVE_SEP
- See Also:
- Constant Field Values
-
DOCK_BEGIN_SEP
public static final String DOCK_BEGIN_SEP
- See Also:
- Constant Field Values
-
DOCK_CLOSE_SEP
public static final String DOCK_CLOSE_SEP
- See Also:
- Constant Field Values
-
SEPARATOR
public static final String SEPARATOR
- See Also:
- Constant Field Values
-
OTHER_SCREEN_SEP
public static final String OTHER_SCREEN_SEP
- See Also:
- Constant Field Values
-
CLOSED_PREFIX
public static final String CLOSED_PREFIX
- See Also:
- Constant Field Values
-
CLOSED_DOCK_PREFIX
public static final String CLOSED_DOCK_PREFIX
- See Also:
- Constant Field Values
-
MAX_NAV_URL_SIZE
public static final int MAX_NAV_URL_SIZE
- See Also:
- Constant Field Values
-
-
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)
-
-