public class Switch extends Object implements Hold, ValueChangeHandler<String>
Modifier and Type | Field and Description |
---|---|
protected String |
lastValue |
protected Spool |
spool |
static RegExp |
SWITCH_SPEC_PATTERN
The pattern of a switch specification.
|
static RegExp |
SWITCH_SPEC_SEPARATOR_PATTERN
The pattern of a switch specification separator.
|
Modifier | Constructor and Description |
---|---|
|
Switch(String _name,
HistoryX _history)
Constructs a Switch and initializes it.
|
protected |
Switch(String _name,
HistoryX _history,
boolean toInit)
Constructs a Switch.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addHandler(ValueChangeHandler<String> handler)
Registers a handler to receive change events fired by this switch.
|
String |
clear()
Removes this switch from the URL and returns its value.
|
String |
get()
Returns the value of this switch, or null if it has no value.
|
HistoryX |
history()
The history stack.
|
String |
name()
The unique name of this switch.
|
void |
onValueChange(ValueChangeEvent<String> e)
Handles changes to the overall fragment.
|
void |
release()
Releases this hold.
|
String |
set(String value)
Sets the value of this switch and returns the old value.
|
public static final RegExp SWITCH_SPEC_PATTERN
Like in the value of a query parameter, actual spaces ' ' in the switch value are encoded as plus signs '+' in the formal URL. Unlike in a query parameter, actual plus signs are encoded as escaped spaces (%20), not plus signs (%2B). This is the only difference between the two.
public static final RegExp SWITCH_SPEC_SEPARATOR_PATTERN
public Switch(String _name, HistoryX _history)
public final HandlerRegistration addHandler(ValueChangeHandler<String> handler)
public final String clear()
HistoryX.clearSwitchValue(String)
public final String get()
HistoryX.getSwitchValue(String)
public final String set(String value)
public final void onValueChange(ValueChangeEvent<String> e)
onValueChange
in interface ValueChangeHandler<String>