net.mlw.vlh.web.mvc
Class ValueListHandlerHelper

java.lang.Object
  extended bynet.mlw.vlh.web.mvc.ValueListHandlerHelper

public class ValueListHandlerHelper
extends Object

This package is used in mvc controlers to better handle with the ValueListHandler. It allow you to

  • backup ValueList info to the session before redirect!
  • modify paging possition, focusing property and values, sorting order, etc.
  • Usage
    Please, before use, set a ValueListHandler property with a reference to your valueListHandler!

    Version:
    $Revision: 1.6 $ $Date: 2005/11/23 14:19:45 $
    Author:
    Andrej Zachar

    Constructor Summary
    ValueListHandlerHelper()
               
     
    Method Summary
     void backupAndSet(javax.servlet.http.HttpServletRequest request, ValueList valueList, String valueListName, String tableId)
              Do 2 things: Backup the ValueList Info to the session with the attribute's name tableId and store Value List to the request with the attribute key's name valueListName
     void backupInfoFor(javax.servlet.http.HttpServletRequest request, ValueListInfo info)
              Save ValueListInfo to the session with key of TableInfo.DEFAULT_ID.
     void backupInfoFor(javax.servlet.http.HttpServletRequest request, ValueListInfo info, String tableId)
              Save ValueListInfo to session with key of tableId if info is null, remove the tableId attribute from session.
     String getActionParam(javax.servlet.http.HttpServletRequest request, String name)
              Return the name of parameter without ActionTag.ACTION_TEMP_PARAM_PREFIX Example: param id return id
     String getActionTempParam(javax.servlet.http.HttpServletRequest request, String name)
              Return the name of parameter with ActionTag.ACTION_TEMP_PARAM_PREFIX Example: param id return ACTid
     int getLastPageAfterDelete(ValueListInfo info)
              If delete first and at that time also the last entry on the last page, you sets actual last page! You should call this method in a action after delete is done.
     ValueList getValueList(String name, ValueListInfo info)
              Retrieve valueList from ValueListHadler bean.
     ValueListHandler getValueListHandler()
              Get a bean of the ValueListHandler.
     ValueListInfo getValueListInfo(javax.servlet.http.HttpServletRequest request)
              To get ValueListInfo it use the TableInfo.DEFAULT_ID as the tableId.
     ValueListInfo getValueListInfo(javax.servlet.http.HttpServletRequest request, String tableId)
              Return ValueListInfo from a request (which is preferr to session) or a session or new ValueListInfo().
     void setValueListHandler(ValueListHandler valueListHandler)
               
     void setValueListTo(javax.servlet.http.HttpServletRequest request, ValueList valueList, String valueListName)
              Store only ValueList to request as an attribute with the name valueListName.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ValueListHandlerHelper

    public ValueListHandlerHelper()
    Method Detail

    setValueListHandler

    public void setValueListHandler(ValueListHandler valueListHandler)
    Parameters:
    valueListHandler - The valueListHandler to set.

    getValueListHandler

    public ValueListHandler getValueListHandler()
    Get a bean of the ValueListHandler.

    Returns:
    ValueListHandler

    getValueList

    public ValueList getValueList(String name,
                                  ValueListInfo info)
    Retrieve valueList from ValueListHadler bean.

    Parameters:
    name - the name of the Adapter
    info -
    Returns:
    ValueList

    getValueListInfo

    public ValueListInfo getValueListInfo(javax.servlet.http.HttpServletRequest request)
    To get ValueListInfo it use the TableInfo.DEFAULT_ID as the tableId.

    Parameters:
    request -
    Returns:
    ValueListInfo
    See Also:
    getValueListInfo(HttpServletRequest, String), TableInfo.DEFAULT_ID

    getValueListInfo

    public ValueListInfo getValueListInfo(javax.servlet.http.HttpServletRequest request,
                                          String tableId)
    Return ValueListInfo from a request (which is preferr to session) or a session or new ValueListInfo().
  • If request contains any parameters, which belongs to a table with the tableId , return the ValueListInfo from the request.
  • Otherwise if the session contains attribute tableId , then return it from the session .
  • If the request or the session dosn't contain the ValueListInfo, return new ValueListInfo.
  • Parameters:
    request -
    tableId -
    Returns:
    ValueListInfo
    See Also:
    getValueListInfo(HttpServletRequest)

    backupAndSet

    public void backupAndSet(javax.servlet.http.HttpServletRequest request,
                             ValueList valueList,
                             String valueListName,
                             String tableId)
    Do 2 things:
  • Backup the ValueList Info to the session with the attribute's name tableId and
  • store Value List to the request with the attribute key's name valueListName
  • Parameters:
    request -
    valueList - null -> info will be removed from session and storing will be skipped.
    valueListName - the name used in the <vlh:root value="valueListName" ... to retrieve
    tableId - unique id in the session
    See Also:
    backupInfoFor(HttpServletRequest, ValueListInfo, String), setValueListTo(HttpServletRequest, ValueList, String)

    setValueListTo

    public void setValueListTo(javax.servlet.http.HttpServletRequest request,
                               ValueList valueList,
                               String valueListName)
    Store only ValueList to request as an attribute with the name valueListName.

    Parameters:
    request -
    valueList - ValueList to store
    valueListName - request attribute's

    backupInfoFor

    public void backupInfoFor(javax.servlet.http.HttpServletRequest request,
                              ValueListInfo info)
    Save ValueListInfo to the session with key of TableInfo.DEFAULT_ID. You should prevent of use this method.

    Parameters:
    request - HttpServletRequest
    info - ValueListInfo
    See Also:
    TableInfo.DEFAULT_ID, backupInfoFor(HttpServletRequest, ValueListInfo, String)

    backupInfoFor

    public void backupInfoFor(javax.servlet.http.HttpServletRequest request,
                              ValueListInfo info,
                              String tableId)
    Save ValueListInfo to session with key of tableId if info is null, remove the tableId attribute from session.

    Parameters:
    request - HttpServletRequest
    info - ValueListInfo to back up to session
    tableId - String session's attributes name
    See Also:

    during accesing session, we are not using any synchronization.


    getActionTempParam

    public String getActionTempParam(javax.servlet.http.HttpServletRequest request,
                                     String name)
    Return the name of parameter with ActionTag.ACTION_TEMP_PARAM_PREFIX Example: param id return ACTid

    Parameters:
    request -
    name -
    Returns:
    String
    See Also:
    ActionTag.ACTION_TEMP_PARAM_PREFIX

    getActionParam

    public String getActionParam(javax.servlet.http.HttpServletRequest request,
                                 String name)
    Return the name of parameter without ActionTag.ACTION_TEMP_PARAM_PREFIX Example: param id return id

    Parameters:
    request -
    name -
    Returns:
    String
    See Also:
    ActionTag.ACTION_TEMP_PARAM_PREFIX

    getLastPageAfterDelete

    public int getLastPageAfterDelete(ValueListInfo info)
    If delete first and at that time also the last entry on the last page, you sets actual last page! You should call this method in a action after delete is done.

    Parameters:
    info - ValueListInfo
    Returns:
    int Last page, or last page -1 of last retrieved valueListInfo.
    See Also:
    ValueListInfo.getTotalNumberOfEntries(), ValueListInfo.getPagingNumberPer(), ValueListInfo#getPagingPer()


    Copyright © 2003-2006 mlavilson. All Rights Reserved.