com.raritantechnologies.searchApp.taglibrary
Class SearchForm

java.lang.Object
  extended byBodyTagSupport
      extended bycom.raritantechnologies.searchApp.taglibrary.SearchForm
All Implemented Interfaces:
IConfigurable, ICustomTag

public class SearchForm
extends BodyTagSupport
implements ICustomTag

JSP Custom Tag that displays configurable Search HTML search input form. This is the "wrapper" class for all RTI search forms. Search forms are rendered by a delegate class of type ISearchFormRenderer.

JSP Custom Tag Template:
   <search:SearchForm formName="[ name of SearchForm ( use same value as name attribute in configuration XML below) ]"
                         categoryName="[ source category of SearchForm (use same value as category attribute in XML below) ]"
                         hiddenFields="[ set of hidden fields to be added to form formatted 'field:value,field2:value2' ]"
                         
 
XML Configuration Template:
  <SearchForm name="formName" 
                 category="form category"
                 rendererClass="[ class of ISearchFormRenderer ]"
                 autoSourceSelect="true|false" >

   <!-- details needed by someRendererClass -->

   <!-- alternatively, if a BasicSearchFormRenderer is intended, list the fields -->
   <Field ID="AU" type="text" width="50" name="Author" />

   <Field ID="TI" type="text" width="50" name="Title" >
      <FieldOp ID="TIBOOL" type="select" />
   </Field>

   <Field ID="KY" type="text" width="50" name="Keywords" >
      <FieldOp ID="KYBOOL" type="select" />
   </Field>

   <Field ID="PageSize" type="radio" name="Page Size" >
     <Choice value="10" name="10" default="on" />
     <Choice value="20" name="20" />
     <Choice value="50" name="50" />
   </Field>

  </SearchForm>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan
See Also:
Serialized Form

Field Summary
protected  java.lang.String activeDisplayKey
           
protected  java.lang.String activeDisplayParam
           
 
Constructor Summary
SearchForm()
           
 
Method Summary
 int doAfterBody()
           
 int doStartTag()
           
 java.lang.String getBody(RaritanPageContext rpc)
          Returns the tag body.
protected  ISearchFormRenderer getSearchFormRenderer(RaritanPageContext rPageContext)
           
static ISearchFormRenderer getSearchFormRenderer(java.lang.String searchFormName, java.lang.String categoryName, RaritanPageContext rPageContext)
          returns an ISearchFormRenderer given a search form name and category name.
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void initialize(java.util.Map initParams)
           
 void setAction(java.lang.String action)
          Sets the form action attribute (as in the HTML <form action="someAction.jsp").
 void setActiveDisplayKey(java.lang.String displayKey)
           
 void setActiveDisplayParam(java.lang.String displayParam)
           
 void setCategoryName(java.lang.String categoryName)
          Sets the search form category as defined in the Application Configuration XML.
 void setFormInitArgs(java.lang.String formInitArgs)
          Additional arguments (name=value attributes) to the <form> tag.
 void setFormMethod(java.lang.String formMethod)
           
 void setFormName(java.lang.String searchFormName)
          Name of the search form as defined in the Application Configuration XML.
 void setHiddenFields(java.lang.String hiddenFields)
          Sets form hidden fields.
 void setInitialFields(java.lang.String initialFields)
          Additional form fields that are added 'as-is' to the <form> element.
 void setTarget(java.lang.String target)
          Sets the target window for the form submit results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeDisplayParam

protected java.lang.String activeDisplayParam

activeDisplayKey

protected java.lang.String activeDisplayKey
Constructor Detail

SearchForm

public SearchForm()
Method Detail

setFormName

public void setFormName(java.lang.String searchFormName)

Name of the search form as defined in the Application Configuration XML. This key enables the SearchForm to find the appropriate SearchFormRenderer.

Parameters:
searchFormName - The name of the <SearchForm> tag in the Application configuration XML that should be used to render this search form.

setCategoryName

public void setCategoryName(java.lang.String categoryName)

Sets the search form category as defined in the Application Configuration XML. Used for dynamic switching of search forms.

The categoryName is linked to a Search Source or sources through the application source map configuration. If search form elements are to set the search source category independently, the categoryName should be set to empty string or "null".

Parameters:
categoryName - The name of the search source category to use with this form. The categoryName is an alias or key that is used by the application SourceMap to resolve a SearchSource name.

setHiddenFields

public void setHiddenFields(java.lang.String hiddenFields)
Sets form hidden fields. Input is a packed string containing a set of hidden fields to be added to the search form. Format is "field:value,field2:value2" where field/value pairs are separated by a comma ',' and fields are separated from values by a colon ':'.

Parameters:
hiddenFields - A packed string of the format field:value,field2:value2 where field/value pairs are separated by a comma and field is separated from value by a colon.

setInitialFields

public void setInitialFields(java.lang.String initialFields)
Additional form fields that are added 'as-is' to the <form> element.

Parameters:
initialFields - A string that will be included in the form tag, "as-is".

setAction

public void setAction(java.lang.String action)
Sets the form action attribute (as in the HTML <form action="someAction.jsp").

Parameters:
action - Used to set the <form> action attribute value.

setFormInitArgs

public void setFormInitArgs(java.lang.String formInitArgs)
Additional arguments (name=value attributes) to the <form> tag. For example, can be CSS directives or processing directives such as form encoding - (example: "enctype='multipart/form-data'" if files or binary data needs to be uploaded).

Parameters:
formInitArgs - Additional arguments (complete name=value attributes) to be added to the <form> tag.

setTarget

public void setTarget(java.lang.String target)
Sets the target window for the form submit results.


setActiveDisplayKey

public void setActiveDisplayKey(java.lang.String displayKey)

setActiveDisplayParam

public void setActiveDisplayParam(java.lang.String displayParam)

setFormMethod

public void setFormMethod(java.lang.String formMethod)

doStartTag

public int doStartTag()
               throws JspException
Throws:
JspException

getBody

public java.lang.String getBody(RaritanPageContext rpc)
Description copied from interface: ICustomTag
Returns the tag body.

Specified by:
getBody in interface ICustomTag
Parameters:
rpc - Platform-neutral page context ( can be used in non J2EE environments such as ASP).
Returns:
The tag body text string.

getSearchFormRenderer

protected ISearchFormRenderer getSearchFormRenderer(RaritanPageContext rPageContext)

getSearchFormRenderer

public static ISearchFormRenderer getSearchFormRenderer(java.lang.String searchFormName,
                                                        java.lang.String categoryName,
                                                        RaritanPageContext rPageContext)
returns an ISearchFormRenderer given a search form name and category name. Looks up the renderer from the application configuration XML.


doAfterBody

public int doAfterBody()
                throws JspException
Throws:
JspException

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

initialize

public void initialize(java.util.Map initParams)
Specified by:
initialize in interface ICustomTag