|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.raj.htmlForms.HtmlFormElement
|
+--com.raj.htmlForms.HtmlSelect
This class represents the <select> tag of a form. It is a drop down list, with several options. It implements all of the HTML 4.01 Transitional specification.
The population of this drop-down box will come from a data structure containing keys (which act as the value of the <option> tag) and entries which will be the text displayed for that entry.
This class (HtmlSelect.java) is part of the com.raj.htmlForms package that
automatically generates HTML forms programmatically.
CREATED 26-FEB-2002, Copyright (c) Rajnish Bhaskar 2002
| Field Summary |
| Fields inherited from class com.raj.htmlForms.HtmlFormElement |
isXHTML, out |
| Constructor Summary | |
HtmlSelect(java.io.Writer w)
Minimal constructor for any form element. |
|
HtmlSelect(java.io.Writer w,
boolean x)
Constructor that sets the writer and a boolean which determines whether or not XHTML will be written |
|
HtmlSelect(java.io.Writer w,
java.lang.String n)
Constructor that just sets the name of the element |
|
HtmlSelect(java.io.Writer w,
java.lang.String n,
java.util.Map m)
Constructor that just sets the name of the element |
|
| Method Summary | |
java.util.Map |
getEntries()
return the data structure that will populate the select box |
java.lang.String |
getMultiple()
if multiple selection is permitted this is returned, else the empty string |
java.lang.String |
getOnChange()
gets the contents of the Javascript onFocus event. |
java.lang.String |
getSelected()
returns the value of the option that should be selected by default |
java.lang.String |
getSize()
gets the number of rows visible for this select box |
void |
reset()
resets all attributes of the element back to a blank state |
void |
setEntries(java.util.Map x)
sets the data structure from which the select box will be populated |
void |
setMultiple(boolean x)
sets whether or not multiple selection is enabled (note: size must be > 1 for this) |
void |
setOnChange(java.lang.String x)
specifies the content of the Javascript onFocus event. |
void |
setSelected(java.lang.String x)
stores the option in this select group that should be selected by default |
void |
setSize(int x)
sets the number of rows visible for this select box |
java.lang.String |
toString()
Writes the attributes of this object to a string and returns them. |
void |
write()
writes an HTML drop-down box to the given writer, populated by the given data structure |
| Methods inherited from class com.raj.htmlForms.HtmlFormElement |
getDir, getId, getLang, getName, getOnBlur, getOnClick, getOnDblClick, getOnFocus, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnSelect, getStyle, getTabIndex, getTheClass, getTitle, getXhtml, setDir, setId, setLang, setName, setOnBlur, setOnClick, setOnDblClick, setOnFocus, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnSelect, setStyle, setStyle, setTabIndex, setTheClass, setTitle, setXhtml |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public HtmlSelect(java.io.Writer w)
foo becomes setFoo(). The attribute names can be
found at the W3C HTML reference or many other places on the web.
w - the Writer to which all the data will be written out
public HtmlSelect(java.io.Writer w,
boolean x)
w - the Writer to which all the data will be written outx - if true, XHTML will be written, else false
public HtmlSelect(java.io.Writer w,
java.lang.String n)
w - the Writer to which all the data will be written outn - the name of this element
public HtmlSelect(java.io.Writer w,
java.lang.String n,
java.util.Map m)
w - the Writer to which all the data will be written outn - the name of this elementm - the data structure used to populate this select box| Method Detail |
public void setEntries(java.util.Map x)
public java.util.Map getEntries()
public void setSize(int x)
public java.lang.String getSize()
public void setMultiple(boolean x)
public java.lang.String getMultiple()
public void setSelected(java.lang.String x)
public java.lang.String getSelected()
public void setOnChange(java.lang.String x)
public java.lang.String getOnChange()
public void reset()
HtmlFormElement
reset in class HtmlFormElementpublic java.lang.String toString()
HtmlFormElement
The toString() method should logically return a string representing the attributes
of the HTML element, eg if you set the name, title and style of the element then you should return a
string containing:
name="myName" title="some title" style="foo: xxx; bar: yyy;"
The responsibility for turning this into a form deliverable to a user agent belongs to
the write() method.
toString in class HtmlFormElementHtmlFormElement.write()public void write()
write in class HtmlFormElement
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||