SilverStream
Application Server 3.5

com.sssw.rt.tview
Class AgoColumnButtonRadio

java.lang.Object
 |
 +--com.sssw.rt.tview.AgoColumnBase
       |
       +--com.sssw.rt.tview.AgoColumnButtonRadio

public class AgoColumnButtonRadio
extends AgoColumnBase

AgoColumnButtonRadio is a bound column that represents a single database column or a variable. A set of such columns allow users to select a single value from a limited set of values. They can represent any data type. Radio button columns, unlike check box columns, generally operate as a group, so only one of the group can be selected at a time.

Follow these steps to create a group of radio buttons:

  1. For each column in the group, call initColumnRadioProperty() with the same property name
  2. For each column in the group, call setGroup() with the same group name
  3. On each column, call setDisplayText() with the text to be shown next to the button
  4. On each column, call setPressedValue()


Constructor Summary
AgoColumnButtonRadio(int width, boolean visible, boolean transparent, Color backgroundColor, int borderType)
           
 
Method Summary
 Color getColor()
          Returns the column's text color.
 String getDisplayText()
          Returns the String representing the column's label.
 AgoFontIdentifier getFontIdentifier()
          Returns the SilverStream font object (AgoFontIdentifier) for column's text.
 String getGroup()
          Returns name of the radio button group or null if the button is not part of a group.
 Object getPressedValue()
          Returns the value that is written to the database when the radio button is pressed.
 String getPropertyName()
          Returns the name of the database column whose value will be changed when the button is pressed.
 void initColumnRadioProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)
          Sets up a number of parameters for the radio button column.
 void setColor(Color color)
          Sets the column's text color.
 void setDisplayText(String text)
          Sets the column's label text.
 void setFontIdentifier(AgoFontIdentifier fontid)
          Sets the SilverStream font object (AgoFontIdentifier) for the column's text.
 void setGroup(String group)
          Sets the radio button group.
 void setPressedValue(Object value)
          Sets the value that is written to the database when this radio button is pressed.
 void setPropertyName(String propertyName)
          Sets the name of the database column whose value will be changed when this button is pressed.
 
Methods inherited from class com.sssw.rt.tview.AgoColumnBase
getAlignment, getBackgroundColor, getBorderType, getDisplayWidth, getHidden, getResizable, getSelectable, getTransparent, getVisible, getWidth, isWidthFixed, setAlignment, setBackgroundColor, setBorderType, setFixedWidth, setHidden, setProportionalWidth, setProportionalWidth, setResizable, setSelectable, setTransparent, setVisible, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgoColumnButtonRadio

public AgoColumnButtonRadio(int width,
                            boolean visible,
                            boolean transparent,
                            Color backgroundColor,
                            int borderType)
Parameters:
width - the column width, in pixels
visible - the "visible" property for the column. Set to true to hide the column. If you hide a column, you might also want to hide any headers associated with the column
transparent - the "transparent" property for the column. Set to true to make it transparent
backgroundColor - the java.awt.Color object that specifies the column's background color
borderType - the symbolic constant that specifies the desired border. See AgoColumnBase for the valid types
Example:
     AgoColumnButtonRadio gender = new AgoColumnButtonRadio(120,
                                                            true,
                                                            false,
                                                            Color.green,
                                                            AgoColumnBase.BORDER_NONE);
See Also:
AgoColumnBase
Method Detail

initColumnRadioProperty

public void initColumnRadioProperty(String propertyName,
                                    AgoFontIdentifier fontid,
                                    Color textColor,
                                    int alignment)
