org.sakaiproject.cheftool
Class NewPagedResourceAction

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.sakaiproject.vm.ComponentServlet
              extended byorg.sakaiproject.vm.VmServlet
                  extended byorg.sakaiproject.cheftool.VmServlet
                      extended byorg.sakaiproject.cheftool.ToolServlet
                          extended byorg.sakaiproject.cheftool.VelocityPortletPaneledAction
                              extended byorg.sakaiproject.cheftool.NewPagedResourceAction
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public abstract class NewPagedResourceAction
extends VelocityPortletPaneledAction

PagedResourceAction is a base class that handles paged display of lists of Resourecs.

Version:
$Revision: 2371 $
Author:
University of Michigan, CHEF Software Development Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
VelocityPortletPaneledAction.MyLogger
 
Field Summary
protected static int DEFAULT_PAGE_SIZE
          The default number of items per page.
protected static String FORM_PAGE_NUMBER
           
protected static String FORM_SEARCH
          Form fields.
protected static String PARAM_PAGESIZE
          portlet configuration parameter names.
protected static String STATE_CURRENT_PAGE
           
protected static String STATE_GO_FIRST_PAGE
           
protected static String STATE_GO_LAST_PAGE
           
protected static String STATE_GO_NEXT
           
protected static String STATE_GO_NEXT_PAGE
           
protected static String STATE_GO_PREV
           
protected static String STATE_GO_PREV_PAGE
           
protected static String STATE_GOTO_PAGE
           
protected static String STATE_MANUAL_REFRESH
           
protected static String STATE_NEXT_EXISTS
           
protected static String STATE_NEXT_PAGE_EXISTS
           
protected static String STATE_NUM_ITEMS
           
protected static String STATE_PAGESIZE
           
protected static String STATE_PAGING
           
protected static String STATE_PREV_EXISTS
           
protected static String STATE_PREV_PAGE_EXISTS
           
protected static String STATE_SEARCH
           
protected static String STATE_SELECTED_VIEW
           
protected static String STATE_TOP_PAGE_ITEM
           
protected static String STATE_TOTAL_PAGENUMBER
           
protected static String STATE_VIEW_ID
          state attribute names.
 
Fields inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
ATTR_CONFIG, ATTR_CONTEXT, ATTR_FRAME_FOCUS, ATTR_FRAME_REFRESH, ATTR_PORTLET, ATTR_RUNDATA, ATTR_TOP_REFRESH, BUTTON, CONTEXT_SITE_COLLECTION_ID, CONTEXT_SITE_COLLECTION_URL, LAYOUT_MAIN, Log, MODE_OPTIONS, STATE_ACTION, STATE_FLOAT, STATE_HELPER, STATE_MESSAGE, STATE_MODE, STATE_OBSERVER, STATE_OBSERVER2, STATE_PRESENCE_OBSERVER, STATE_TOOL
 
Fields inherited from class org.sakaiproject.cheftool.ToolServlet
ALERT_ATTR, ALERT_STATE_INITED, MENU_ATTR, PARAM_ACTION, PARAM_ACTION_COMBO, TITLE_PANEL, TOOL_MODE_ATTR, TOOL_MODE_DEFAULT
 
Fields inherited from class org.sakaiproject.cheftool.VmServlet
m_validator
 
Fields inherited from class org.sakaiproject.vm.ComponentServlet
ATTR_PARAMS
 
Constructor Summary
NewPagedResourceAction()
           
 
Method Summary
protected  void addSearchMenus(Menu bar, SessionState state)
          Add the menus for search.
 void doAuto(RunData data, Context context)
          Toggle auto-update
 void doList_first(RunData runData, Context context)
          Handle a first-item page (list) request.
 void doList_last(RunData runData, Context context)
          Handle a last-item page (list) request.
 void doList_next(RunData runData, Context context)
          Handle a next-page (list) request.
 void doList_prev(RunData runData, Context context)
          Handle a prev-page (list) request.
 void doRefresh(RunData data, Context context)
          The action for when the user want's an update
 void doSearch_clear(RunData runData, Context context)
          Handle a Search Clear request.
 void doSearch(RunData runData, Context context)
          Handle a Search request.
 void doToggle_paging(RunData data, Context context)
          The action for toggling paging status: show all(no paging) or paging
 void doView_next(RunData runData, Context context)
          Handle a next-item (view) request.
 void doView_page(RunData runData, Context context)
          Handle a view indecated page request
 void doView_prev(RunData runData, Context context)
          Handle a prev-item (view) request.
 void enableObserver(SessionState state)
          Enable the observer, unless we are in search mode, where we want it disabled.
protected  int findResourceInList(List resources, String id)
          Find the resource with this id in the list.
protected  void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)
          Populate the state object, if needed, concerning paging
protected  List prepPage(SessionState state)
          Prepare the current page of items to display.
protected abstract  List readAllResources(SessionState state)
          Implement this to return alist of all the resources that there are to page.
protected  void resetPaging(SessionState state)
          Reset to the first page
protected  int totalPageNumber(SessionState state)
          Return the total page number
 
Methods inherited from class org.sakaiproject.cheftool.VelocityPortletPaneledAction
actionDispatch, addAlert, addOptionsMenu, cancelOptions, clientWindowId, disableObservers, doGet, doOptions, doReset, enableObservers, getContext, helperActionDispatch, initState, justDelivered, mainPanelUpdateId, processAction, resetTool, saveOptions, scheduleFocusRefresh, schedulePeerFrameRefresh, scheduleTopRefresh, setVmCourier, setVmStdRef, titlePanelUpdateId, toolModeDispatch, updateState
 
Methods inherited from class org.sakaiproject.cheftool.ToolServlet
doPost, getAlert, getAlert, getMenu, getPid, getState, getToolMode, prepState, setToolMode
 
Methods inherited from class org.sakaiproject.vm.VmServlet
getActionURL, getVmReference, includeVm, setVmReference
 
Methods inherited from class org.sakaiproject.vm.ComponentServlet
sendParentRedirect, service, setNoCacheHeaders
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PAGE_SIZE

protected static final int DEFAULT_PAGE_SIZE
The default number of items per page.

See Also:
Constant Field Values

PARAM_PAGESIZE

protected static final String PARAM_PAGESIZE
portlet configuration parameter names.

See Also:
Constant Field Values

STATE_VIEW_ID

protected static final String STATE_VIEW_ID
state attribute names.

See Also:
Constant Field Values

STATE_TOP_PAGE_ITEM

protected static final String STATE_TOP_PAGE_ITEM
See Also:
Constant Field Values

STATE_PAGESIZE

protected static final String STATE_PAGESIZE
See Also:
Constant Field Values

STATE_TOTAL_PAGENUMBER

protected static final String STATE_TOTAL_PAGENUMBER
See Also:
Constant Field Values

STATE_NUM_ITEMS

protected static final String STATE_NUM_ITEMS
See Also:
Constant Field Values

STATE_NEXT_PAGE_EXISTS

protected static final String STATE_NEXT_PAGE_EXISTS
See Also:
Constant Field Values

STATE_PREV_PAGE_EXISTS

protected static final String STATE_PREV_PAGE_EXISTS
See Also:
Constant Field Values

STATE_GO_NEXT_PAGE

protected static final String STATE_GO_NEXT_PAGE
See Also:
Constant Field Values

STATE_GO_PREV_PAGE

protected static final String STATE_GO_PREV_PAGE
See Also:
Constant Field Values

STATE_GO_NEXT

protected static final String STATE_GO_NEXT
See Also:
Constant Field Values

STATE_GO_PREV

protected static final String STATE_GO_PREV
See Also:
Constant Field Values

STATE_NEXT_EXISTS

protected static final String STATE_NEXT_EXISTS
See Also:
Constant Field Values

STATE_PREV_EXISTS

protected static final String STATE_PREV_EXISTS
See Also:
Constant Field Values

STATE_GO_FIRST_PAGE

protected static final String STATE_GO_FIRST_PAGE
See Also:
Constant Field Values

STATE_GO_LAST_PAGE

protected static final String STATE_GO_LAST_PAGE
See Also:
Constant Field Values

STATE_SEARCH

protected static final String STATE_SEARCH
See Also:
Constant Field Values

STATE_MANUAL_REFRESH

protected static final String STATE_MANUAL_REFRESH
See Also:
Constant Field Values

STATE_GOTO_PAGE

protected static final String STATE_GOTO_PAGE
See Also:
Constant Field Values

STATE_CURRENT_PAGE

protected static final String STATE_CURRENT_PAGE
See Also:
Constant Field Values

STATE_SELECTED_VIEW

protected static final String STATE_SELECTED_VIEW
See Also:
Constant Field Values

STATE_PAGING

protected static final String STATE_PAGING
See Also:
Constant Field Values

FORM_SEARCH

protected static final String FORM_SEARCH
Form fields.

See Also:
Constant Field Values

FORM_PAGE_NUMBER

protected static final String FORM_PAGE_NUMBER
See Also:
Constant Field Values
Constructor Detail

NewPagedResourceAction

public NewPagedResourceAction()
Method Detail

readAllResources

protected abstract List readAllResources(SessionState state)
Implement this to return alist of all the resources that there are to page. Sort them as appropriate, and apply search criteria.


totalPageNumber

protected int totalPageNumber(SessionState state)
Return the total page number


addSearchMenus

protected void addSearchMenus(Menu bar,
                              SessionState state)
Add the menus for search.


initState

protected void initState(SessionState state,
                         VelocityPortlet portlet,
                         JetspeedRunData rundata)
Populate the state object, if needed, concerning paging

Overrides:
initState in class VelocityPortletPaneledAction

prepPage

protected List prepPage(SessionState state)
Prepare the current page of items to display.

Returns:
List of items to display on this page.

doView_page

public void doView_page(RunData runData,
                        Context context)
Handle a view indecated page request


doView_next

public void doView_next(RunData runData,
                        Context context)
Handle a next-item (view) request.


doList_first

public void doList_first(RunData runData,
                         Context context)
Handle a first-item page (list) request.


doList_last

public void doList_last(RunData runData,
                        Context context)
Handle a last-item page (list) request.


doList_next

public void doList_next(RunData runData,
                        Context context)
Handle a next-page (list) request.


doView_prev

public void doView_prev(RunData runData,
                        Context context)
Handle a prev-item (view) request.


doList_prev

public void doList_prev(RunData runData,
                        Context context)
Handle a prev-page (list) request.


doSearch

public void doSearch(RunData runData,
                     Context context)
Handle a Search request.


doSearch_clear

public void doSearch_clear(RunData runData,
                           Context context)
Handle a Search Clear request.


resetPaging

protected void resetPaging(SessionState state)
Reset to the first page


findResourceInList

protected int findResourceInList(List resources,
                                 String id)
Find the resource with this id in the list.

Parameters:
id - The item id.
Returns:
The index position in the list of the item with this id, or -1 if not found.

doAuto

public void doAuto(RunData data,
                   Context context)
Toggle auto-update


doRefresh

public void doRefresh(RunData data,
                      Context context)
The action for when the user want's an update


enableObserver

public void enableObserver(SessionState state)
Enable the observer, unless we are in search mode, where we want it disabled.


doToggle_paging

public void doToggle_paging(RunData data,
                            Context context)
The action for toggling paging status: show all(no paging) or paging