| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.click.control.AbstractControl
org.apache.click.control.Field
org.apache.click.control.Select
org.apache.click.extras.cayenne.QuerySelect
public class QuerySelect
Provides a Cayenne Query Select control: <select></select>.
| Query Select | 
DataContext
 obtained via DataContext.getThreadDataContext(), and are executed
 as required by the onProcess() and toString() methods.
 
 QuerySelect has no dependency on CayenneForm and can be used
 separately in other forms or controls.
 DataRow
 objects containing "VALUE" and "LABEL" values, which are rendered as the
 option values and labels.
 QuerySelect title = new QuerySelect("title"); title.setQueryValueLabel("system.titles", "VALUE", "LABEL"); form.add(title);The example below uses a
SelectQuery defined in code and renders
 the Delivery object type and description properties
 and the option values and labels.
 QuerySelect delivery = new QuerySelect("delivery", true); delivery.setSelectQuery(new SelectQuery(Delivery.class)); delivery.setOptionValue("type"); delivery.setOptionLabel("description"); form.add(delivery);The last example uses a
Decorator to render the select options label.
 QuerySelect userSelect = new QuerySelect("user", true); userSelect.setSelectQuery(new SelectQuery(User.class)); userSelect.setOptionValue("username"); userSelect.setDecorator(new Decorator() { public String render(Object object, Context context) { User user = (User) object; return user.getFirstName() + " " + user.getLastName(); } }); form.add(userSelect);
CayenneForm, 
PropertySelect, 
Serialized Form| Field Summary | |
|---|---|
| protected  Decorator | decoratorThe option label rendering decorator. | 
| protected  boolean | expireCacheThe flag specifying whether the cache should be ignored. | 
| protected  org.apache.cayenne.query.NamedQuery | namedQueryThe option list Cayenne NamedQuery. | 
| protected  boolean | optionalThe flag indicating whether the option list includes an empty option value. | 
| protected  String | optionLabelThe query result property to render as the option label. | 
| protected  String | optionValueThe query result property to render as the option value. | 
| protected  String | queryNameThe name of the configured select query. | 
| protected  org.apache.cayenne.query.SelectQuery | selectQueryThe option list Cayenne SelectQuery. | 
| Fields inherited from class org.apache.click.control.Select | 
|---|
| dataProvider, defaultOption, multiple, optionList, selectedValues, size, VALIDATE_SELECT_FUNCTION | 
| Fields inherited from class org.apache.click.control.Field | 
|---|
| disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value | 
| Fields inherited from class org.apache.click.control.AbstractControl | 
|---|
| actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles | 
| Fields inherited from interface org.apache.click.Control | 
|---|
| CONTROL_MESSAGES | 
| Constructor Summary | |
|---|---|
| QuerySelect()Create a QuerySelect field with no name defined, please note the control's name must be defined before it is valid. | |
| QuerySelect(String name)Create a QuerySelect field with the given name. | |
| QuerySelect(String name,
            boolean required)Create a QuerySelect field with the given name and required status. | |
| QuerySelect(String name,
            String label)Create a QuerySelect field with the given name and label. | |
| QuerySelect(String name,
            String label,
            boolean required)Create a QuerySelect field with the given name, label and required status. | |
| Method Summary | |
|---|---|
|  Decorator | getDecorator()Return the option label rendering decorator. | 
|  boolean | getExpireCache()Return true if the query should expire the cache. | 
|  org.apache.cayenne.query.NamedQuery | getNamedQuery()Return the NamedQuery to populate the options list with. | 
|  String | getOptionLabel()Return the query result property to render as the option label. | 
|  String | getOptionValue()Return the query result property to render as the option value. | 
|  String | getQueryName()Return the name of the configured query to populate the options list with. | 
|  org.apache.cayenne.query.SelectQuery | getSelectQuery()Return the SelectQuery to populate the options list with. | 
|  boolean | isOptional()Return true if the option list includes an empty option value. | 
| protected  void | loadOptionList()Load the Select options list. | 
|  void | render(HtmlStringBuffer buffer)Render the HTML representation of the QuerySelect. | 
|  void | setDecorator(Decorator decorator)Set the decorator to render the option labels. | 
|  void | setExpireCache(boolean expireCache)Set the query should expire cache parameter. | 
|  void | setNamedQuery(org.apache.cayenne.query.NamedQuery namedQuery)Set the NamedQuery to populate the options list with. | 
|  void | setOptional(boolean value)Set whether the option list includes an empty option value. | 
|  void | setOptionLabel(String optionLabel)Set the query result property to render as the option label. | 
|  void | setOptionValue(String optionValue)Set the query result property to render as the option value. | 
|  void | setQueryName(String queryName)Set the name of the configured query to populate the options list with. | 
|  void | setQueryValueLabel(String queryName,
                   String optionValue,
                   String optionLabel)Set the configured queryName to execute, the property to render as the option value, and the property to render as the option label. | 
