SilverStream
Application Server 3.5

com.sssw.rt.tview
Class AgoColumnComboBox

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

public class AgoColumnComboBox
extends AgoColumnText

AgoColumnComboBox is a bound column that displays a list of values from which users can browse and select values. You can populate the list from an object that implements AgiRowCursor (like an AgcData) or from a string array.

When the column is bound to an AgiRowCursor column, the value in the database sets the initially selected item in the list. If the user makes a different selection from the ComboBox's list, the selection becomes the value associated with the current row. The selected value is saved to the database when updateRows() is called.


Field Summary
static String DISPLAY_VALUE
          A constant whose value is "Msg".
static String STORAGE_VALUE
          A constant whose value is "Value".
 
Fields inherited from class com.sssw.rt.tview.AgoColumnText
MULTILINE
 
Constructor Summary
AgoColumnComboBox()
           
 
Method Summary
 boolean getEditable()
          Returns the editable property for the column
 boolean getEditWhenSelected()
          Returns the state of the edit when selected property.
 void initColumnComboProperty(String propertyName, AgiRowCursor rc, boolean editable)
          Sets up a number of parameters for comobobox columns loaded from a database table or another AgiRowCursor implementation.
 void initColumnComboProperty(String propertyName, String[] text, Object[] values, boolean editable)
          Sets a number of parameters for combobox columns loaded from String Arrays.
 void setEditable(boolean editable)
          Sets the columns editable property
 void setEditWhenSelected(boolean editWhenSelected)
          Sets the state of the edit when selected property.
 void setListValues(AgiRowCursor rc)
          Sets the AgiRowCursor that will provide the data for the list.
 void setListValues(String[] text, Object[] values)
          Set the arrays that will provide the data for the list.
 
Methods inherited from class com.sssw.rt.tview.AgoColumnText
applyFormat, getAdjustWidthForContent, getColor, getColumnName, getDatatype, getFontIdentifier, getFormatPattern, getFormatStyle, getMaxPointSize, getMinPointSize, getPropertyName, initColumnTextHeader, initColumnTextProperty, setAdjustWidthForContent, setColor, setColumnName, setFontIdentifier, setFormatPattern, setFormatStyle, setMaxPointSize, setMinPointSize, setPropertyName
 
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
 

Field Detail

STORAGE_VALUE

public static final String STORAGE_VALUE
A constant whose value is "Value". If you are populating the ComboBox column from an AgcData, you must define two columns, one named "Msg" and one named "Value". The Msg column provides the data that is displayed to users in the list (for example, CustomerName). The Value column provides the data that is written to the database when a particular item is selected (for example, CustomerID).

DISPLAY_VALUE

public static final String DISPLAY_VALUE
A constant whose value is "Msg". If you are populating the ComboBox column from an AgcData, you must define two columns, one named "Msg" and one named "Value". The Msg column provides the data that is displayed to users in the list (for example, CustomerName). The Value column provides the data that is written to the database when a particular item is selected (for example, CustomerID).
Constructor Detail

AgoColumnComboBox

public AgoColumnComboBox()
Method Detail

initColumnComboProperty

public void initColumnComboProperty(String propertyName,
                                    AgiRowCursor rc,
                                    boolean editable)
Sets up a number of parameters for comobobox columns loaded from a database table or another AgiRowCursor implementation.
Parameters:
propertyName - the name of the database column to which this column is bound
rc - the name of the AgiRowCursor used to populate this column. This AgiRowCursor is not the same row cursor supplied in the AgcView.initView() method. It provides data whose only purpose is to supply the values for the combobox's list.
editable - the editable property for this column (when true the column can be edited)
Usage:
You can set these values individually by calling setListValues() and setEditable().
Example:
     AgoColumnComboBox	state;
     state = new AgoColumnComboBox();
     state.initColumnComboProperty("state", agcState,false);
See Also:
AgoColumnComboBox.initColumnComboProperty(String propertyName, String[] text, Object[] values, boolean editable), AgoColumnComboBox.setListValues(AgiRowCursor rc), AgoColumnComboBox.setEditable(boolean editable)

