|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sas.Component | +--com.sas.servlet.beans.BaseTransformation | +--com.sas.servlet.beans.BaseRadio | +--com.sas.servlet.beans.wml.Radio
Transformation bean for creating a WML Radio field, which is used for attributes which can take a single value from a set of alternatives.
The Radio Transformation Bean gathers the alternatives from various models via the setModelInterface method. A model must implement the com.sas.collection.StaticOrderedCollection interface in order to be used.
Problem: Create a document using JSP that contains a radio field.
Solution: Write a Java scriptlet in a JSP page that uses the Radio Transformation Bean to create the WML element.
JSP Page:
<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card> <p> <% response.setContentType("text/vnd.wap.wml"); // Create a new radio object com.sas.servlet.beans.RadioInterface radio = new com.sas.servlet.beans.wml.Radio();
// Create the model com.sas.collection.StringCollection model = new com.sas.collection.StringCollection(); model.add("Red"); model.add("Green"); model.add("Orange");
// Set the model radio.setModelInterface(model);
// Set the index of the selected item (0-based) radio.setSelectedIndex(1);
// Output the radio button radio.write(out); %> </p> </card> </wml>
Browser WML Radio:
BaseRadio
Constructor Summary | |
Radio()
Construct a new Radio input field |
|
Radio(String name,
ModelInterface model)
Construct a new Radio input field with a default name and model |
Method Summary | |
String |
getIndexName()
Gets the name of the WML variable that is used to store the selectedIndex. |
StaticOrderedCollectionInterface |
getOnPickModel()
Gets the model to be used for the destinations of the radio options. |
String |
getTitle()
Gets the title to be displayed for this bean. |
boolean |
isBreak()
Gets the flag indicating whether to force a break after each input field. |
void |
setBreak(boolean value)
Forces a break after each input field. |
void |
setIndexName(String value)
Sets the name of the WML variable that is used to store the selectedIndex. |
void |
setOnPickModel(StaticOrderedCollectionInterface model)
Sets the model to be used for the destinations of the radio options. |
void |
setTitle(String value)
Sets the title to be displayed for this bean. |
void |
write(PrintWriter out)
Writes the transformed representation of the object |
Methods inherited from class com.sas.servlet.beans.BaseRadio |
getDescriptionModel,
getRequiredInterfaces,
getSelectedIndex,
getSelectedItem,
isSelected,
isSelected,
setDescriptionModel,
setSelectedIndex,
setSelectedItem |
Methods inherited from class com.sas.servlet.beans.BaseTransformation |
getCustomAttributes,
getDescription,
getName,
getParent,
getRequest,
getResponse,
setCustomAttributes,
setDescription,
setName,
setParent,
setRequest,
setResponse,
toString,
write,
write,
write |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Radio()
public Radio(String name, ModelInterface model)
name
- The field namemodel
- The model for the radio alternativesMethod Detail |
public void setOnPickModel(StaticOrderedCollectionInterface model)
model
- The collection to use for the destinationspublic StaticOrderedCollectionInterface getOnPickModel()
public void setTitle(String value)
title
- The string to be displayed as the titlepublic String getTitle()
public void setIndexName(String value)
indexName
- The name of the WML variable used to store the selectedIndexpublic String getIndexName()
public void setBreak(boolean value)
break
- Set to true to force a line break after each input fieldpublic boolean isBreak()
public void write(PrintWriter out) throws IOException
out
- The output stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |