com.arsdigita.bebop.form
Class SearchAndSelect

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.FormSection
              extended bycom.arsdigita.bebop.form.SearchAndSelect
All Implemented Interfaces:
BebopConstants, Cloneable, Component, Container, EventListener, Lockable, PrintListener

public class SearchAndSelect
extends FormSection
implements BebopConstants, PrintListener

Search and select Bebop widget. This widget is used to allow a user to search for a particular item over a potentially very large set. Depending on the size of the dataset, the user will either see a search box or a selection box (with all valid items). The search box will then change to a selection box once the user submits the form, allowing them then to choose the items they desire.

The datasource for SearchAndSelect is provided by an implentation of the SearchAndSelectModel interface. SAMPLE IMPLEMENTATION GOES HERE

Since:
4.5
Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/form/SearchAndSelect.java#9 $
Author:
Patrick McNeill

Field Summary
protected  boolean m_isMultiple
           
protected  boolean m_isOptional
           
protected  boolean m_isSearchLocked
           
protected  SearchAndSelectListener m_listener
           
protected  int m_maxViewableResults
           
protected  String m_name
           
protected  String m_oldValue
           
protected  Hidden m_oldValueWidget
           
protected  Widget m_outputSelectWidget
           
protected  TextField m_outputTextWidget
           
protected  String m_query
           
protected  SearchAndSelectModel m_results
           
protected  Object m_this
           
protected  boolean m_useCheckboxes
           
protected  String m_value
           
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.FormSection
m_formModel, m_panel
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.util.BebopConstants
BEBOP_BORDER, BEBOP_BOXPANEL, BEBOP_CELL, BEBOP_CHECKBOX, BEBOP_CHECKBOXGROUP, BEBOP_COLUMNPANEL, BEBOP_DATE, BEBOP_DATETIME, BEBOP_DHTMLEDITOR, BEBOP_FORMERRORS, BEBOP_FORMWIDGET, BEBOP_GRIDPANEL, BEBOP_LIST, BEBOP_MULTISELECT, BEBOP_OPTION, BEBOP_PAD, BEBOP_PADFRAME, BEBOP_PANELROW, BEBOP_PORTAL, BEBOP_PORTLET, BEBOP_RADIO, BEBOP_RADIOGROUP, BEBOP_SEG_BODY, BEBOP_SEG_HEADER, BEBOP_SEG_PANEL, BEBOP_SEGMENT, BEBOP_SELECT, BEBOP_TABLE, BEBOP_TABLEBODY, BEBOP_TABLEROW, BEBOP_TEXTAREA
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
SearchAndSelect(String name)
          Create a new SearchAndSelect widget to select a single value.
SearchAndSelect(String name, boolean isMultiple)
          Create a new SearchAndSelect widget with the specified name and SearchAndSelectModel.
SearchAndSelect(String name, boolean isMultiple, boolean useCheckboxes)
          Create a new SearchAndSelect widget with the specified name and SearchAndSelectModel.
 
Method Summary
protected  void generateErrors(PageState state, Element parent)
          Generate the error messages for this widget.
 void generateXML(PageState state, Element parent)
          Generates the XML datastructure for this widget.
 String getName()
          Get the name of the widget.
 String getType()
          Determine the type of HTML form element to create.
 boolean isCompound()
          Indicates if the widget is composed of multiple HTML elements.
 boolean isMultiple()
          Determine if this is a multiple select widget, or single select.
 boolean isOptional()
          Determine if this is an optional widget
 void prepare(PrintEvent e)
          Prepare the target component returned by e.getTarget() for output.
 SearchAndSelect setOptional(boolean isOptional)
          Specify whether or not the widget is optional.
 void setSearchAndSelectListener(SearchAndSelectListener listener)
           
 
