borland Packages Class Hierarchy dx.dataset Package
java.lang.Object +----com.borland.dx.dataset.PickListDescriptor
Constructors Properties Methods
Implements Serializable
The PickListDescriptor
describes a pick list relationship between a Column
of one DataSet
(the target
DataSet), and a second DataSet
(the source
DataSet) that provides values from which you can choose.
To access the PickListDescriptor
in the JBuilder Inspector, select the pickList
property of a Column
component.
The following properties are stored in the PickListDescriptor
:
pickListDataSet
specifies the DataSet
that contains the items to display in the pick list.
pickListDisplayColumns
specifies the Column
components of the DataSet
to display in the pick list.
pickListColumns
specifies the columns of the pickListDataSet
from which values in the selected row are copied to destinationColumns
.
destinationColumns
specifies the Column
components of the target DataSet
that are populated with the values associated with the selected pick list choice.
enforceIntegrity
determines whether data integrity rules are enforced on the data added to destinationColumns
. This property is not currently used.
lookupDisplayColumn
specifies which column to display (field display values) when the source data is not open. This property is used when the displayed items list differs from the values stored when an item is selected.
A dbSwing JdbComboBox
or a JdbTable
bound to a DataSet
containing a Column
that has its pickList
property set displays the pickListDisplayColumns
in a drop-down list when the column is edited.
There are three basic ways to configure the pickList
property, the first two are the more common uses:
pickListDataSet
. The selected values are filled into the specified columns.
For this configuration, set the pickListDataSet
, destinationColumns
(columns to copy to), pickListColumns
(columns to copy from the
pickListDataSet
), and pickListDisplayColumns
(columns values to display
from the pickListDataSet
when the pickList
column is being edited).
"Fill in" and "lookup" display. Provides the same functionality as above, except you can specify a
lookupDisplayColumn
from the pickListDataSet
. This allows you to store
a "code number" code in the column, but display a "code description".
The values from the lookupDisplayColumn
in the pickListDataSet
are
displayed instead of the values stored in the pickListColumns
. A value
to display is chosen by using the current values in destinationColumns
to
locate the row in the pickListDataSet
that has the same values for its
pickListColumns
.
If a match is found, the lookupDisplayColumn
value for that row in the
pickListDataSet
is displayed. Note that the DataSet.setValue()
and getValue()
methods retrieve and set the "real" value stored. To retrieve the display
value for such a column, use the DataSet.getDisplayVariant()
method.
Dynamically created read-only "lookup". This configuration is a little more work to setup, but allows an application to show both the code and code description values dynamically. You can achieve a similar effect with the first configuration above, however, this configuration displays the code description
from the pickListDataSet
. So if the code description is changed in your
pickListDataSet
, that change will be reflected in your DataSet
since this display value is
always "looked up". In the first configuration described above, if the code description changes in
the
pickListDataSet
, your DataSet
will still show the old "fill in" values.
The lookup column is a special calculated column that retrieves its display
values
from the pickListDataSet
. Although the pickList
editor is
activated when edits are attempted on this column, no value can be set on this column.
It always retrieves its values by looking them up in the pickListDataSet
.
The lookup operation uses the same mechanism and properties described in
the second configuration above. To
create a lookup Column
, you must add a Column
to your DataSet
and set
its calcType
property to CalcType.LOOKUP
. Then set the pickList
property much like configuration #2. The only difference is that the lookup column cannot be one of the columns listed in the destinationColumns
property.
For a tutorial on adding a pick list in an application, see "Looking up choices with a pick list" in the Database Application Developer's Guide. For information on removing a pick list, see "Removing a picklist field".
public PickListDescriptor(DataSet pickListDataSet, String[] pickListColumns, String[] pickListDisplayColumns, String[] destinationColumns, boolean enforceIntegrity)Constructs a
PickListDescriptor
object with the properties stated in its parameters.
pickListDataSet
DataSet
object that contains the data for display in the pick list.
pickListColumns
pickListDataSet
from which values in the selected row are copied to the destinationColumns
.
pickListDisplayColumns
Column
components of the DataSet
to display in the pick list. This property is expressed as an array of String
column names. If your pick list contains multiple columns, you must also set the itemEditor
property of the Column
to an instance of the PopupPickListItemEditor
. The default pick list item editor
is the PickListItemEditor
, which can only display a picklist with a single column.
destinationColumns
Column
components that are populated with the values associated with the selected pick list choice. This property is expressed as an array of String
column names.
enforceIntegrity
destinationColumns
.
public PickListDescriptor(DataSet pickListDataSet, String[] pickListColumns, String[] pickListDisplayColumns, String[] destinationColumns, String lookupDisplayColumn, boolean enforceIntegrity)Constructs a
PickListDescriptor
object with the properties stated in its parameters.
pickListDataSet
DataSet
object that contains the data for display in the pick list.
pickListColumns
pickListDataSet
from which values in the selected row are copied to the destinationColumns
.
pickListDisplayColumns
Column
components of the DataSet
to display in the pick list. This property is expressed as an array of String
names.
destinationColumns
Column
components that are populated with the values associated with the selected pick list choice. This property is expressed as an array of String
column names.
lookupDisplayColumn
Column
in the picklistDataSet
to display the column whose pickList property is being set.
enforceIntegrity
destinationColumns
.
public final String[] getDestinationColumns()Read-only property that returns the
String
names of the Column
components that are filled in when an entry in the pick list is selected. Set this property using the PickListDescriptor
constructor. This property is also used for the display of lookup values and if not set, your application
may generate a java.lang.NullPointerException
error.
public boolean isEnforceIntegrity()Read-only property that returns whether to enforce data integrity rules (data constraints) on the data added to the
destinationColumns
. Set this property using the PickListDescriptor
constructor. This property is not currently used.
public final String getLookupDisplayColumn()Read-only property that returns the name of the
Column
in the picklistDataSet
to display for this (the column whose pickList is being defined) column in data-aware controls.
public final String[] getPickListColumns()Read-only property that returns the
Column
components to read from when filling in data from the pickListDataSet
into the columns specified in the destinationColumns
property. Set this property using the PickListDescriptor
constructor.
If your pick list contains multiple columns, you must also set the itemEditor
property of the Column
to an instance of the PopupPickListItemEditor
. The default pick list item editor
is the PickListItemEditor
, which can only display picklist with a single column.
public final DataSet getPickListDataSet()Read-only property that returns the
pickListDataSet
used to choose values from.
Set this property using the PickListDescriptor
constructor.
public final String[] getPickListDisplayColumns()Read-only property that returns a
String
array of the Column
names to display from the pickListDataSet
.
Set this property using the PickListDescriptor
constructor.