net.sf.jzeno.echo.components
Class NavigationHistory

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.components.NavigationHistory
All Implemented Interfaces:
java.io.Serializable, BindingTarget, PropertyComponent, RebindableComponent, EventSink, EventSource, Precreation, Component, FastComponent, FastComponentContainer

public class NavigationHistory
extends CustomComponent
implements FastComponent, Precreation

Navigation history component. This component shows the last 4 screens the user accessed. By clicking on one of the names, he can go back to that screen. Also an application developer can use EchoSupport.back() to navigate to the previous screen.

Application developers can also save some application state of their screens by overriding Screen.saveHistoryState(). When a screen is recalled, Screen.loadHistoryState() is called to allow the application to re-synchronize itself with this saved state.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
NavigationHistory()
           
 
Method Summary
static void addHistoryItem(java.lang.String displayLabel, java.lang.Class screenClazz)
          Add a history item to the trail.
 void applyContext()
           
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
static Screen back()
           
static Screen backToScreen(java.lang.Class screenClazz)
           
static void clear()
           
 Color getBackground()
          Returns the background color of the component.
static java.lang.Class getPreviousScreenClass()
           
 void linkPressed(PropertyComponent source)
          Event handler for when a link is pressed.
 void preRender()
           Make changes to the visual representation of this component before Echo starts rendering the component.
 void setBackground(Color background)
          Sets the background color of the component.
static void updateHistoryState()
          Update the history state.
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isReadOnly, isRequired, isValid, markInvalid, markValid, rebind, removeValidator, setActionCommand, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setReadOnly, setRequired, setValue, traceValue, validate
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setClientId, setEnabled, setFocused, setFont, setForeground, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavigationHistory

public NavigationHistory()
Method Detail

preRender

public void preRender()
Description copied from interface: PropertyComponent

Make changes to the visual representation of this component before Echo starts rendering the component.

Do not modify any bound javabeans in this method, as the changes to these will not be reflected properly on the screen.

Specified by:
preRender in interface PropertyComponent
Overrides:
preRender in class CustomComponent

linkPressed

public void linkPressed(PropertyComponent source)
Event handler for when a link is pressed. Instantiates the appropriate screen, calls EchoSupport.setScreen(), forces a rebind and then loads the bread crumb state into the new screen.

Parameters:
source -

back

public static Screen back()

getPreviousScreenClass

public static java.lang.Class getPreviousScreenClass()

backToScreen

public static Screen backToScreen(java.lang.Class screenClazz)

addHistoryItem

public static void addHistoryItem(java.lang.String displayLabel,
                                  java.lang.Class screenClazz)
Add a history item to the trail. This should be called from entry points in a screen (the constructors). Pass an appropriate display label (shown in the trail).

Parameters:
displayLabel -
screenClazz -

updateHistoryState

public static void updateHistoryState()
Update the history state. Calls saveHistoryState on the current screen and stores it in the historyItems (searches the list for a screen of the same class and not the newest screen -> is correct for determining the current screen). This is called when exiting a screen (either by calling the setScreen()-method or by pressing a history link).


getBackground

public Color getBackground()
Description copied from interface: Component
Returns the background color of the component.

Specified by:
getBackground in interface Component
Overrides:
getBackground in class AbstractComponent
Returns:
The background color of the component.

setBackground

public void setBackground(Color background)
Description copied from interface: Component
Sets the background color of the component.

Specified by:
setBackground in interface Component
Overrides:
setBackground in class AbstractComponent
Parameters:
background - The new background color of the component.

clear

public static void clear()

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Component
Overrides:
applyStyle in class AbstractComponent
Parameters:
style - The style object from which to retrieve properties for this Component.

applyContext

public void applyContext()
Specified by:
applyContext in interface Precreation