All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.servlet.tbeans.models
Class Item

    com.sas.servlet.tbeans.models.Item

All Implemented Interfaces:
  ItemInterface

Direct Known Subclasses:
  JavaScriptNode

    public class Item

implements ItemInterface

`Item` is a generic implementation of `ItemInterface`.

`Item` is used to construct an item that has text and a return value.

`Item` is the base class for `JavaScriptNode`.

`Item` is commonly used in a ChoiceBox, ListBox, and Radio to replace the need for having to specify two models ( Model and DescriptionModel) in order to have the components display one text while returning another.

Problem: Create a document using JSP that contains a ChoiceBox input field populated with items.

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

JSP Page:

     <html>
     <body>

     <p> This example shows a simple choicebox generated by the ChoiceBox Transformation Bean. </p>
     <form>
     <%
        // Create a new choicebox object
        com.sas.servlet.tbeans.form.html.ChoiceBox choicebox =
            new com.sas.servlet.tbeans.form.html.ChoiceBox();

              //Create the Items
        com.sas.servlet.tbeans.models.Item item1 =
                      new com.sas.servlet.tbeans.models.Item();
        item1.setText("Red");
              item1.setValue("R");

        com.sas.servlet.tbeans.models.Item item2 =
                      new com.sas.servlet.tbeans.models.Item();
        item2.setText("Green");
              item2.setValue("G");

              com.sas.servlet.tbeans.models.Item item3 =
                      new com.sas.servlet.tbeans.models.Item();
        item3.setText("Orange");
              item3.setValue("O");

        // Create the model
        javax.swing.ComboBoxModel model =
            new javax.swing.DefaultComboBoxModel();
        ((javax.swing.DefaultComboBoxModel)model).addElement(item1);
        ((javax.swing.DefaultComboBoxModel)model).addElement(item2);
        ((javax.swing.DefaultComboBoxModel)model).addElement(item3);

        // Set the model
        choicebox.setModel(model);

        // Set the selected index
        choicebox.setSelectedIndex(1);

        // Output the select
        choicebox.write(out);
     %>
     </form>
     </body>
     </html>

HTML output:

     <html>
     <body>

     <p> This example shows a simple choicebox generated by the ChoiceBox Transformation Bean. </p>
     <select name="ChoiceBox" size="1">
     <option value="R">Red</option>
     <option selected="selected" value="G">Green</option>
     <option value="O">Orange</option>
     </select>
     </body>
     </html>

Live element:

Constructor Summary
`Item()` Construct a new Item
`Item(java.lang.String text)` Construct a new Item with text
`Item(java.lang.String text, java.lang.String value)` Construct a new Item with text and value

Method Summary
`java.lang.String` | `getName()` Gets the name that will be used to identify the Item
`java.lang.String` | `getOnBlur()` Gets the onBlur value.
`java.lang.String` | `getOnChange()` Gets the onChange value.
`java.lang.String` | `getOnClick()` Gets the onClick value.
`java.lang.String` | `getOnFocus()` Gets the onFocus value.
`java.lang.String` | `getOnKeyDown()` Gets the onKeyDown value
`java.lang.String` | `getOnKeyPress()` Gets the onKeyPress value
`java.lang.String` | `getOnKeyUp()` Gets the onKeyUp value
`java.lang.String` | `getOnMouseDown()` Gets the onMouseDown value
`java.lang.String` | `getOnMouseOut()` Gets the onMouseOut value.
`java.lang.String` | `getOnMouseOver()` Gets the onMouseOver value.
`java.lang.String` | `getOnMouseUp()` Gets the onMouseUp value
`java.lang.String` | `getText()` Gets the text of the Item.
`java.lang.String` | `getValue()` Gets the return value for the Item.
`boolean` | `isSelected()` Gets the selected property of the Item.
`void` | `setName(java.lang.String value)` Sets the name that will be used to identify the Item
`void` | `setOnBlur(java.lang.String value)` Sets the onBlur event for the item.
`void` | `setOnChange(java.lang.String value)` Sets the onChange event for the item.
`void` | `setOnClick(java.lang.String value)` Sets the onClick event for the item.
`void` | `setOnFocus(java.lang.String value)` Sets the onFocus event for the item.
`void` | `setOnKeyDown(java.lang.String value)` Sets the onKeyDown event for the item.
`void` | `setOnKeyPress(java.lang.String value)` Sets the onKeyPress event for the item.
`void` | `setOnKeyUp(java.lang.String value)` Sets the onKeyUp event for the item.
`void` | `setOnMouseDown(java.lang.String value)` Sets the onMouseDown event for the item.
`void` | `setOnMouseOut(java.lang.String value)` Sets the onMouseOut event for the item.
`void` | `setOnMouseOver(java.lang.String value)` Sets the onMouseOver event for the item.
`void` | `setOnMouseUp(java.lang.String value)` Sets the onMouseUp event for the item.
`void` | `setSelected(boolean b)` Sets the selected property (boolean).
`void` | `setText(java.lang.String value)` Sets the text of the Item.
`void` | `setValue(java.lang.String value)` Sets the return value for the Item.
`java.lang.String` | `toString()` Returns the value of the text property.

