com.vaadin.ui.
Class UriFragmentUtility
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.UriFragmentUtility
All Implemented Interfaces:
MethodEventSource, Paintable, Sizeable, VariableOwner, Component, Serializable, EventListener
- extends AbstractComponent
public class UriFragmentUtility
Experimental web browser dependent component for URI fragment (part after hash mark "#") reading and writing. Component can be used to workaround common ajax web applications pitfalls: bookmarking a program state and back button.
See Also:
Nested Class Summary | |
---|---|
class |
UriFragmentUtility.FragmentChangedEvent
Event fired when uri fragment changes. |
static interface |
UriFragmentUtility.FragmentChangedListener
Listener that listens changes in URI fragment. |
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable |
---|
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Field Summary |
---|
Fields inherited from interface com.vaadin.terminal.Sizeable |
---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
UriFragmentUtility()
|
Method Summary | |
---|---|
void |
addListener(UriFragmentUtility.FragmentChangedListener listener)
|
void |
changeVariables(Object source,
Map<String,Object> variables)
Called when one or more variables handled by the implementing class are changed. |
String |
getFragment()
Gets currently set URI fragment. |
void |
paintContent(PaintTarget target)
Paints any needed component-specific things to the given UIDL stream. |
void |
removeListener(UriFragmentUtility.FragmentChangedListener listener)
|
void |
setFragment(String newFragment)
Sets URI fragment. |
void |
setFragment(String newFragment,
boolean fireEvent)
Sets URI fragment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
UriFragmentUtility
public UriFragmentUtility()
Method Detail |
---|
addListener
public void addListener(UriFragmentUtility.FragmentChangedListener listener)
removeListener
public void removeListener(UriFragmentUtility.FragmentChangedListener listener)
paintContent
public void paintContent(PaintTarget target)
throws PaintException
- Overrides:
paintContent
in classAbstractComponent
- Parameters:
target
- the target UIDL stream where the component should paint itself to- Throws:
PaintException
- if the paint operation failed.
Description copied from class: AbstractComponent
Paints any needed component-specific things to the given UIDL stream. The
more general AbstractComponent.paint(PaintTarget)
method handles all general
attributes common to all components, and it calls this method to paint
any component-specific attributes to the UIDL stream.
changeVariables
public void changeVariables(Object source,
Map<String,Object> variables)
- Specified by:
changeVariables
in interfaceVariableOwner
- Overrides:
changeVariables
in classAbstractComponent
- Parameters:
source
- the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.
getFragment
public String getFragment()
- Returns:
- the current fragment in browser uri or null if not known
Gets currently set URI fragment.
To listen changes in fragment, hook a UriFragmentUtility.FragmentChangedListener
.
Note that initial URI fragment that user used to enter the application will be read after application init. It fires FragmentChangedEvent only if it is not the same as on server side.
setFragment
public void setFragment(String newFragment,
boolean fireEvent)
- Parameters:
newFragment
- id of the new fragmentfireEvent
- true to fire event- See Also:
UriFragmentUtility.FragmentChangedEvent
,UriFragmentUtility.FragmentChangedListener
Sets URI fragment. Optionally fires a UriFragmentUtility.FragmentChangedEvent
setFragment
public void setFragment(String newFragment)
- Parameters:
newFragment
- id of the new fragment- See Also:
UriFragmentUtility.FragmentChangedEvent
,UriFragmentUtility.FragmentChangedListener
Sets URI fragment. This method fires a UriFragmentUtility.FragmentChangedEvent