java.lang.Object
io.github.mmm.ui.api.controller.UiPlace
- All Implemented Interfaces:
io.github.mmm.ui.api.attribute.AttributeReadId
A place
HINT:
For each of your
identifies
a UiController
in combination with its parameters
. It allows to represent a specific state of the client that can be bookmarked and reopened at a later
point in time.HINT:
For each of your
UiController
you need to define an ID
. To decouple your navigation from the
actual UiController
implementations, it is recommended to define them as constants in a places class per
component or module. UiController
s may have mandatory or optional parameters
. Therefore,
it is recommended to create factory methods
for your UiPlace
s in the places class defining the
constants that take the parameter values as properly typed arguments. This will make refactoring easier if parameters
need to be changed. For generic access to your parameters please also define PARAMETER_*
constants in
your places class.
public final class ExamplePlaces { private ExamplePlaces() {} public static final String ID_ADDRESS = "address"; public static final String PARAMETER_ID = "id"; public staticUiPlace
placeAddress(long id) { returnUiPlace
.of(ID_ADDRESS, PARAMETER_ID, id); } public static void navigateAddress(long id) {UiPlace
place = placeAddress(id);UiNavigationManager
.get()
.navigateTo
(place); }
- Since:
- 1.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final UiPlace
The default place to navigate to if the application is started without specifying a customUiPlace
.static final UiPlace
The initial place before the client is initialized by navigating to the first place.static final String
The regex pattern used to assertparameter keys
.static final String
The regex pattern used to assertparameter values
.static final char
The separator for anchor used to prevent thatparameters
are send to the server.static final char
The separator used betweenparameters
.static final char
The separator fordialog-id
and itsparameters
.static final char
The separator for key and value of aparameter
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This method gets a parameter of thisUiPlace
.final String
getId()
This method gets a parameter of thisUiPlace
.int
This method gets a parameter of thisUiPlace
.boolean
This method determines if aget(String)
is present (!= null).int
hashCode()
static UiPlace
static UiPlace
static UiPlace
static UiPlace
static UiPlace
This is the inverse operation oftoString()
.toString()
-
Field Details
-
SEPARATOR_STATE
public static final char SEPARATOR_STATEThe separator fordialog-id
and itsparameters
.- See Also:
-
SEPARATOR_PARAMETER
public static final char SEPARATOR_PARAMETERThe separator used betweenparameters
.- See Also:
-
SEPARATOR_VALUE
public static final char SEPARATOR_VALUEThe separator for key and value of aparameter
.- See Also:
-
SEPARATOR_ANCHOR
public static final char SEPARATOR_ANCHORThe separator for anchor used to prevent thatparameters
are send to the server.- See Also:
-
PATTERN_KEY
The regex pattern used to assertparameter keys
.- See Also:
-
PATTERN_VALUE
The regex pattern used to assertparameter values
.- See Also:
-
NONE
The initial place before the client is initialized by navigating to the first place. This is not a valid place to navigate to. -
HOME
The default place to navigate to if the application is started without specifying a customUiPlace
.
-
-
Constructor Details
-
UiPlace
The constructor.- Parameters:
id
- thecontoller ID
.
-
UiPlace
The constructor.- Parameters:
id
- thecontoller ID
.parameters
- theparameters
.
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceio.github.mmm.ui.api.attribute.AttributeReadId
- Returns:
- the
ID
of theUiController
.
-
getParameters
- Returns:
- the
Map
of parameters.
-
has
This method determines if aget(String)
is present (!= null).- Parameters:
key
- is the name of the parameter to test.- Returns:
true
if that parameter is present (NOTnull
),false
otherwise.
-
get
This method gets a parameter of thisUiPlace
.- Parameters:
key
- is the name of the requested parameter.- Returns:
- the value of the requested parameter. Will be
null
if not set.
-
getInt
This method gets a parameter of thisUiPlace
.- Parameters:
key
- is the name of the requested parameter.- Returns:
- the value of the requested parameter. Will be
null
if not set.
-
getInt
This method gets a parameter of thisUiPlace
.- Parameters:
key
- is the name of the requested parameter.defaultValue
- the default value to return if the parameter with the givenkey
is notdefined
.- Returns:
- the value of the requested parameter.
-
hashCode
public int hashCode() -
equals
-
toString
-
parse
This is the inverse operation oftoString()
. -
of
- Parameters:
id
- is thecontroller ID
.- Returns:
- the new
UiPlace
.
-
of
- Parameters:
id
- is thecontroller ID
.key
- theparameter key
.value
- theparameter value
.- Returns:
- the new
UiPlace
.
-
of
- Parameters:
id
- is thecontroller ID
.key1
- the firstparameter key
.value1
- the fistparameter value
.key2
- the secondparameter key
.value2
- the secondparameter value
.- Returns:
- the new
UiPlace
.
-
of
public static UiPlace of(String id, String key1, Object value1, String key2, Object value2, String key3, Object value3) - Parameters:
id
- is thecontroller ID
.key1
- the firstparameter key
.value1
- the fistparameter value
.key2
- the secondparameter key
.value2
- the secondparameter value
.key3
- the thirdparameter key
.value3
- the thirdparameter value
.- Returns:
- the new
UiPlace
.
-