|  void | setSelectQuery(org.apache.cayenne.query.SelectQuery selectQuery)Set the SelectQuery to populate the options list with. | 
|  void | validate()Validate the QuerySelect request submission. | 
| Methods inherited from class org.apache.click.control.Select | 
|---|
| add, add, add, add, addAll, addAll, addAll, addAll, bindRequestValue, getControlSizeEst, getDataProvider, getDefaultOption, getDefaultOptionValue, getMultipleValues, getOptionList, getSelectedValues, getSize, getState, getTag, getValidationJavaScript, isMultiple, onRender, setDataProvider, setDefaultOption, setInitialValue, setMultiple, setMultipleValues, setOptionList, setSelectedValues, setSize, setState | 
| Methods inherited from class org.apache.click.control.Field | 
|---|
| getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, onProcess, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth | 
| Methods inherited from class org.apache.click.control.AbstractControl | 
|---|
| addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onDestroy, onInit, removeBehavior, removeStyleClass, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
protected Decorator decorator
protected boolean expireCache
protected org.apache.cayenne.query.NamedQuery namedQuery
protected String queryName
protected boolean optional
protected String optionLabel
protected String optionValue
protected org.apache.cayenne.query.SelectQuery selectQuery
| Constructor Detail | 
|---|
public QuerySelect(String name)
name - the name of the field
public QuerySelect(String name,
                   String label)
name - the name of the fieldlabel - the label of the field
public QuerySelect(String name,
                   boolean required)
name - the name of the fieldrequired - the field required status
public QuerySelect(String name,
                   String label,
                   boolean required)
name - the name of the fieldlabel - the label of the fieldrequired - the field required statuspublic QuerySelect()
| Method Detail | 
|---|
public Decorator getDecorator()
public void setDecorator(Decorator decorator)
decorator - the decorator to render the select option labelspublic boolean getExpireCache()
public void setExpireCache(boolean expireCache)
expireCache - the query should expire cache parameterpublic org.apache.cayenne.query.NamedQuery getNamedQuery()
public void setNamedQuery(org.apache.cayenne.query.NamedQuery namedQuery)
namedQuery - to populate the options list withpublic String getQueryName()
public void setQueryName(String queryName)
queryName - the name of the configured query to populate the options list with
public void setQueryValueLabel(String queryName,
                               String optionValue,
                               String optionLabel)
queryName - the configured named query to executeoptionValue - the property to render as the option valueoptionLabel - the property to render as the option labelpublic boolean isOptional()
public void setOptional(boolean value)
value - set whether the option list includes an empty option valuepublic String getOptionLabel()
public void setOptionLabel(String optionLabel)
optionLabel - the query result property to render as the option labelpublic String getOptionValue()
public void setOptionValue(String optionValue)
optionValue - the query result property to render as the option valuepublic org.apache.cayenne.query.SelectQuery getSelectQuery()
public void setSelectQuery(org.apache.cayenne.query.SelectQuery selectQuery)
selectQuery - the SelectQuery to populate the options
  list withpublic void validate()
validate in class SelectSelect.validate()public void render(HtmlStringBuffer buffer)
render in interface Controlrender in class Selectbuffer - the specified buffer to render the control's output toAbstractControl.toString()protected void loadOptionList()
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||