Package org.sakaiproject.cheftool
Class VelocityPortletPaneledAction
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.sakaiproject.vm.ComponentServlet
-
- org.sakaiproject.vm.VmServlet
-
- org.sakaiproject.cheftool.VmServlet
-
- org.sakaiproject.cheftool.ToolServlet
-
- org.sakaiproject.cheftool.VelocityPortletPaneledAction
-
- All Implemented Interfaces:
Serializable,Servlet,ServletConfig
- Direct Known Subclasses:
NewPagedResourceAction,PagedResourceAction,PagedResourceActionII,PagedResourceHelperAction,VelocityPortletStateAction
public abstract class VelocityPortletPaneledAction extends ToolServlet
VelocityPortletPaneledAction ...
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringATTR_CONFIGA PortletConfig bound into the request attributes.protected static StringATTR_CONTEXTA Context bound into the request attributes.static StringATTR_FRAME_FOCUSTool session attribute name used to schedule a focus change.static StringATTR_FRAME_REFRESHTool session attribute name used to schedule a peer frame refresh.protected static StringATTR_PORTLETA VelocityPortlet bound into the request attributes.protected static StringATTR_RUNDATAA JetspeedRunData bound into the request attributes.static StringATTR_TOP_REFRESHTool session attribute name used to schedule a whole page refresh.protected static StringBUTTONprotected static StringCONTEXT_SITE_COLLECTION_IDThe name of the context variable containing the identifier for the site's root content collectionprotected static StringCONTEXT_SITE_COLLECTION_URLThe name of the context variable containing the access URL for the site's root content collectionprotected static StringHELPER_LINK_MODEConstants to handle helper situationsprotected static StringHELPER_MODE_DONEprotected static StringLAYOUT_MAINThe panel name of the main panel - append the tool's id.static StringMODE_OPTIONSStandard modes.static StringMODE_PERMISSIONSprotected static StringSAKAI_CSRF_TOKENThe name of the param used for CSRF protectionprotected static StringSTATE_ACTIONstatic StringSTATE_BUNDLE_KEYstatic StringSTATE_FLOATstatic StringSTATE_HELPERThe currently active helper mode static class.static StringSTATE_MESSAGEprotected static StringSTATE_MODEprotected static StringSTATE_NEW_PANELstatic StringSTATE_NOTIFprotected static StringSTATE_OBSERVERstatic StringSTATE_OBSERVER2static StringSTATE_PRESENCE_OBSERVERstatic StringSTATE_TOOLstatic StringSTATE_TOOL_KEY-
Fields inherited from class org.sakaiproject.cheftool.ToolServlet
ALERT_ATTR, ALERT_STATE_INITED, HELPER_ID, MAIN_PANEL, 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
Constructors Constructor Description VelocityPortletPaneledAction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactionDispatch(String methodBase, String methodExt, HttpServletRequest req, HttpServletResponse res)Dispatch to a "processAction" method based on reflection.static voidaddAlert(SessionState state, String message)Add another string to the alert message.static voidaddAlert(SessionState state, String message, boolean removeDuplicates)Add another string to the alert message.static voidaddFlashNotif(SessionState state, String message)Add another string to the flash notification message.protected voidaddOptionsMenu(Menu bar, JetspeedRunData data)Add the options to the menu bar, if allowed.protected booleanallowedToOptions()Check if the current user is allowed to do options for the current context (site based)protected Stringbuild_permissions_context(VelocityPortlet portlet, Context context, RunData data, SessionState state)protected voidcancelOptions()Cancel the options process.booleancheckCSRFToken(HttpServletRequest request, RunData rundata, String action)protected voidcheckRunData(HttpServletRequest req)protected voiddoGet(HttpServletRequest req, HttpServletResponse res)Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool modevoiddoOptions(RunData runData, Context context)Handle a request to set options.voiddoReset(RunData runData, Context context)Handle the "reset tool" option from the Title bar.protected Map<String,String>getContext(RunData data)This is used to get "template" from the map, the default template registered for the tool in chef_tools.xreg.String[]getDateFormatString()String[]getTimeFormatString()Return a String array containing the "h", "m", "a", or "H" characters (corresponding to hour, minute, am/pm, or 24-hour) in the locale specific orderprotected voidhelperActionDispatch(String methodBase, String methodExt, HttpServletRequest req, HttpServletResponse res, String className)Dispatch to a "processAction" method based on reflection in a helper class.protected voidinitState(SessionState state, HttpServletRequest req, HttpServletResponse res)Initialize for the first time the session state for this session.protected voidinitState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)static StringmainPanelUpdateId(String toolId)Compute the courier update html element id for the main panel - add "." and other names for inner panels.protected StringpanelMethodName(String panel)Allow extension classes to control which build method gets called for this pannelvoidprocessAction(HttpServletRequest req, HttpServletResponse res)Process a Portlet action.protected voidresetTool(SessionState state)Reset the tool (state) to "home" conditions.protected voidsaveOptions()Complete the options process with a save.protected voidscheduleFocusRefresh(String[] path)Schedule a focus change.protected voidschedulePeerFrameRefresh(String id)Schedule a refresh for a peer frame.protected voidscheduleTopRefresh()Schedule a refresh for whole pageprotected voidsetVmStdRef(HttpServletRequest request, HttpServletResponse response)Add some standard references to the vm context.static voidswitchPanel(SessionState state, String newPanel)Switch to a new panelstatic StringtitlePanelUpdateId(String toolId)Compute the courier update html element id for the title panel.protected voidtoolModeDispatch(String methodBase, String methodExt, HttpServletRequest req, HttpServletResponse res)Dispatch to a "do" method based on reflection.protected voidupdateState(SessionState state, HttpServletRequest req, HttpServletResponse res)Update for this request processing the session state.-
Methods inherited from class org.sakaiproject.cheftool.ToolServlet
doPost, getAlert, getAlert, getMenu, getPid, getState, getToolMode, prepState, sendToHelper, setToolMode, startHelper, startHelper
-
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
-
-
-
-
Field Detail
-
BUTTON
protected static final String BUTTON
- See Also:
- Constant Field Values
-
STATE_HELPER
public static final String STATE_HELPER
The currently active helper mode static class.- See Also:
- Constant Field Values
-
STATE_MODE
protected static final String STATE_MODE
- See Also:
- Constant Field Values
-
STATE_OBSERVER
protected static final String STATE_OBSERVER
- See Also:
- Constant Field Values
-
STATE_ACTION
protected static final String STATE_ACTION
- See Also:
- Constant Field Values
-
STATE_NEW_PANEL
protected static final String STATE_NEW_PANEL
- See Also:
- Constant Field Values
-
CONTEXT_SITE_COLLECTION_ID
protected static final String CONTEXT_SITE_COLLECTION_ID
The name of the context variable containing the identifier for the site's root content collection- See Also:
- Constant Field Values
-
CONTEXT_SITE_COLLECTION_URL
protected static final String CONTEXT_SITE_COLLECTION_URL
The name of the context variable containing the access URL for the site's root content collection- See Also:
- Constant Field Values
-
LAYOUT_MAIN
protected static final String LAYOUT_MAIN
The panel name of the main panel - append the tool's id.- See Also:
- Constant Field Values
-
SAKAI_CSRF_TOKEN
protected static final String SAKAI_CSRF_TOKEN
The name of the param used for CSRF protection- See Also:
- Constant Field Values
-
HELPER_LINK_MODE
protected static final String HELPER_LINK_MODE
Constants to handle helper situations- See Also:
- Constant Field Values
-
HELPER_MODE_DONE
protected static final String HELPER_MODE_DONE
- See Also:
- Constant Field Values
-
STATE_OBSERVER2
public static final String STATE_OBSERVER2
- See Also:
- Constant Field Values
-
STATE_PRESENCE_OBSERVER
public static final String STATE_PRESENCE_OBSERVER
- See Also:
- Constant Field Values
-
STATE_FLOAT
public static final String STATE_FLOAT
- See Also:
- Constant Field Values
-
STATE_TOOL
public static final String STATE_TOOL
- See Also:
- Constant Field Values
-
STATE_TOOL_KEY
public static final String STATE_TOOL_KEY
- See Also:
- Constant Field Values
-
STATE_BUNDLE_KEY
public static final String STATE_BUNDLE_KEY
- See Also:
- Constant Field Values
-
STATE_MESSAGE
public static final String STATE_MESSAGE
- See Also:
- Constant Field Values
-
STATE_NOTIF
public static final String STATE_NOTIF
- See Also:
- Constant Field Values
-
MODE_OPTIONS
public static final String MODE_OPTIONS
Standard modes.- See Also:
- Constant Field Values
-
MODE_PERMISSIONS
public static final String MODE_PERMISSIONS
- See Also:
- Constant Field Values
-
ATTR_CONTEXT
protected static final String ATTR_CONTEXT
A Context bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_CONFIG
protected static final String ATTR_CONFIG
A PortletConfig bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_PORTLET
protected static final String ATTR_PORTLET
A VelocityPortlet bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_RUNDATA
protected static final String ATTR_RUNDATA
A JetspeedRunData bound into the request attributes.- See Also:
- Constant Field Values
-
ATTR_FRAME_REFRESH
public static final String ATTR_FRAME_REFRESH
Tool session attribute name used to schedule a peer frame refresh.- See Also:
- Constant Field Values
-
ATTR_TOP_REFRESH
public static final String ATTR_TOP_REFRESH
Tool session attribute name used to schedule a whole page refresh.- See Also:
- Constant Field Values
-
ATTR_FRAME_FOCUS
public static final String ATTR_FRAME_FOCUS
Tool session attribute name used to schedule a focus change.- See Also:
- Constant Field Values
-
-
Method Detail
-
initState
protected void initState(SessionState state, VelocityPortlet portlet, JetspeedRunData rundata)
-
mainPanelUpdateId
public static String mainPanelUpdateId(String toolId)
Compute the courier update html element id for the main panel - add "." and other names for inner panels.- Parameters:
toolId- The tool (portlet) id.- Returns:
- The courier update html element id for the main panel.
-
titlePanelUpdateId
public static String titlePanelUpdateId(String toolId)
Compute the courier update html element id for the title panel.- Parameters:
toolId- The tool (portlet) id.- Returns:
- The courier update html element id for the title panel.
-
addAlert
public static void addAlert(SessionState state, String message)
Add another string to the alert message. Defaults to removing duplicates from the alert message- Parameters:
state- The session state.message- The string to add.
-
addAlert
public static void addAlert(SessionState state, String message, boolean removeDuplicates)
Add another string to the alert message.- Parameters:
state- The session state.message- The string to add.removeDuplicates- Remove duplicates from the alert
-
addFlashNotif
public static void addFlashNotif(SessionState state, String message)
Add another string to the flash notification message.- Parameters:
state- The session state.message- The string to add.
-
switchPanel
public static void switchPanel(SessionState state, String newPanel)
Switch to a new panel- Parameters:
state- The session state.newPanel- The new panel name
-
initState
protected void initState(SessionState state, HttpServletRequest req, HttpServletResponse res)
Initialize for the first time the session state for this session. If overridden in a sub-class, make sure to call super.- Overrides:
initStatein classToolServlet- Parameters:
state- The session state.req- The current portlet request.res- The current portlet response.
-
updateState
protected void updateState(SessionState state, HttpServletRequest req, HttpServletResponse res)
Update for this request processing the session state. If overridden in a sub-class, make sure to call super.- Overrides:
updateStatein classToolServlet- Parameters:
state- The session state.req- The current portlet request.res- The current portlet response.
-
toolModeDispatch
protected void toolModeDispatch(String methodBase, String methodExt, HttpServletRequest req, HttpServletResponse res) throws ToolException
Dispatch to a "do" method based on reflection. Override ToolServlet to support the old "build" ways.- Overrides:
toolModeDispatchin classToolServlet- Parameters:
methodBase- The base name of the method to call.methodExt- The end name of the method to call.req- The HttpServletRequest.res- The HttpServletResponse- Throws:
ToolException
-
panelMethodName
protected String panelMethodName(String panel)
Allow extension classes to control which build method gets called for this pannel- Parameters:
panel-- Returns:
-
processAction
public void processAction(HttpServletRequest req, HttpServletResponse res)
Process a Portlet action.- Overrides:
processActionin classToolServlet
-
checkCSRFToken
public boolean checkCSRFToken(HttpServletRequest request, RunData rundata, String action)
-
actionDispatch
protected void actionDispatch(String methodBase, String methodExt, HttpServletRequest req, HttpServletResponse res)
Dispatch to a "processAction" method based on reflection.- Overrides:
actionDispatchin classToolServlet- Parameters:
methodBase- The base name of the method to call.methodExt- The end name of the method to call.req- The HttpServletRequest.res- The HttpServletResponse
-
helperActionDispatch
protected void helperActionDispatch(String methodBase, String methodExt, HttpServletRequest req, HttpServletResponse res, String className)
Dispatch to a "processAction" method based on reflection in a helper class.- Parameters:
methodBase- The base name of the method to call.methodExt- The end name of the method to call.req- The HttpServletRequest.res- The HttpServletResponse
-
getContext
protected Map<String,String> getContext(RunData data)
This is used to get "template" from the map, the default template registered for the tool in chef_tools.xreg.
-
build_permissions_context
protected String build_permissions_context(VelocityPortlet portlet, Context context, RunData data, SessionState state)
-
saveOptions
protected void saveOptions()
Complete the options process with a save.
-
cancelOptions
protected void cancelOptions()
Cancel the options process.
-
addOptionsMenu
protected void addOptionsMenu(Menu bar, JetspeedRunData data)
Add the options to the menu bar, if allowed.- Parameters:
bar- The menu bar to add to,ref- The resource reference to base the security decision upon.
-
allowedToOptions
protected boolean allowedToOptions()
Check if the current user is allowed to do options for the current context (site based)- Returns:
- true if the user is allowed to modify the current context's options, false if not.
-
doReset
public void doReset(RunData runData, Context context)
Handle the "reset tool" option from the Title bar.
-
resetTool
protected void resetTool(SessionState state)
Reset the tool (state) to "home" conditions. Default here is to clear everything from state.- Parameters:
state- The tool's session state.
-
setVmStdRef
protected void setVmStdRef(HttpServletRequest request, HttpServletResponse response)
Add some standard references to the vm context.- Overrides:
setVmStdRefin classToolServlet- Parameters:
request- The render request.response- The render response.
-
doGet
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException
Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode- Overrides:
doGetin classToolServlet- Throws:
ServletException
-
checkRunData
protected void checkRunData(HttpServletRequest req)
-
scheduleTopRefresh
protected void scheduleTopRefresh()
Schedule a refresh for whole page
-
schedulePeerFrameRefresh
protected void schedulePeerFrameRefresh(String id)
Schedule a refresh for a peer frame.- Parameters:
id- The peer frame's id.
-
scheduleFocusRefresh
protected void scheduleFocusRefresh(String[] path)
Schedule a focus change.- Parameters:
path- The desired focus path elements
-
getDateFormatString
public String[] getDateFormatString()
-
getTimeFormatString
public String[] getTimeFormatString()
Return a String array containing the "h", "m", "a", or "H" characters (corresponding to hour, minute, am/pm, or 24-hour) in the locale specific order
-
-