Constructor Detail

### Item

    public Item()

  Construct a new Item

### Item

    public Item(java.lang.String text)

  Construct a new Item with text

  Parameters:
    `text` - The Item's text

### Item

    public Item(java.lang.String text,
                java.lang.String value)

  Construct a new Item with text and value

  Parameters:
    `text` - The Item's text
    `value` - The Item's return value

Method Detail

### setName

    public void setName(java.lang.String value)

  Sets the name that will be used to identify the Item

  Parameters:
    `value` - The name used to identify the Item

### getName

    public java.lang.String getName()

  Gets the name that will be used to identify the Item

  Returns:
    The name used to identify the Item

### setText

    public void setText(java.lang.String value)

  Sets the text of the Item. The text is the description text that will be visible to the user.

  Specified by:
    `setText` in interface `ItemInterface`
  Parameters:
    `value` - The text the Item displays

### getText

    public java.lang.String getText()

  Gets the text of the Item.

  Specified by:
    `getText` in interface `ItemInterface`
  Returns:
    The text the Item displays

### setValue

    public void setValue(java.lang.String value)

  Sets the return value for the Item.

  Specified by:
    `setValue` in interface `ItemInterface`
  Parameters:
    `value` - The return value

### getValue

    public java.lang.String getValue()

  Gets the return value for the Item.

  Specified by:
    `getValue` in interface `ItemInterface`
  Returns:
    The return value for the Item

### toString

    public java.lang.String toString()

  Returns the value of the text property.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the value of the text property

### setSelected

    public void setSelected(boolean b)

  Sets the selected property (boolean). The selected String specifies whether or not the item is selected. Valid values are: true or false.

  Parameters:
    `selected` - Specifies whether or not the item is selected.

### isSelected

    public boolean isSelected()

  Gets the selected property of the Item.

  Returns:
    Whether or not the Item is selected

### setOnBlur

    public void setOnBlur(java.lang.String value)

  Sets the onBlur event for the item. The onBlur event handler executes the specified JavaScript code or function on the occurance of a blur event. This is when a item loses focus. This can be caused by the user clicking outside of the item, by using the TAB key to cycle through the various elements on screen, or a call to the blur method on the item.

  Specified by:
    `setOnBlur` in interface `ItemInterface`
  Parameters:
    `value` - The onBlur event

### getOnBlur

    public java.lang.String getOnBlur()

  Gets the onBlur value.

  Specified by:
    `getOnBlur` in interface `ItemInterface`
  Returns:
    The onBlur event

### setOnChange

    public void setOnChange(java.lang.String value)

  Sets the onChange event for the item. The onChange event handler executes the specified JavaScript code or function on the occurance of a change event. This is when the data in item is altered by the user. This is used frequently to validate the data that has been entered by the user by calling a specified JavaScript function.

  Specified by:
    `setOnChange` in interface `ItemInterface`
  Parameters:
    `value` - The onChange event

### getOnChange

    public java.lang.String getOnChange()

  Gets the onChange value.

  Specified by:
    `getOnChange` in interface `ItemInterface`
  Returns:
    The onChange event

### setOnClick

    public void setOnClick(java.lang.String value)

  Sets the onClick event for the item. The onClick event handler executes the specified JavaScript code or function on the occurance of a click event.

  Specified by:
    `setOnClick` in interface `ItemInterface`
  Parameters:
    `value` - The onClick event

### getOnClick

    public java.lang.String getOnClick()

  Gets the onClick value.

  Specified by:
    `getOnClick` in interface `ItemInterface`
  Returns:
    The onClick event

### setOnFocus

    public void setOnFocus(java.lang.String value)

  Sets the onFocus event for the item. The onFocus event handler executes the specified JavaScript code or function on the occurance of a focus event. This is when an item is given focus. This can be caused by the user clicking on the item, by using the TAB key to cycle through the various elements on screen, or by a call to the focus method on the item.

  Specified by:
    `setOnFocus` in interface `ItemInterface`
  Parameters:
    `value` - The onFocus event

