com.sas.servlet.beans.html
Class Checkbox

java.lang.Object
  |
  +--com.sas.Component
        |
        +--com.sas.servlet.beans.BaseTransformation
              |
              +--com.sas.servlet.beans.BaseCheckbox
                    |
                    +--com.sas.servlet.beans.html.Checkbox

public class Checkbox
extends BaseCheckbox

Transformation bean for creating an HTML checkbox.

Problem: Create a document using JSP that contains a checkbox.

Solution: Write a Java scriptlet in a JSP page that uses the Checkbox Transformation Bean to create the HTML element.

JSP Page:

 <html>
 <body>
 
 <p> This example shows a simple checkbox generated by the Checkbox Transformation Bean. </p>
 <FORM>
 <%
    // Create a new checkbox object
    com.sas.servlet.beans.CheckboxInterface checkbox = 
       new com.sas.servlet.beans.html.Checkbox(); 

checkbox.setName("checkbox1"); checkbox.setSelected(true); checkbox.setValue("checked"); checkbox.setLabel("My new Checkbox"); checkbox.write(out); %> </FORM> </body> </html>

HTML output:

 <html>
 <body>
 
 <p> This example shows a simple checkbox field generated by the Checkbox Transformation Bean. </p>
 <FORM>
 <INPUT TYPE=checkbox NAME="checkbox1" VALUE="checked" CHECKED> My new Checkbox
 </FORM>
 </body>
 </html>
 

Live element:

My new Checkbox

See Also:
Serialized Form

Constructor Summary
Checkbox()
          Constructs a new Checkbox Transformation Bean
Checkbox(String name)
          Constructs a new Checkbox Transformation Bean
Checkbox(String name, String label)
          Constructs a new Checkbox Transformation Bean
Checkbox(String name, String label, boolean selected)
          Constructs a new Checkbox Transformation Bean
Checkbox(String name, String label, boolean selected, String value)
          Constructs a new Checkbox Transformation Bean
 
Method Summary
 void write(PrintWriter out)
          Writes the transformed representation of the object
 
Methods inherited from class com.sas.servlet.beans.BaseCheckbox
getLabel, getSelected, getValue, setLabel, setSelected, setValue
 
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, getRequiredInterfaces, 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

Checkbox

public Checkbox()
Constructs a new Checkbox Transformation Bean

Checkbox

public Checkbox(String name)
Constructs a new Checkbox Transformation Bean
Parameters:
name - The checkbox name

Checkbox

public Checkbox(String name,
                String label)
Constructs a new Checkbox Transformation Bean
Parameters:
name - The checkbox name
label - The initial text associated with an on checkbox

Checkbox

public Checkbox(String name,
                String label,
                boolean selected)
Constructs a new Checkbox Transformation Bean
Parameters:
name - The checkbox name
label - The initial text associated with an on checkbox
selected - The initial state of the checkbox

Checkbox

public Checkbox(String name,
                String label,
                boolean selected,
                String value)
Constructs a new Checkbox Transformation Bean
Parameters:
name - The checkbox name
label - The initial text to be displayed with the checkbox
selected - The initial state of the checkbox
value - The initial value associated with an on checkbox
Method Detail

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