Methods inherited from class com.arsdigita.bebop.FormSection
add, add, addCancelListener, addInitListener, addProcessListener, addSubmissionListener, addValidationListener, children, contains, createInitListener, createProcessListener, createSubmissionListener, createValidationListener, fireCancel, fireInit, fireProcess, fireSubmitted, fireValidate, forwardInit, forwardProcess, forwardSubmission, forwardValidation, get, getModel, getPanel, indexOf, isEmpty, lock, process, register, removeCancelListener, removeInitListener, removeProcessListener, removeSubmissionListener, removeValidationListener, respond, size
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, register, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

m_name

protected String m_name

m_value

protected String m_value

m_query

protected String m_query

m_maxViewableResults

protected int m_maxViewableResults

m_results

protected SearchAndSelectModel m_results

m_listener

protected SearchAndSelectListener m_listener

m_isMultiple

protected boolean m_isMultiple

m_useCheckboxes

protected boolean m_useCheckboxes

m_isOptional

protected boolean m_isOptional

m_this

protected Object m_this

m_outputTextWidget

protected TextField m_outputTextWidget

m_outputSelectWidget

protected Widget m_outputSelectWidget

m_oldValueWidget

protected Hidden m_oldValueWidget

m_oldValue

protected String m_oldValue

m_isSearchLocked

protected boolean m_isSearchLocked
Constructor Detail

SearchAndSelect

public SearchAndSelect(String name)
Create a new SearchAndSelect widget to select a single value.

Parameters:
name - the name of the widget

SearchAndSelect

public SearchAndSelect(String name,
                       boolean isMultiple)
Create a new SearchAndSelect widget with the specified name and SearchAndSelectModel.

Parameters:
name - the name of the widget
isMultiple - whether or not the widget accepts multiple values

SearchAndSelect

public SearchAndSelect(String name,
                       boolean isMultiple,
                       boolean useCheckboxes)
Create a new SearchAndSelect widget with the specified name and SearchAndSelectModel.

Parameters:
name - the name of the widget
isMultiple - whether or not the widget accepts multiple values
useCheckboxes - use checkboxes or a multiselect
Method Detail

prepare

public void prepare(PrintEvent e)
Description copied from interface: PrintListener
Prepare the target component returned by e.getTarget() for output. The target component is an unlocked clone of the source of the event and can be freely modified within this method.

Specified by:
prepare in interface PrintListener
Parameters:
e - Event containing the page state, the source and the target of the event
See Also:
PrintEvent

setSearchAndSelectListener

public final void setSearchAndSelectListener(SearchAndSelectListener listener)

getName

public final String getName()
Get the name of the widget.

Returns:
the name of the widget

getType

public String getType()
Determine the type of HTML form element to create. This will not necessarily be accurate until generateWidget is called as the query will be unavailable until that point.

Returns:
"text" or "select" depending on the result size

isMultiple

public final boolean isMultiple()
Determine if this is a multiple select widget, or single select.

Returns:
boolean -- true for multiple, false for single

isOptional

public final boolean isOptional()
Determine if this is an optional widget

Returns:
true for optional, false otherwise

setOptional

public SearchAndSelect setOptional(boolean isOptional)
Specify whether or not the widget is optional.

Parameters:
isOptional - true for optional, false for required

isCompound

public boolean isCompound()
Indicates if the widget is composed of multiple HTML elements. Always returns true, as the widget makes use of a hidden element and another element.

Returns:
true

generateXML

public void generateXML(PageState state,
                        Element parent)
Generates the XML datastructure for this widget. Adds a hidden, a textbox, checkbox group, or select, and possibly some number of formErrors.

Specified by:
generateXML in interface Component
Overrides:
generateXML in class FormSection
Parameters:
state - the state of the page
parent - the parent widget

generateErrors

protected void generateErrors(PageState state,
                              Element parent)
Generate the error messages for this widget. This widget has some specialized error messages, so it is necessary to override the default error generator. Basically, the m_results field won't be available outside this class, so this needs to be internal.

Parameters:
state - the state of the page
parent - the parent widget


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC