org.openpipeline.server.pages
Class AdminPage

java.lang.Object
  extended by org.openpipeline.server.pages.AdminPage
Direct Known Subclasses:
AddJobPage, ConfigureDocFiltersPage, ConfigureStagesPage, GenericConnectorPage, LoginPage, SelectStagesPage, ServerPropertiesPage, ServerStatsPage, SetSchedulePage, StatusLogPage, UserPage, UsersPage, ViewJobsPage

public class AdminPage
extends Object

Helper class for processing pages in the Admin UI. Most pages in the Admin have their own helper class that extends this one. Manages populating controls on the form, the page header, messages, and error handling.


Constructor Summary
AdminPage()
           
 
Method Summary
 void addMessage(String msg)
           
 void addMessages(List list)
           
 String checkbox(String name, boolean defaultValue)
          Add a checkbox to the form.
 String checkbox(String name, boolean defaultValue, boolean includeCbName)
          Same as checkbox(name, defaultValue), includes an option to omit the cbname field.
static void convertParamsToXMLConfig(Map paramMap, XMLConfig conf)
          Convert the parameters to an XMLConfig object.
static void convertXMLConfigToParams(XMLConfig conf, Map paramMap)
          Convert the XMLConfig object to parameters and add them to the existing parameters.
 boolean getBooleanParam(String name, boolean defaultVal)
          Get a boolean parameter out of the request.
 List getMessages()
           
 String getParam(String name)
          Get a string parameter
 String getParam(String name, String defaultVal)
          Get a string parameter.
 Map getParamMap()
           
 String[] getParams(String name)
          Return an array of values for the name
 void handleError(String message, Throwable t)
           
 String passwordField(String name)
          Add a password field
 void populateParams(Map map)
          Populate the parameter map with existing params.
 void processPage(javax.servlet.jsp.PageContext pageContext)
          Initialize the page
 String radioButton(String name, String value, boolean defaultChecked)
          Add a radio button to the form.
 String selectField(String name, String options)
          Convenience method for selectField(name, options, null);
 String selectField(String name, String options, String optionValues)
          Add a select dropdown to the form.
 void setParam(String name, String value)
          Set the value of a param.
 String textArea(String name, String cols, String rows, boolean wrap)
          Add a text area control to the form.
 String textField(String name)
          Add a text field
 String textField(String name, int size)
          Add a sized text field.
 String textField(String name, int size, int maxLength)
          Add a sized text field with a maximum number of allowed characters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdminPage

public AdminPage()
Method Detail

populateParams

public void populateParams(Map map)
Populate the parameter map with existing params. Useful for prepopulating the controls on a page.

Parameters:
map - a map of name/value pairs

getParamMap

public Map getParamMap()

processPage

public void processPage(javax.servlet.jsp.PageContext pageContext)
Initialize the page

Parameters:
pageContext - the pageContext variable from the jsp page

checkbox

public String checkbox(String name,
                       boolean defaultValue)
Add a checkbox to the form. Also adds a hidden field, cbname, with a value equal to the checkbox name. The purpose of the hidden field is to handle cases where the user unchecks the box. If there is no check, then it's as if the form doesn't contain this field at all, and no parameter is sent. The hidden field just lets the processXXXPage() method know that the field exists.


checkbox

public String checkbox(String name,
                       boolean defaultValue,
                       boolean includeCbName)
Same as checkbox(name, defaultValue), includes an option to omit the cbname field.


radioButton

public String radioButton(String name,
                          String value,
                          boolean defaultChecked)
Add a radio button to the form.

Parameters:
name - name of the button. If other buttons have the same name, they will be part of the same radio group
value - the value the name will have when this control is checked
defaultChecked - set this true if this button should be checked by default, when the name does not have a value
Returns:
the html for the radio button

textField

public String textField(String name)
Add a text field


textField

public String textField(String name,
                        int size)
Add a sized text field.


textField

public String textField(String name,
                        int size,
                        int maxLength)
Add a sized text field with a maximum number of allowed characters.


passwordField

public String passwordField(String name)
Add a password field


selectField

public String selectField(String name,
                          String options)
Convenience method for selectField(name, options, null);

Parameters:
name - name of the field
options - visible options
Returns:
a select field suitable for inclusion in html

selectField

public String selectField(String name,
                          String options,
                          String optionValues)
Add a select dropdown to the form. Call it like this:

selectField("myname", "None,Red,Blue", ",red,blue");

optionValues can be null, but if it's not, it must have the same number of elements as options.

Parameters:
name - name of the field
options - visible options, must not be null
optionValues - hidden values for each option, can be null
Returns:
a select field suitable for inclusion in html

textArea

public String textArea(String name,
                       String cols,
                       String rows,
                       boolean wrap)
Add a text area control to the form.

Parameters:
name - name of param
cols - columns in the control
rows - rows in the control
wrap - set true if word wrap should be on
Returns:
a textarea input field

getParam

public String getParam(String name,
                       String defaultVal)
Get a string parameter.


getParam

public String getParam(String name)
Get a string parameter


getParams

public String[] getParams(String name)
Return an array of values for the name


getBooleanParam

public boolean getBooleanParam(String name,
                               boolean defaultVal)
Get a boolean parameter out of the request.


convertParamsToXMLConfig

public static void convertParamsToXMLConfig(Map paramMap,
                                            XMLConfig conf)
Convert the parameters to an XMLConfig object.

Parameters:
conf -

convertXMLConfigToParams

public static void convertXMLConfigToParams(XMLConfig conf,
                                            Map paramMap)
Convert the XMLConfig object to parameters and add them to the existing parameters.


getMessages

public List getMessages()

addMessage

public void addMessage(String msg)

addMessages

public void addMessages(List list)

handleError

public void handleError(String message,
                        Throwable t)

setParam

public void setParam(String name,
                     String value)
Set the value of a param.

Parameters:
name - name of the param
value - the value of the param