### getOnFocus

    public java.lang.String getOnFocus()

  Gets the onFocus value.

  Specified by:
    `getOnFocus` in interface `ItemInterface`
  Returns:
    The onFocus event

### setOnMouseOut

    public void setOnMouseOut(java.lang.String value)

  Sets the onMouseOut event for the item. The onMouseOut event handler is used to execute specified Javascript code whenever the user moves the mouse out of an item from inside that item.

  Specified by:
    `setOnMouseOut` in interface `ItemInterface`
  Parameters:
    `value` - The onMouseOut event

### getOnMouseOut

    public java.lang.String getOnMouseOut()

  Gets the onMouseOut value.

  Specified by:
    `getOnMouseOut` in interface `ItemInterface`
  Returns:
    The onMouseOut event

### setOnMouseOver

    public void setOnMouseOver(java.lang.String value)

  Sets the onMouseOver event for the item. The onMouseOver event handler is used to execute specified Javascript code whenever the user moves the mouse over an item from outside that item.

  Specified by:
    `setOnMouseOver` in interface `ItemInterface`
  Parameters:
    `value` - The onMouseOver event

### getOnMouseOver

    public java.lang.String getOnMouseOver()

  Gets the onMouseOver value.

  Specified by:
    `getOnMouseOver` in interface `ItemInterface`
  Returns:
    The onMouseOver event

### setOnMouseDown

    public void setOnMouseDown(java.lang.String value)

  Sets the onMouseDown event for the item. The onMouseDown event handler is used to execute specified Javascript code whenever the user depresses a mouse button.

  Specified by:
    `setOnMouseDown` in interface `ItemInterface`
  Parameters:
    `value` - The onMouseDown event

### getOnMouseDown

    public java.lang.String getOnMouseDown()

  Gets the onMouseDown value

  Specified by:
    `getOnMouseDown` in interface `ItemInterface`
  Returns:
    The onMouseDown event

### setOnMouseUp

    public void setOnMouseUp(java.lang.String value)

  Sets the onMouseUp event for the item. The onMouseUp event handler is used to execute specified JavaScript code whenever the user releases the mouse button.

  Specified by:
    `setOnMouseUp` in interface `ItemInterface`
  Parameters:
    `value` - The onMouseUp event

### getOnMouseUp

    public java.lang.String getOnMouseUp()

  Gets the onMouseUp value

  Specified by:
    `getOnMouseUp` in interface `ItemInterface`
  Returns:
    The onMouseUp event

### setOnKeyDown

    public void setOnKeyDown(java.lang.String value)

  Sets the onKeyDown event for the item. The onKeyDown event handler executes the specified JavaScript code or function on the occurance of a KeyDown event. A KeyDown event occurs when the user depresses a key.

  Specified by:
    `setOnKeyDown` in interface `ItemInterface`
  Parameters:
    `value` - The onKeyDown event

### getOnKeyDown

    public java.lang.String getOnKeyDown()

  Gets the onKeyDown value

  Specified by:
    `getOnKeyDown` in interface `ItemInterface`
  Returns:
    The onKeyDown event

### setOnKeyPress

    public void setOnKeyPress(java.lang.String value)

  Sets the onKeyPress event for the item. The onKeyPress event handler executes the specified JavaScript code or function on the occurance of a KeyPress event. A KeyPress event occurs when the user presses or holds down a key.

  Specified by:
    `setOnKeyPress` in interface `ItemInterface`
  Parameters:
    `value` - The onKeyPress event

### getOnKeyPress

    public java.lang.String getOnKeyPress()

  Gets the onKeyPress value

  Specified by:
    `getOnKeyPress` in interface `ItemInterface`
  Returns:
    The onKeyPress event

### setOnKeyUp

    public void setOnKeyUp(java.lang.String value)

  Sets the onKeyUp event for the item. The onKeyUp event handler executes the specified JavaScript code or function on the occurance of a KeyUp event. A KeyUp event occurs when the user releases a key from its depressed position.

  Specified by:
    `setOnKeyUp` in interface `ItemInterface`
  Parameters:
    `value` - The onKeyUp event

### getOnKeyUp

    public java.lang.String getOnKeyUp()

  Gets the onKeyUp value

  Specified by:
    `getOnKeyUp` in interface `ItemInterface`
  Returns:
    The onKeyUp event

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.