com.raritantechnologies.searchApp.taglibrary
Class DynamicResultRenderer
java.lang.Object
com.raritantechnologies.searchApp.taglibrary.BasicResultRenderer
com.raritantechnologies.searchApp.taglibrary.DynamicResultRenderer
- All Implemented Interfaces:
- IConfigurable, IPreferencesBeanInfo, IResultRenderer
- public class DynamicResultRenderer
- extends BasicResultRenderer
- implements IResultRenderer
Renders a result based on a set of request or
result parameters criteria. Matches these criteria against the current search
or result parameters. Uses a set of nested result renderers along with
criteria for choosing a renderer based on request/result parameter settings.
Enables context-sensitive display elements. Can use to show/hide result
elements based on search or result contexts.
Can use to reorganize results based on search or result context (e.g. show
the "sort by" parameter on the left of a ResultColumnRenderer.
XML Configuration Template:
<ResultRenderer
rendererClass="com.raritantechnologies.searchApp.taglibrary.DynamicResultRenderer"
name="rendererName"
width="20"
matchOn="[show(default)|hide choices are show/hide default state is opposite ]"
dynamicLookupSource="[ search source to use for dynamic lookup ]"
useRenderer="[ used for templating - value should match one of the UseRenderer 'name' values ]" >
<!-- One or more UseRenderer tags with result selection criterion: The first tag that -->
<!-- matches the result will be used, so these tags should be ordered by priority. Use -->
<!-- composite renderers within the UseRenderer tag if more than one field should be rendered -->
<!-- Designates a Default Renderer (if no other renderers match ) -->
<UseRenderer isDefault="true" >
<ResultRenderer rendererClass ="A real ResultRenderer goes here]" >
<!-- parameters needed by the nested renderer -- >
</ResultRenderer>
</UseRenderer>
<!-- Can select a renderer based on the SearchSource used to acquire the result: The proxy -->
<!-- Renderer will be used if the result Source name matches the SearchSource name(s) -->
<UseRenderer sourceNames="[one or more Search Source names]" >
<ResultRenderer rendererClass ="A real ResultRenderer goes here]" >
<!-- parameters needed by the nested renderer -- >
</ResultRenderer>
</UseRenderer>
<!-- UseRenderer can also use an IResultMatcher to determine if the result should be rendered -->
<UseRenderer>
<ResultMatcher class="[ class of com.raritantechnologies.searchApp.IResultMatcher]" action="accept(default)|reject" >
</ResultMatcher>
<ResultRenderer rendererClass="[ class of com.raritantechnologies.searchApp.taglibrary.IResultRenderer ]" >
</ResultRenderer>
</UseRenderer>
<UseRenderer >
<!-- Request Parameters condition or conditions that will activate this result renderer -->
<RequestParams checkSessionCache="[ true | false(default) ]" >
<Param name="taxField_1">
<ValidValues> <!-- Any of these values will activate the element renderer -->
<Value>Relvant/path/to/activate/this/search/Element</Value>
<Value>Another/path/that/can/activate/this/element</Value>
</ValidValues>
</Param>
<!-- If the above field is valid, check this field (fields are ANDed) -->
<Param name="select_field">
<ValidValues> <!-- Any of these values will activate the element renderer: -->
<Value>Book</Value>
<Value>Magazine</Value>
</ValidValues>
</Param>
<!-- Alternatively can specify an IComparator -->
<Param name="[select_field name ]">
<Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >
</Comparator>
</Param>
</RequestParams>
<!-- Result parameter condition or conditions that will activate this result renderer -->
<ResultParams > <!-- all results must match -->
<Param name="DocumentType">
<!-- exactMatch determines if term must match value or be contained in value -->
<ValidValues exactMatch="[true/false]" > <!-- if a result matches any -->
<Value>Book</Value>
<Value>Magazine</Value>
</ValidValues>
</Param>
<!-- Alternatively can specify an IComparator -->
<Param name="[select_field name ]">
<Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >
</Comparator>
</Param>
</ResultParams>
<!-- Switch based on value of User parameters (e.g. User preferences) -->
<UserParams > <!-- all user attributes must match -->
<Param name="[ user Attribute ]">
<ValidValues> <!-- if a result matches any -->
<Value>Book</Value>
</ValidValues>
</Param>
<!-- Alternatively can specify an IComparator -->
<Param name="[select_field name ]">
<Comparator class="[ class of com.raritantechnologies.utils.comparators.IComparator ]" >
</Comparator>
</Param>
</UserParams>
<!-- Nested ResultRenderer to use if the above criterion are matched -->
<ResultRenderer rendererClass ="A real ResultRenderer goes here]" >
<!-- parameters needed by the nested renderer -- >
</ResultRenderer>
</UseRenderer>
<UseRenderer>
<!-- alternative renderer criteria: same as above -->
</UseRenderer>
</ResultRenderer>
Developed by
Raritan Technologies .
- Author:
- Ted Sullivan
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DynamicResultRenderer
public DynamicResultRenderer()
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
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
setEnable
public void setEnable(boolean enabled)
- provides show/hide control.
- Specified by:
setEnable in interface IResultRenderer- Overrides:
setEnable in class BasicResultRenderer
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled in interface IResultRenderer- Overrides:
isEnabled in class BasicResultRenderer
getRenderer
public IResultRenderer getRenderer(java.lang.String name)
- Provides for nested result renderers. returns an instance of
IResultRenderer or null if result renderer of given name is not found.
- Specified by:
getRenderer in interface IResultRenderer- Overrides:
getRenderer 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