Sets up a number of parameters for the radio button column.
Parameters:
propertyName - the name of the database column to which this radio column is bound. The data type of the corresponding database column must be Boolean, or you must also call the setPressedValue() method to specify a constant value (of the appropriate data type) that is written to the database when the column is checked.
fontid - a SilverStream font object (AgoFontIdentifier) for the control's text
textColor - a java.awt.Color object for the control's text
alignment - the alignment constant for the contents of the column. Alignment constants are described in the AgoColumnBase documentation
Example:
     AgoColumnButtonRadio gender = new AgoColumnButtonRadio(120,true, false,Color.green,0);
     gender.initColumnRadioProperty("gender", 
                                     new AgoFontIdentifier("Dialog", 0, 12), 
                                     Color.black, 
                                     AgoColumnBase.ALIGN_LEFT);
     gender.setPressedValue("M");
See Also:
AgoColumnBase, AgoColumnButtonRadio.setPressedValue(Object value), AgoColumnButtonRadio.setPropertyName(String propertyName)

getFontIdentifier

public final AgoFontIdentifier getFontIdentifier()
Returns the SilverStream font object (AgoFontIdentifier) for column's text.
Usage:
The AgoFontIdentifier object consists of three parts: a Font Name, a Font Style and a Font Size.

The Font Style can be one of these values:

            AgoFontIdentifier.PLAIN
            AgoFontIdentifier.BOLD
            AgoFontIdentifier.ITALIC
            AgoFontIdentifier.BOLD + AgoFontIdentifier.ITALIC
           
          The Font Name can be one of these values: Dialog, SansSerif, Serif, Monospaced, Helvetica, TimesRoman, Courier, DialogInput,
          Zapfdingbats. At runtime, Java translates this value to the appropriate font installed on the system. 
Example:
The following code fragment illustrates how to construct a new AgoFontIdentifier object (called newFont) and how to call the getFontIdentifier() method:
             AgoFontIdentifier font;
             font = myColumn.getFontIdentifier();
 
See Also:
AgoFontIdentifier, AgoColumnButtonRadio.setFontIdentifier(AgoFontIdentifier fontid)

setFontIdentifier

public final void setFontIdentifier(AgoFontIdentifier fontid)
Sets the SilverStream font object (AgoFontIdentifier) for the column's text.
Parameters:
fontid - a SilverStream font object
Usage:
The AgoFontIdentifier object consists of three parts: a Font Name, a Font Style and a Font Size.

The Font Name can be one of these values: Dialog, SansSerif, Serif, Monospaced, Helvetica, TimesRoman, Courier, DialogInput, Zapfdingbats.

At runtime, Java translates this value to the appropriate font installed on the system.

The Font Size can be any integer.

The Font Style can be one of these values:

             AgoFontIdentifier.PLAIN
             AgoFontIdentifier.BOLD
             AgoFontIdentifier.ITALIC
             AgoFontIdentifier.BOLD + AgoFontIdentifier.ITALIC
 
Example:
This code fragment illustrates how to construct a new AgoFontIdentifier object (called newFont) and how to call the setFontIdentifier() method:
             AgoFontIdentifier     newFont;
             String                newName;
             int                   newSize;
             int                   newStyle;
            
             newName="TimesRoman";
             newSize=20;
             newStyle=AgoFontIdentifier.ITALIC;
             newFont=new AgoFontIdentifier(newName, newStyle, newSize);
            
             myColumn.setFontIdentifier(newFont);
See Also:
AgoFontIdentifier, AgoColumnButtonRadio.getFontIdentifier()

getColor

public final Color getColor()
Returns the column's text color.
Example:
     Color textColor = myColumn.getColor();
See Also:
AgoColumnButtonRadio.setColor(Color color)

setColor

public final void setColor(Color color)
Sets the column's text color.
Parameters:
color - a java.awt.Color object
Usage:
If you change this value at runtime, you must call the AgcView.setAgoViewFormat() method to repaint the view and make the change immediately visible to the user.
Example:
     myColumn.setColor(Color.green);
See Also:
AgoColumnButtonRadio.setColor(Color color)

getPropertyName

public final String getPropertyName()
Returns the name of the database column whose value will be changed when the button is pressed.
Example:
     String propName = gender.getPropertyName();
