com.arsdigita.acs.html
Class DimensionalBar

java.lang.Object
  |
  +--com.arsdigita.acs.html.DimensionalBar

public class DimensionalBar
extends java.lang.Object

Displays a table of links that can be used to limit database query results.


Constructor Summary
DimensionalBar()
           
 
Method Summary
 void addValue(java.lang.String id, java.lang.String value, java.lang.String text)
          Special case of addValue for sqlClauses with no associated SQL, i.e.
 void addValue(java.lang.String id, java.lang.String value, java.lang.String text, com.arsdigita.db.SqlFragment sqlClause)
          Specifies an additional choice for one of the dimensions specified by addVariable.
 void addValue(java.lang.String id, java.lang.String value, java.lang.String text, java.lang.String sqlClause)
          Special case of addValue for sqlClauses with no bind variables.
 void addVariable(java.lang.String id, java.lang.String title)
          Specifies a dimension along which to choose.
 void addVariable(java.lang.String id, java.lang.String title, java.lang.String defaultValue)
          Specifies a dimension along which to choose.
 void clear()
          Clears out the values added to this dimensional bar
 com.arsdigita.db.SqlFragment getDimensionalSql()
          Returns SQL for inclusion in the where clause of a query.
 void setUrl(java.lang.String url)
          Sets the target for the links that are generated.
 void setValues(ACSForm selectedValues)
          Specifies the values to be highlighted.
 java.lang.String toString()
          Returns an HTML fragment that displays all the choices that have been configured with the addVariable and addValue methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DimensionalBar

public DimensionalBar()
               throws ACSException
Method Detail

addVariable

public void addVariable(java.lang.String id,
                        java.lang.String title)
Specifies a dimension along which to choose. Uncommon case where no default value is chosen.
Parameters:
id - the name of the URL variable
title - the title of this variable, for displaying as a column header along the top of the DimensionalBar

addVariable

public void addVariable(java.lang.String id,
                        java.lang.String title,
                        java.lang.String defaultValue)
Specifies a dimension along which to choose.
Parameters:
id - the name of the URL variable
title - the title of this variable, for displaying as a column header along the top of the DimensionalBar
defaultValue - the value to display as selected, if a particular value has not already been chosen by the user

addValue

public void addValue(java.lang.String id,
                     java.lang.String value,
                     java.lang.String text)
              throws ACSException
Special case of addValue for sqlClauses with no associated SQL, i.e. "all"

addValue

public void addValue(java.lang.String id,
                     java.lang.String value,
                     java.lang.String text,
                     java.lang.String sqlClause)
              throws ACSException
Special case of addValue for sqlClauses with no bind variables.

addValue

public void addValue(java.lang.String id,
                     java.lang.String value,
                     java.lang.String text,
                     com.arsdigita.db.SqlFragment sqlClause)
              throws ACSException
Specifies an additional choice for one of the dimensions specified by addVariable.
Parameters:
id - the name of the URL variable which may contain this value
value - the value to assign to the URL variable when the user chooses this value
text - the text to display for the value
sqlClause - the restriction to apply to a SQL query involving this variable. This is a SQL expression that can follow "where" in a query. The word "where" should not be included. The empty string is an allowable value if no restriction should be added for this value (for example, the value represents "All")
Throws:
ACSException - if variable matching id does not exist.

toString

public java.lang.String toString()
Returns an HTML fragment that displays all the choices that have been configured with the addVariable and addValue methods.
Overrides:
toString in class java.lang.Object

getDimensionalSql

public com.arsdigita.db.SqlFragment getDimensionalSql()
Returns SQL for inclusion in the where clause of a query. The fragment is generated by choosing the sqlClause for the selected (or default) value for each dimension. Note that this will return an empty string in the case that no default is found or the current value's "code" is "empty", so it is not safe to simple append this to "where ".

setUrl

public void setUrl(java.lang.String url)
Sets the target for the links that are generated. This is an optional parameter; by default the url of the current page is used, obtained from the PageContext.

setValues

public void setValues(ACSForm selectedValues)
Specifies the values to be highlighted. This is an optional and rarely-used parameter; by default we use the form variables submitted to the current page. Note that this must be an ACSForm rather than simply an AdSet in order to support exporting of only variables that existed when the set was first created.

clear

public void clear()
Clears out the values added to this dimensional bar