com.plumtree.portaluiinfrastructure.search
Class SearchFormFactory

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.search.SearchFormFactory

public class SearchFormFactory
extends java.lang.Object

Factory class that manufactures a com.plumtree.xpshared.htmlelements.HTMLForm that encodes search requests and submits them to any ActivitySpace that includes a SearchResultModel. Note: If your form is used to find certain types of administrative objects, optionally within certain folders, you should probably call the static method GetObjectSearchForm(); this is the easiest way to make a form that works and satisfies portal UI standards. If you're making any other type of search form, you need to instantiate a SearchFormFactory object and add constraints and HTML elements to it, one at a time. Sample usage: see package com.plumtree.portalpagessample.search

Author:
CraigS

Field Summary
static java.lang.String BANNER_NAME_PREFIX
          This is prefix for the Form Name when it is rendered in the Banner Search.
 
Constructor Summary
SearchFormFactory(java.lang.String name, java.lang.String formID, AActivitySpace owner)
          Constructor.
SearchFormFactory(java.lang.String name, java.lang.String formID, AActivitySpace owner, boolean buildCompleteForm)
          Constructor.
 
Method Summary
 void AddFilterStatement(int operand, int operatorId, java.lang.String value)
          Add an advanced search-style filter to the search form.
protected  void AddInputs(java.lang.String inputNamePrefix, int settingId, java.lang.Object settingValue)
          Helper method to actually add the setting hidden inputs, called by AddRequiredSetting and AddOptionalSetting
 void AddOptionalSetting(java.lang.String optionName, int settingId, boolean settingValue)
          Add an optional setting that will be set only if the indicated optionName is selected
 void AddOptionalSetting(java.lang.String optionName, int settingId, int settingValue)
          Add an optional setting that will be set only if the indicated optionName is selected
 void AddOptionalSetting(java.lang.String optionName, int settingId, int[] settingValue)
          Add an optional setting that will be set only if the indicated optionName is selected
 void AddOptionalSetting(java.lang.String optionName, int settingId, java.lang.String settingValue)
          Add an optional setting that will be set only if the indicated optionName is selected
 void AddRequiredSetting(int settingId, boolean settingValue)
          Add a required setting (constraint) that will be added to all searches generated by this form.
 void AddRequiredSetting(int settingId, int settingValue)
          Add a required setting (constraint) that will be added to all searches generated by this form.
 void AddRequiredSetting(int settingId, int[] settingValue)
          Add a required setting (constraint) that will be added to all searches generated by this form.
 void AddRequiredSetting(int settingId, java.lang.String settingValue)
          Add a required setting (constraint) that will be added to all searches generated by this form.
 void AddRequiredSettings(SearchSettingCollection c)
          Add a group of required settings (constraint) that will be added to all searches generated by this form.
protected  void CreateFilterElements()
          Create the hidden inputs for the search form to encode the filter.
 void ForceBannerSearchDefaults()
          Special flag that forces this search box to have all the user's banner search defaults applied to it.
 void ForceSubmitOfEnclosingForm()
          Yet another hack special flag.
 void ForceTopBestBet()
          Special flag for designating the form to be a top best bet search, which requires a special control (the activity space was alterable through other methods, but this was added for setting the control).
 java.lang.String GetAnchorOnClick()
          Returns the onclick javascript for the HTMLAnchor used as a "submit" button or link
 HTMLForm GetForm()
          Convenience method.
 java.lang.String GetInputBoxName()
          Returns the name callers must use for the input box, if it is a banner search then it returns 'q' since it is friendly url parameter for search name.
 java.lang.String GetInputBoxOnKeyDown()
          Returns the javascript callers should use as the "onKeyDown" attribute of the input box
 java.lang.String GetNextSelectName()
          Get a new name for a pull-down HTMLSelect.
 HTMLElement GetResult()
          Returns the search form (if building a complete form) or inputs to be inserted into another form (otherwise).
