|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--com.opmath.util.datastruct.OrderedHashtable
|
+--com.opmath.util.datastruct.UCHashtable
|
+--com.opmath.util.datastruct.ComparableTable
|
+--com.opmath.util.html.Radio
A representation of an HTML <INPUT TYPE="radio" ...> structure, compatible with
com.opmath.util.datastruct.ComparableTable.
The Radio class addresses the problem of regenerating a <INPUT TYPE="radio" ...>
structure - with the CHECKED tag parameter set on the correct tag. The Radio
structure carries four com.opmath.util.datastruct.ComparableLists, one for each of the three 'dimensions'
of the <INPUT TYPE="radio"...> tags: NAME, VALUE, descriptive text and optional CHECKED.
To use Radio, first create an instance; the minimum specification for this is a
String[] of names:
String[] myNames = { "Natasha", "Bruno", "Mathew" };
String[] myTexts = { "Natasha is the best programmer.", "Bruno is the best programmer.", "Mathew is the best programmer." };
Select myRadioGroup = new Radio("peopleRadio", myNames, myTexts);
To set one of these as SELECTED, do:
myRadioGroup.check("Bruno");
To add the result to the document's model, do:
model.register(myRadioGroup);
This last line assumes that the model contains the substitution sources 'peopleNames', 'peopleValues' and 'peopleSelect'. In other words, the HTML template contains something like:
<!-- SUB peopleRadioNames SUB_PEOPLERADIO_NAMES -->
<!-- SUB peopleRadioValues SUB_PEOPLERADIO_VALUES -->
<!-- SUB peopleRadioText SUB_PEOPLERADIO_TEXT -->
<!-- SUB peopleRadioChecked SUB_PEOPLERADIO_CHECKED -->
...
<!-- LOOP -->
<TD>
<INPUT TYPE="radio" NAME="SUB_PEOPLERADIO_NAMES" VALUE="SUB_PEOPLERADIO_VALUES" SUB_PEOPLERADIO_CHECKED>SUB_PEOPLERADIO_TEXT
</TD>
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
| Inner classes inherited from class java.util.Map |
Map.Entry |
| Constructor Summary | |
Radio(String id,
String[] texts,
String[] values)
Constructs a new Radio instance with each VALUE sourced
from the parameter values. |
|
Radio(String id,
String[] texts,
String[] values,
int checkedIndex)
Constructs a new Radio instance with each VALUE sourced from the parameter
values, and each text sourced from the parameter
texts[i]. |
|
| Method Summary | |
void |
checkValue(Comparable value)
Sets the element whose VALUE is equal to value to "CHECKED". |
void |
clear()
Sets all the elements' status to "" (not "CHECKED"). |
| Methods inherited from class com.opmath.util.datastruct.ComparableTable |
addColumn, addColumn, appendObject, appendTo, columnSize, getAt, getColumn, getColumns, getRows, maxColumnSize, register, register, register, registerColumn, sort, sort, toString, updateAt, updateColumn |
| Methods inherited from class com.opmath.util.datastruct.UCHashtable |
normalized |
| Methods inherited from class com.opmath.util.datastruct.OrderedHashtable |
containsKey, elements, get, keys, put, putAll, remove |
| Methods inherited from class java.util.Hashtable |
|
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Radio(String id,
String[] texts,
String[] values)
throws ComparableTableException
Radio instance with each VALUE sourced
from the parameter values. The RADIO structure is named id.
The RADIO structure will contain as many elements as there are elements in
values. Each element has VALUE values[i] and text texts[i]. All the
elements in values must be unique. Initially,
none of the the OPTION elements are set to CHECKED.
id - the String for the id.texts - the String[] for the elements' texts.values - the String[] for the elements' values.com.opmath.util.http.ComparableTableException - An exception thrown if
the names is null or names and texts are of different lengths,
or there are non-unique elements in values.
public Radio(String id,
String[] texts,
String[] values,
int checkedIndex)
throws ComparableTableException
Radio instance with each VALUE sourced from the parameter
values, and each text sourced from the parameter
texts[i]. The structure is named id.
The int parameter checked specifies which element is
initially set to "CHECKED". The value of checked must be
greater or equal to 0 and less than the length of each array parameter.
All the elements in values must be unique.
id - the String for the id.texts - the String[] for the elements' texts.values - the String[] for the elements' values.checked - the int specifying the element to be CHECKED.com.opmath.util.http.ComparableTableException - An exception thrown if
names, values or selected is null,
if or there is a length mismatch of values / texts, or there are non-unique
elements in values.| Method Detail |
public void checkValue(Comparable value)
throws ComparableTableException
value to "CHECKED". Any
previously checked element is cleared.
All the OPTION element VALUEs in a Select should be unique. However, if
value identifies a non-unique element, then only the first matching element
is updated.
value - the Comparable identifying the OPTION element.com.opmath.util.http.ComparableTableException - An exception thrown if
value is null, or value is not in this
Radio instance.public void clear()
"" (not "CHECKED").
clear in class ComparableTable
|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||