See Also:
AgoColumnButtonRadio.setPropertyName(String propertyName), AgoColumnButtonRadio.initColumnRadioProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment), AgoColumnButtonRadio.setPressedValue(Object value)

setPropertyName

public final void setPropertyName(String propertyName)
Sets the name of the database column whose value will be changed when this button is pressed.
Parameters:
propertyName - the data column to bind to
Usage:
Overrides the setting in the initColumnRadioProperty() method The database column must be Boolean. If it is not, you must also call the setPressedValue() method. This allows you to specify a value, of an appropriate data type, to write to the database column when the button is checked. Overrides the data column specified in the initColumnCheckProperty() method.
Example:
     com.sssw.rt.tview.AgoColumnButtonRadio  gender1;
     gender1 = new com.sssw.rt.tview.AgoColumnButtonRadio(100,
                                                          true,
                                                          false,
                                                          Color.white,
                                                          AgoColumnBase.BORDER_NONE);
     gender1.setPropertyName("gender");
     gender1.setPressedValue("M");
See Also:
AgoColumnButtonRadio.getPropertyName(), AgoColumnButtonRadio.setPressedValue(Object value), AgoColumnButtonRadio.initColumnRadioProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)

getPressedValue

public final Object getPressedValue()
Returns the value that is written to the database when the radio button is pressed.
Example:
     empGender =  gender.getPressedValue();
See Also:
AgoColumnButtonRadio.setPressedValue(Object value)

setPressedValue

public final void setPressedValue(Object value)
Sets the value that is written to the database when this radio button is pressed.
Parameters:
value - the value to write to the database column when radio button is pressed. It must be an appropriate data type for the database column.
Usage:
This method must be called when you bind the control to a database column whose data type is not a Boolean. It allows you to write a value of the correct data type to the database column. The radio button will be initially checked if the database value matches the value specified here.
Example:
      gender.setPressedValue("F");
See Also:
AgoColumnButtonRadio.getPressedValue(), AgoColumnButtonRadio.setPropertyName(String propertyName), AgoColumnButtonRadio.initColumnRadioProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)

getDisplayText

public final String getDisplayText()
Returns the String representing the column's label.
Example:
     AgoColumnButtonRadio health = new AgoColumnButtonRadio(120,
                                                            true, 
                                                            false,
                                                            Color.green,
                                                            AgoColumnBase.BORDER_NONE);
     health.initColumnRadioProperty("health", 
                                     new AgoFontIdentifier("Dialog", 0, 12), 
                                     Color.black, 
                                     AgoColumnBase.ALIGN_LEFT);
     health.setDisplayText("Health Insurance");
     String info = health.getDisplayText();

See Also:
AgoColumnButtonRadio.setDisplayText(String text)

setDisplayText

public final void setDisplayText(String text)
Sets the column's label text.
Parameters:
text - the String representing the radio button's label
Usage:
The label is displayed to the right of the radio button. If the column width is shorter than the label, SilverStream displays the number of characters that fit followed by an ellipsis (...)
Example:
     AgoColumnButtonRadio health = new AgoColumnButtonRadio(120,
                                                            true,
                                                            false,
                                                            Color.green,
                                                            AgoColumnBase.BORDER_NONE);
     health.initColumnRadioProperty("health",
                                    new AgoFontIdentifier("Dialog", 0, 12),
                                    Color.black, 
                                    AgoColumnBase.ALIGN_LEFT);
     health.setDisplayText("Health Insurance");
     beneformat.appendColumnFormat(health);
See Also:
AgoColumnButtonRadio.getDisplayText()

getGroup

public final String getGroup()
Returns name of the radio button group or null if the button is not part of a group.
Example:
        String groupName = gender.getGroup();
See Also:
AgoColumnButtonRadio.setGroup(String group)

setGroup

public final void setGroup(String group)
Sets the radio button group.
Parameters:
group - the name of the radio button group
Example:
          gender.setGroup("rb1");
See Also:
AgoColumnButtonRadio.getGroup()

SilverStream
Application Server 3.5