static HTMLImg GetSearchButton(AActivitySpace m_asOwner)
          Static convenience method to return the standard portal search button
 java.lang.String GetSingleClassFilterJavascript(java.lang.String optionValue)
           
static HTMLScript MakeSearchFormJavascript(java.lang.String name, AActivitySpace m_asOwner, java.lang.String inputBoxName)
          This is public so it can be used for the "search again" form on the results page; most users of this class should NOT call this method.
 void OverrideEnclosingFormAndSubmitToSearchResultPage()
          Special flag (== "hack"), buildCompleteForm (passed to the constructor) must be false.
 void SetFilterClauseOperator(int oper)
          Set the operator for the set of statements in the filter.
 void SetPageMode(java.lang.String pageMode)
          A special "mode" argument thta is passed along to the results page.
 void SetTarget(java.lang.String space, java.lang.String spaceID, java.lang.String page)
          Sets the target for this form.
 void SetValidateAlert(boolean validateAlert)
           
 void SetValidationFunction(java.lang.String strFunctionName)
          Sets the javascript validation function for this form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BANNER_NAME_PREFIX

public static final java.lang.String BANNER_NAME_PREFIX
This is prefix for the Form Name when it is rendered in the Banner Search.

See Also:
Constant Field Values
Constructor Detail

SearchFormFactory

public SearchFormFactory(java.lang.String name,
                         java.lang.String formID,
                         AActivitySpace owner)
Constructor. Note "name" must be unique for the current page.


SearchFormFactory

public SearchFormFactory(java.lang.String name,
                         java.lang.String formID,
                         AActivitySpace owner,
                         boolean buildCompleteForm)
Constructor. Note "name" must be unique for the current page.

Method Detail

AddOptionalSetting

public void AddOptionalSetting(java.lang.String optionName,
                               int settingId,
                               java.lang.String settingValue)
Add an optional setting that will be set only if the indicated optionName is selected


AddOptionalSetting

public void AddOptionalSetting(java.lang.String optionName,
                               int settingId,
                               boolean settingValue)
Add an optional setting that will be set only if the indicated optionName is selected


AddOptionalSetting

public void AddOptionalSetting(java.lang.String optionName,
                               int settingId,
                               int settingValue)
Add an optional setting that will be set only if the indicated optionName is selected


AddOptionalSetting

public void AddOptionalSetting(java.lang.String optionName,
                               int settingId,
                               int[] settingValue)
Add an optional setting that will be set only if the indicated optionName is selected


AddRequiredSettings

public void AddRequiredSettings(SearchSettingCollection c)
Add a group of required settings (constraint) that will be added to all searches generated by this form.


AddRequiredSetting

public void AddRequiredSetting(int settingId,
                               boolean settingValue)
Add a required setting (constraint) that will be added to all searches generated by this form.


AddRequiredSetting

public void AddRequiredSetting(int settingId,
                               int settingValue)
Add a required setting (constraint) that will be added to all searches generated by this form.


AddRequiredSetting

public void AddRequiredSetting(int settingId,
                               int[] settingValue)
Add a required setting (constraint) that will be added to all searches generated by this form.


ForceBannerSearchDefaults

public void ForceBannerSearchDefaults()
Special flag that forces this search box to have all the user's banner search defaults applied to it. Should only be used by the banner search box itself and the "search again" box on the search results page, otherwise you can't be sure what you get.


ForceTopBestBet

public void ForceTopBestBet()
Special flag for designating the form to be a top best bet search, which requires a special control (the activity space was alterable through other methods, but this was added for setting the control).


ForceSubmitOfEnclosingForm

public void ForceSubmitOfEnclosingForm()
Yet another hack special flag. If called, and we're embedded within another form, then force the form to be submitted through javascript when the user hits Enter in the search box. *THIS IS DANGEROUS*; some browsers also submit the form automatically; make sure you don't get double searches!!


