org.kuali.rice.krad.uif.view
Class History

java.lang.Object
  extended by org.kuali.rice.krad.uif.view.History
All Implemented Interfaces:
Serializable

public class History
extends Object
implements Serializable

History class used to keep track of views visited so they can be displayed in the ui as breadcrumbs - both as homeward path and history path interpretations

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Field Summary
static String ENTRY_TOKEN
           
static String VAR_TOKEN
           
 
Constructor Summary
History()
           
 
Method Summary
 void buildCurrentEntryFromRequest(UifFormBase form, javax.servlet.http.HttpServletRequest request)
          Sets the current HistoryEntry using information from the form and the request.
 void buildHistoryFromParameterString(String parameterString)
          Takes in the encoded history query parameter string passed on the url and parses it to create the list of historyEntries.
protected  String buildViewTitle(UifFormBase form)
          Builds the title for the view to display in history (for example breadcrumbs)
 HistoryEntry getCurrent()
          Gets the current view's HistoryEntry.
 List<HistoryEntry> getGeneratedBreadcrumbs()
          Generates a list of HistoryEntries that can be used as breadcrumbs by the breadcrumb widget.
 HistoryEntry getGeneratedCurrentBreadcrumb()
          Gets the current HistoryEntry in the breadcrumb format described in getGeneratedBreadcrumbs
 List<HistoryEntry> getHistoryEntries()
          Gets a list of the current HistoryEntries not including the current entry.
 String getHistoryParameterString()
          Gets the encoded and tokenized history parameter string that is representative of the HistoryEntries currently in History and includes the current view's HistoryEntry.
 List<HistoryEntry> getHomewardPath()
          Gets the predetermined homeward path for this view's history.
 boolean isAppendHomewardPath()
           
 boolean isAppendPassedHistory()
           
 void pushToHistory(String viewId, String pageId, String title, String url, String formKey)
          Pushes the information passed in to history.
 void setAppendHomewardPath(boolean appendHomewardPath)
          When this is set to true, the homeward path will be appended.
 void setAppendPassedHistory(boolean appendPassedHistory)
          Appends the passed history as each different view is shown.
 void setCurrent(HistoryEntry current)
           
 void setHistoryEntries(List<HistoryEntry> history)
           
 void setHomewardPath(List<HistoryEntry> homewardPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTRY_TOKEN

public static final String ENTRY_TOKEN
See Also:
Constant Field Values

VAR_TOKEN

public static final String VAR_TOKEN
See Also:
Constant Field Values
Constructor Detail

History

public History()
Method Detail

getGeneratedBreadcrumbs

public List<HistoryEntry> getGeneratedBreadcrumbs()
Generates a list of HistoryEntries that can be used as breadcrumbs by the breadcrumb widget. This method appends the appropriate history information on the HistoryEntry url variables so when a view is requested its history can be regenerated for use in its breadcrumbs. It also sets the the passed showHome variable to false to prevent showing the homeward path more than once (as it is passed through the history variable backwards). This does not include the current HistoryEntry as a breadcrumb but adds the formKey as the LAST_FORM_KEY to assist with server side form cleanup.

Returns:

getGeneratedCurrentBreadcrumb

public HistoryEntry getGeneratedCurrentBreadcrumb()
Gets the current HistoryEntry in the breadcrumb format described in getGeneratedBreadcrumbs


pushToHistory

public void pushToHistory(String viewId,
                          String pageId,
                          String title,
                          String url,
                          String formKey)
Pushes the information passed in to history. Note: currently only used internally in the class - be cautious about its external use.

Parameters:
viewId -
pageId -
title -
url -
formKey -

buildCurrentEntryFromRequest

public void buildCurrentEntryFromRequest(UifFormBase form,
                                         javax.servlet.http.HttpServletRequest request)
Sets the current HistoryEntry using information from the form and the request. This history parameter is extracted out of the url in order for a "clean" url to be used in history parameter and breadcrumb generation, as passing history history through the nested urls is unnecessary.

Parameters:
form -
request -

buildHistoryFromParameterString

public void buildHistoryFromParameterString(String parameterString)
Takes in the encoded history query parameter string passed on the url and parses it to create the list of historyEntries. It will also append any homeward path if appendHomewardPath is true. This append will happen after the passedHistory entries are appended so it will not make sense to use both settings in most cases.

Parameters:
parameterString -

getHistoryParameterString

public String getHistoryParameterString()
Gets the encoded and tokenized history parameter string that is representative of the HistoryEntries currently in History and includes the current view's HistoryEntry. This parameter should be appended on any appropriate links which perform view swapping.

Returns:
String containing history entries

buildViewTitle

protected String buildViewTitle(UifFormBase form)
Builds the title for the view to display in history (for example breadcrumbs)

Retrieves the viewLabelFieldPropertyName from the view if configured, otherwise attempts to find the title attribute for the default data object. If view label property is found the corresponding property value is retrieved and appended to the title for the view

TODO: Possibly move so it can be used for the actual view title, not just history

Parameters:
form - - form instance containing the view and view data
Returns:
String title string to use

getHomewardPath

public List<HistoryEntry> getHomewardPath()
Gets the predetermined homeward path for this view's history. This is set by the same property in the view's Breadcrumbs configuration.

Returns:
the homewardPath

setHomewardPath

public void setHomewardPath(List<HistoryEntry> homewardPath)
Parameters:
homewardPath - the homewardPath to set

getHistoryEntries

public List<HistoryEntry> getHistoryEntries()
Gets a list of the current HistoryEntries not including the current entry. This list does not include the "&history=" query parameter on each HistoryEntry's url variable. For HistoryEntries that include history information to be passed to the view they are retrieving, getGeneratedBreadcrumbs is used.

Returns:
the history

setHistoryEntries

public void setHistoryEntries(List<HistoryEntry> history)
Parameters:
history - the history to set

getCurrent

public HistoryEntry getCurrent()
Gets the current view's HistoryEntry. This does not include the "&history=" query parameter on its url variable. For the HistoryEntry that includes history information to be passed on the url it is retrieving, getGeneratedCurrentBreadcrumb is used.

Returns:
the current

setCurrent

public void setCurrent(HistoryEntry current)
Parameters:
current - the current to set

setAppendHomewardPath

public void setAppendHomewardPath(boolean appendHomewardPath)
When this is set to true, the homeward path will be appended. Note: For most cases this should only be on during the first view load. This setting is set automatically in most cases.

Parameters:
appendHomewardPath - the appendHomewardPath to set

isAppendHomewardPath

public boolean isAppendHomewardPath()
Returns:
the appendHomewardPath

setAppendPassedHistory

public void setAppendPassedHistory(boolean appendPassedHistory)
Appends the passed history as each different view is shown. This setting should be used when displaying passed history is relevant to the user (ie inquiry/lookup chains). This setting is set automatically in most cases.

Parameters:
appendPassedHistory - the appendPassedHistory to set

isAppendPassedHistory

public boolean isAppendPassedHistory()
Returns:
the appendPassedHistory


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.