|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdowney.PresetCheckedAndSelected
A class to simplify the presetting of radio groups, checkbox groups and selection lists
| Field Summary | |
protected java.util.HashMap |
mapSelected
The implementation of the map |
| Constructor Summary | |
PresetCheckedAndSelected()
Creates a new instance of PresetCheckedAndSelected |
|
| Method Summary | |
java.lang.String |
getChecked(java.lang.String key)
Retrieve a choice from the map: should be either a radio or checkbox element. |
java.lang.String |
getChoice(java.lang.String key)
Retrieve a choice from the map. |
java.lang.String |
getSelected(java.lang.String key)
Retrieve a choice from the map: should be used in an option for a selection list element. |
void |
initChoice()
Reinitializes the map to empty. |
void |
setChecked(java.lang.String key)
Set a type of "checked" for this entry in the map. |
void |
setChecked(java.lang.String[] keys)
Set a type of "checked" for an array of String keys. |
void |
setChoice(java.lang.String[] keys,
java.lang.String value)
Set a choice in the map: the type is either "checked" or "selected". |
void |
setChoice(java.lang.String key,
java.lang.String value)
Set a choice in the map: the type is either "checked" or "selected". |
void |
setSelected(java.lang.String key)
Set a type of "selected" for this entry in the map. |
void |
setSelected(java.lang.String[] keys)
Set a type of "selected" for an array of String keys. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.HashMap mapSelected
| Constructor Detail |
public PresetCheckedAndSelected()
| Method Detail |
public void initChoice()
public java.lang.String getChoice(java.lang.String key)
Access this from the HTML for the input element
Assume that rec is a record object whose class extends
this class, and that team is a checkbox group.
<input type="checkbox" name="team" value="heat" rec.getChoice("heat")>
key - The value from the input element in the form
public java.lang.String getChecked(java.lang.String key)
Access this from the HTML for the input element
Assume that rec is a record object whose class extends
this class, and that team is a checkbox group.
<input type="checkbox" name="team" value="heat" rec.getChecked("heat")>
key - The value from the input element in the form
public java.lang.String getSelected(java.lang.String key)
Access this from the HTML option for the select element
Assume that rec is a record object whose class extends
this class, and that heat is an option in a multiple selection list.
<option value="heat" rec.getSelected("heat")>
key - The value from the input element in the form
public void setChoice(java.lang.String key,
java.lang.String value)
Usually called with value(s) from the query string
Assume that rec is a record object whose class extends
this class, and that color is a radio group.
rec.setChoice(request.getParamter("color"), "checked");
Call this once for each radio or checkbox group, or selection list
key - The value from the query stringvalue - Either "checked" or "seleted"
public void setChoice(java.lang.String[] keys,
java.lang.String value)
Usually called with value(s) from the query string
Assume that rec is a record object whose class extends
this class, and that team is a checkbox group.
rec.setChoice(request.getParamterValues("team"), "checked");
Call this once for each radio group, checkbox group or selection list
keys - The array of values from the query stringvalue - Either "checked" or "seleted"public void setChecked(java.lang.String key)
Usually called with value(s) from the query string
Assume that rec is a record object whose class extends
this class, and that color is a radio group.
rec.setChecked(request.getParamter("color"));
Call this once for each radio or checkbox group
key - The value from the query stringpublic void setChecked(java.lang.String[] keys)
Usually called with value(s) from the query string
Assume that rec is a record object whose class extends
this class, and that team is a checkbox group.
rec.setChecked(request.getParamterValues("team"));
Call this once for each radio group, checkbox group
keys - The array of values from the query stringpublic void setSelected(java.lang.String key)
Usually called with value(s) from the query string
Assume that rec is a record object whose class extends
this class, and that color is a single selection list.
rec.setSelected(request.getParamter("color"));
Call this once for each selection list
key - The value from the query stringpublic void setSelected(java.lang.String[] keys)
Usually called with value(s) from the query string
Assume that rec is a record object whose class extends
this class, and that team is a multiple selection list.
rec.setSelected(request.getParamterValues("team"));
Call this once for each selection list.
keys - The array of values from the query string
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||