com.sas.servlet.beans.wml
Class Radio

java.lang.Object
  |
  +--com.sas.Component
        |
        +--com.sas.servlet.beans.BaseTransformation
              |
              +--com.sas.servlet.beans.BaseRadio
                    |
                    +--com.sas.servlet.beans.wml.Radio

public class Radio
extends BaseRadio

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:

radio1.jpg

BaseRadio

See Also:
Serialized Form

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 com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getExtendedBeanInfo, getLinkInfo, getModelInterface, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Radio

public Radio()
Construct a new Radio input field

Radio

public Radio(String name,
             ModelInterface model)
Construct a new Radio input field with a default name and model
Parameters:
name - The field name
model - The model for the radio alternatives
Method Detail

setOnPickModel

public void setOnPickModel(StaticOrderedCollectionInterface model)
Sets the model to be used for the destinations of the radio options. The browser will navigate to these destinations when an item is selected. There is a one to one relationship between the onPickModel and the radio's contents.
Parameters:
model - The collection to use for the destinations

getOnPickModel

public StaticOrderedCollectionInterface getOnPickModel()
Gets the model to be used for the destinations of the radio options. The browser will navigate to these destinations when an item is selected. There is a one to one relationship between the onPickModel and the radio's contents.
Returns:
The collection to use for the destinations

setTitle

public void setTitle(String value)
Sets the title to be displayed for this bean.
Parameters:
title - The string to be displayed as the title

getTitle

public String getTitle()
Gets the title to be displayed for this bean.

setIndexName

public void setIndexName(String value)
Sets the name of the WML variable that is used to store the selectedIndex.
Parameters:
indexName - The name of the WML variable used to store the selectedIndex

getIndexName

public String getIndexName()
Gets the name of the WML variable that is used to store the selectedIndex.
Returns:
The name of the WML variable used to store the selectedIndex

setBreak

public void setBreak(boolean value)
Forces a break after each input field. Not supported.
Parameters:
break - Set to true to force a line break after each input field
Overrides:
setBreak in class BaseRadio

isBreak

public boolean isBreak()
Gets the flag indicating whether to force a break after each input field. Not supported.
Returns:
True to force a line break after each input field
Overrides:
isBreak in class BaseRadio

write

public void write(PrintWriter out)
           throws IOException
Writes the transformed representation of the object
Parameters:
out - The output stream
Overrides:
write in class BaseTransformation


Version: 1.2.20000317.001 Formatted: 2000/07/06 15:57:33PM