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

public class UriFragmentUtility
extends AbstractComponent

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:

Serialized Form

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 com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addListener, addStyleName, attach, childRequestedRepaint, detach, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, setWidth, setWidthUnits
 
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

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.

Overrides:
paintContent in class AbstractComponent

Parameters:
target - the target UIDL stream where the component should paint itself to
Throws:
PaintException - if the paint operation failed.

changeVariables

public void changeVariables(Object source,
                            Map<String,Object> variables)

Description copied from interface: VariableOwner

Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Overrides:
changeVariables in class AbstractComponent

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.

getFragment

public String getFragment()

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.

Returns:
the current fragment in browser uri or null if not known

setFragment

public void setFragment(String newFragment,
                        boolean fireEvent)

Sets URI fragment. Optionally fires a UriFragmentUtility.FragmentChangedEvent

Parameters:
newFragment - id of the new fragment
fireEvent - true to fire event
See Also:
UriFragmentUtility.FragmentChangedEvent, UriFragmentUtility.FragmentChangedListener

setFragment

public void setFragment(String newFragment)

Sets URI fragment. This method fires a UriFragmentUtility.FragmentChangedEvent

Parameters:
newFragment - id of the new fragment
See Also:
UriFragmentUtility.FragmentChangedEvent, UriFragmentUtility.FragmentChangedListener