com.raritantechnologies.quickstart.taglibrary.forms
Class CheckboxResultRenderer

java.lang.Object
  extended bycom.raritantechnologies.searchApp.taglibrary.BasicResultRenderer
      extended bycom.raritantechnologies.quickstart.taglibrary.forms.CheckboxResultRenderer
All Implemented Interfaces:
IConfigurable, IPreferencesBeanInfo, IResultRenderer, ISessionDataHandler

public class CheckboxResultRenderer
extends BasicResultRenderer
implements ISessionDataHandler, IResultRenderer

Renders an IResult as a checkbox. Keeps a list of selected results for a user session on the server.

XML Configuration Template:
   <ResultRenderer 
        rendererClass="com.raritantechnologies.quickstart.taglibrary.forms.CheckboxResultRenderer" 
        useHost="true"
        width="[ field width ]" 
        formField="[ checkbox http field name - used to send selections ]"
        formName="[ related display form name ]"
        setvalue="[true|false - if true a 'value' attribute is added to checkbox tag] "
        cacheResultSetName="[ name to use as session cache key of selected results ]"
        lastResultSetName="[ optional name of last result set to use (if result set is cached ) ]"
        addFieldID="[true|false - if true, appended fieldID to cacheResultSetName in session data]" 
        synchronizeCheckboxes="[true|false(default) - if true will sync all checkboxes on the same page with the same name - this requires <form> wrappers ]"
        redirectURL="[ optional URL to redirect to after a checkbox update ]"
        redirectParams="[ comma separated list of request params to include in a redirect ]" >

    <!-- Key field or id field used to determine unique result.     -->
    <Field ID="fieldID" />

    <!-- If SetField is included, checkbox toggles a result value.  -->
    <!-- else checkbox toggles the inclusion of the result in       -->
    <!-- in the cached record set.                                  -->
    <!-- NOTE: SetField checkboxes should be used with non-SetField -->
    <!-- checkboxes or the result will not be available in the      -->
    <!-- cached set!                                                -->
    <SetField ID="[ field ID of toggled value ]"
                 onVal="[ value of field if checkbox is set ]" 
                 offVal="[ value of field if checkbox is unset ]" />  

   </ResultRenderer>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from class com.raritantechnologies.searchApp.taglibrary.BasicResultRenderer
enabled, name, prefBeanName, prefCompareValue, prefEnableIfInChecklist, prefEnableIfInYesno
 
Fields inherited from interface com.raritantechnologies.searchApp.taglibrary.IResultRenderer
TEMPLATE
 
Constructor Summary
CheckboxResultRenderer()
           
 
Method Summary
protected  java.lang.String doRenderResult(IResult result, int firstResult, int lastResult, int resultNum, RaritanPageContext pageContext)
           
static java.lang.String filterIDValue(java.lang.String pIdValue)
           
 java.lang.String getCacheResultSetName()
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 java.lang.String getDelimiter()
           
 java.lang.String getFieldID()
           
 java.lang.String getFormField()
           
static java.lang.String getIDValue(IResult result, java.lang.String fieldID)
           
static java.lang.String getIDValue(IResult result, java.lang.String fieldID, java.lang.String sourceName)
           
 boolean getSetValue()
           
 java.lang.String getTitle()
           
 void handleSessionData(java.util.Map sessionDataMap, RaritanPageContext pageContext)
          Updates session data parameters handled by this handler and/or updates handler parameters.
 void initialize(org.w3c.dom.Element elem)
          IResultRenderers are XML configurable.
 void registerDataHandler(ISessionDataManager manager, java.util.Map params)
          Register this SessionDataHandler with a SessionDataManager.
 void setCacheResultSetName(java.lang.String cacheResultSetName)
           
 void setDelimiter(java.lang.String delimiter)
           
 void setFieldID(java.lang.String fieldID)
           
 void setFormField(java.lang.String formField)
           
 void setResultSetField(java.lang.String fieldName, java.lang.String onVal, java.lang.String offVal)
           
 void setSetValue(boolean setValue)
           
 void setTitle(java.lang.String title)
           
 
Methods inherited from class com.raritantechnologies.searchApp.taglibrary.BasicResultRenderer
getPrefBeanName, getPrefCompareValue, getPrefEnableIfInChecklist, getPrefEnableIfInYesno, getRenderer, isEnabled, renderResult, setEnable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.raritantechnologies.searchApp.taglibrary.IResultRenderer
getRenderer, isEnabled, renderResult, setEnable
 

Constructor Detail

CheckboxResultRenderer

public CheckboxResultRenderer()
Method Detail

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IResultRenderer
IResultRenderers are XML configurable.

Specified by:
initialize in interface IResultRenderer
Overrides:
initialize in class BasicResultRenderer

doRenderResult

protected java.lang.String doRenderResult(IResult result,
                                          int firstResult,
                                          int lastResult,
                                          int resultNum,
                                          RaritanPageContext pageContext)
Specified by:
doRenderResult in class BasicResultRenderer

getIDValue

public static java.lang.String getIDValue(IResult result,
                                          java.lang.String fieldID)

getIDValue

public static java.lang.String getIDValue(IResult result,
                                          java.lang.String fieldID,
                                          java.lang.String sourceName)

filterIDValue

public static java.lang.String filterIDValue(java.lang.String pIdValue)

registerDataHandler

public void registerDataHandler(ISessionDataManager manager,
                                java.util.Map params)
Description copied from interface: ISessionDataHandler
Register this SessionDataHandler with a SessionDataManager.

Specified by:
registerDataHandler in interface ISessionDataHandler
Parameters:
manager - The ISessionDataManager that this handler should register with by calling manager.addSessionDataHandler( "handler name", this );
params - Initialization parameters for this handler (typically obtained from the Configuration layer.

handleSessionData

public void handleSessionData(java.util.Map sessionDataMap,
                              RaritanPageContext pageContext)
Description copied from interface: ISessionDataHandler
Updates session data parameters handled by this handler and/or updates handler parameters.

Specified by:
handleSessionData in interface ISessionDataHandler
Parameters:
sessionDataMap - The entire param=value map cached for the current user session. The handler should update any of its params based on the current page context.
pageContext - The current page context. Contains request parameters that the handler should use to update its and/or the SessionData's context.

setFieldID

public void setFieldID(java.lang.String fieldID)

getFieldID

public java.lang.String getFieldID()

setFormField

public void setFormField(java.lang.String formField)

getFormField

public java.lang.String getFormField()

setDelimiter

public void setDelimiter(java.lang.String delimiter)

getDelimiter

public java.lang.String getDelimiter()

setTitle

public void setTitle(java.lang.String title)

getTitle

public java.lang.String getTitle()

setCacheResultSetName

public void setCacheResultSetName(java.lang.String cacheResultSetName)

getCacheResultSetName

public java.lang.String getCacheResultSetName()

setSetValue

public void setSetValue(boolean setValue)

getSetValue

public boolean getSetValue()

setResultSetField

public void setResultSetField(java.lang.String fieldName,
                              java.lang.String onVal,
                              java.lang.String offVal)

getConfigurationXML

public void getConfigurationXML(java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

getConfigurationXML

public java.lang.String getConfigurationXML()
Specified by:
getConfigurationXML in interface IResultRenderer

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
Specified by:
getConfigurationXML in interface IResultRenderer