initColumnComboProperty

public void initColumnComboProperty(String propertyName,
                                    String[] text,
                                    Object[] values,
                                    boolean editable)
Sets a number of parameters for combobox columns loaded from String Arrays.
Parameters:
propertyName - the name of the database column that the storage values are written to
text - the set of text values displayed in the column
values - the set of values written to the database (the storage value). When not specified the text values are stored.
editable - specifies whether the combobox is editable (it is editable when true)
Example:
 
     String sStateNames[] = {"Mass", "Maine"};
     String sStateAbbrevs[] = {"MA", "ME"};

     AgoColumnComboBox  state;
     state = new AgoColumnComboBox();
     state.initColumnComboProperty("states", sStateNames, sStateAbbrevs, false);
See Also:
AgoColumnComboBox.initColumnComboProperty(String propertyName, AgiRowCursor rc, boolean editable)

getEditWhenSelected

public boolean getEditWhenSelected()
Returns the state of the edit when selected property.
Usage:
This property specifies whether the cells in the column are displayed as comboboxes or as text fields. When false, all of the cells in the column are displayed as comboboxes. When true, the cells are displayed as text fields until selected by the user. When selected by the user, the field is displayed as a combobox.

The default is true.

If you are displaying a large data set, setting this to false can slow down the performance of this control.

Example:
     boolean editOnSel = myColumn.getEditWhenSelected();
See Also:
AgoColumnComboBox.setEditWhenSelected(boolean editWhenSelected)

setEditWhenSelected

public void setEditWhenSelected(boolean editWhenSelected)
Sets the state of the edit when selected property.
Parameters:
editWhenSelected - if set to true, cells in the column are displayed as text cells except when selected by the user. Otherwise, cells are always displayed as combobox fields.
Usage:
This property specifies whether the cells in the column are always displayed as comboboxes or as text fields. When false, all of the cells in the column are displayed as comboboxes. When true, the cells are displayed as text fields until selected by the user. When selected by the user, the field is displayed as a combobox.

The default is true.

If you are displaying more than a few rows of data, setting this to false can slow down the performance of this control.

Example:
     myColumn.setEditWhenSelected(true);
See Also:
AgoColumnComboBox.getEditWhenSelected()

setListValues

public final void setListValues(AgiRowCursor rc)
Sets the AgiRowCursor that will provide the data for the list.
Parameters:
rc - the AgiRowCursor that will provide the data. This AgiRowCursor is not the same row cursor supplied in the AgcView.initView() method. It provides data whose only purpose is to supply the values for the combobox's list.
Usage:
The AgiRowCursor must contain two columns named "Msg" and "Value". The Msg column provides the content for the list (the DISPLAY_VALUE). The Value provides the storage value that is written to the database when the corresponding display value is selected (the STORAGE_VALUE).
See Also:
AgoColumnComboBox.setListValues(String[] text, Object[] values)

setListValues

public final void setListValues(String[] text,
                                Object[] values)
Set the arrays that will provide the data for the list.
Parameters:
text - the String Array that provides the values to be displayed in the list (the display value)
values - the Object array that contains the values written to the database when the corresponding display value is selected (the storage value)
Example:
     String sStateNames[] = {"Mass", "New Hampshire"};
     String sStateAbbrevs[] = {"MA", "NH"};
     state.setListValues(sStateNames, sStateAbbrevs);
See Also:
AgoColumnComboBox.setListValues(AgiRowCursor rc)

getEditable

public final boolean getEditable()
Returns the editable property for the column
Usage:
When true, users can type in the text field portion of the combobox
See Also:
AgoColumnComboBox.setEditable(boolean editable)

setEditable

public final void setEditable(boolean editable)
Sets the columns editable property
Parameters:
editable - when true, users can type in the text field portion of the combobox
See Also:
AgoColumnComboBox.getEditable()

SilverStream
Application Server 3.5