SetValidateAlert

public void SetValidateAlert(boolean validateAlert)

GetAnchorOnClick

public final java.lang.String GetAnchorOnClick()
Returns the onclick javascript for the HTMLAnchor used as a "submit" button or link


GetForm

public HTMLForm GetForm()
Convenience method. Same as GetResult(), but simply casts the result to type HTMLForm. Do not call if buildCompleteForm=false was passed to the constructor.


GetInputBoxName

public final java.lang.String GetInputBoxName()
Returns the name callers must use for the input box, if it is a banner search then it returns 'q' since it is friendly url parameter for search name.


AddRequiredSetting

public void AddRequiredSetting(int settingId,
                               java.lang.String settingValue)
Add a required setting (constraint) that will be added to all searches generated by this form.


GetInputBoxOnKeyDown

public java.lang.String GetInputBoxOnKeyDown()
Returns the javascript callers should use as the "onKeyDown" attribute of the input box


GetNextSelectName

public java.lang.String GetNextSelectName()
Get a new name for a pull-down HTMLSelect.


GetResult

public HTMLElement GetResult()
Returns the search form (if building a complete form) or inputs to be inserted into another form (otherwise).


GetSearchButton

public static HTMLImg GetSearchButton(AActivitySpace m_asOwner)
Static convenience method to return the standard portal search button


SetPageMode

public void SetPageMode(java.lang.String pageMode)
A special "mode" argument thta is passed along to the results page. Different results page implementations may interpret this flag in different ways.


MakeSearchFormJavascript

public static HTMLScript MakeSearchFormJavascript(java.lang.String name,
                                                  AActivitySpace m_asOwner,
                                                  java.lang.String inputBoxName)
This is public so it can be used for the "search again" form on the results page; most users of this class should NOT call this method.


OverrideEnclosingFormAndSubmitToSearchResultPage

public void OverrideEnclosingFormAndSubmitToSearchResultPage()
Special flag (== "hack"), buildCompleteForm (passed to the constructor) must be false. Before submitting the search form, override the parent form's in_hi_space and associated arguments to force the user to go to the search results page.


SetTarget

public void SetTarget(java.lang.String space,
                      java.lang.String spaceID,
                      java.lang.String page)
Sets the target for this form.


SetValidationFunction

public void SetValidationFunction(java.lang.String strFunctionName)
Sets the javascript validation function for this form. This javascript function must be declared elsewhere on the page and must not include the final '();'.


AddInputs

protected void AddInputs(java.lang.String inputNamePrefix,
                         int settingId,
                         java.lang.Object settingValue)
Helper method to actually add the setting hidden inputs, called by AddRequiredSetting and AddOptionalSetting


SetFilterClauseOperator

public void SetFilterClauseOperator(int oper)
Set the operator for the set of statements in the filter.

Parameters:
oper - Should be PT_BOOLOP_AND or PT_BOOLOP_OR

AddFilterStatement

public void AddFilterStatement(int operand,
                               int operatorId,
                               java.lang.String value)
Add an advanced search-style filter to the search form. For example: factory.AddFilterStatement(PT_INTRINSICS.PT_PROPERTY_PROVIDERCLSID, PT_FILTEROPS.PT_FILTEROP_CONTAINS, "61266621"); This will add a filter for things with a provider classid that contains "61266621". Note that you can make multiple calls to this method to produce a set of filter statements. The default is for these to be 'and-ed' together, but you can change that by calling SetFilterClauseOperator. You should call this before calling GetForm.

Parameters:
operand - Any integer property id
operatorId - Something from PT_FILTEROPS
value - A string value.
Throws:
HTMLException

CreateFilterElements

protected void CreateFilterElements()
Create the hidden inputs for the search form to encode the filter.


GetSingleClassFilterJavascript

public java.lang.String GetSingleClassFilterJavascript(java.lang.String optionValue)



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.