|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.storage.jdbc.JDBCToComboBoxModelAdapter
public class JDBCToComboBoxModelAdapter
The JDBCToComboBoxModelAdapter allows JDBC data sources to be
displayed in any viewer that requires a model of type
javax.swing.ComboBoxModel
, mainly being a javax.swing.JComboBox
.
The adapter requires a java.sql.Connection
object and a query statement.
They can be passed in on the constructor or set via methods.
The setConnection()
method will apply the connection object. The
setQueryStatement()
method will apply the SQL query statement. When
non-null values for both connection and query statement have been
applied, the adapter is initialized and ready to use.
The query statement must be a SQL query that is valid for the JDBC data source. This may include a blank statement, if valid.
The setTemplateText method can be used to control which column values from the result set are displayed in the list. Multiple column values can be used along with text. The template text uses the default marker, open, and close characters from com.sas.util.SimpleTemplate( "%", "(", and ")" ). The column names must be defined in the template text as all uppercase variables. If no template text is defined, only the values from the first column of the result set are used as list items.
The general form of the template text is:
text %COL1 more text %COL2Where COL1 and COL2 are fully uppercased column names. The '%' acts as a delimiter and is not part of the column name.The adapter can be configured and used within a webAF project. Add a
com.sas.storage.jdbc.JDBCConnection
component to your project. Open the customizer and specify the values needed for your JDBC connection.These include driver name and URL. Now open the customizer for the adapter. Specify the value for JDBC Connection using the top combo box. The drop-down list will show all JDBC Connection objects that exist in your project. You can set the properties for query statement, autoCommit, and read-only, as well.
Field Summary | |
---|---|
static java.lang.String |
RB_KEY
|
protected java.lang.Object |
selectedItem
selectedItem for ComboBox |
Fields inherited from class com.sas.storage.jdbc.JDBCToListModelAdapter |
---|
listenerList, mapTransform, templateText |
Fields inherited from class com.sas.storage.jdbc.JDBCColumnValuesAdapter |
---|
columnValuesTransform, retrieveAllColumnValues |
Fields inherited from class com.sas.storage.jdbc.JDBCAdapter |
---|
autoCommit, CLASS_NAME, columnInfoUsed, conn, designTime, displayTransform, forwardOnly, initialized, isRowCountKnown, LABEL, meta, NAME, printWarnings, queryRowCountDisabled, queryStatement, readOnly, result, resultSetRequeryUsed, resultSetType, resultSetUsed, retrieveNumericTypesAsDouble, rowCount, rowCountQueryString, rowNumber, spcs, stmt, trimUsed |
Constructor Summary | |
---|---|
JDBCToComboBoxModelAdapter()
Default constructor called when the adapter is made in a webAF project. |
|
JDBCToComboBoxModelAdapter(java.sql.Connection conn,
java.lang.String queryStatement)
Constructor used to create an initialized adapter. |
|
JDBCToComboBoxModelAdapter(java.sql.ResultSet result)
Constructor used to connect an adapter directly to a previously created ResultSet. |
Method Summary | |
---|---|
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about this JDBCToComboBoxModelAdapter. |
java.lang.Object |
getSelectedItem()
Return the selected item |
void |
setSelectedItem(java.lang.Object anItem)
Set the selected item |
Methods inherited from class com.sas.storage.jdbc.JDBCToListModelAdapter |
---|
addListDataListener, fireCellEvent, fireModelEvent, fireModelEvent, getElementAt, getElementsAt, getSize, getTemplateText, initializeData, removeListDataListener, setTemplateText |
Methods inherited from class com.sas.storage.jdbc.JDBCColumnValuesAdapter |
---|
getColumnValuesMap, getColumnValuesTransform, isRetrieveAllColumnValues, retrieveColumnValueAt, retrieveValueAt, setColumnValuesTransform, setRetrieveAllColumnValues |
Field Detail |
---|
public static final java.lang.String RB_KEY
protected java.lang.Object selectedItem
Constructor Detail |
---|
public JDBCToComboBoxModelAdapter()
public JDBCToComboBoxModelAdapter(java.sql.ResultSet result)
result
- ResultSet to use.public JDBCToComboBoxModelAdapter(java.sql.Connection conn, java.lang.String queryStatement)
conn
- A java.sql.Connection
object.queryStatement
- A SQL query that is valid for the database
represented by conn
.Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public java.lang.Object getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
public void setSelectedItem(java.lang.Object anItem)
setSelectedItem
in interface javax.swing.ComboBoxModel
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |