v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
Normal
0
false
false
false
false
EN-US
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
Model driven list-of-values in Oracle ADF are configured on
the ADF Business component attribute which should be updated with the user
value selection. The value lookup can be configured to be displayed as a select
list, combo box, input list of values or combo box with list of values.
Displaying the list in an af:inputListOfValues component shows the
attribute value in an input text field and with an icon attached to it for the
user to launch the list-of-values dialog.
The list-of-values dialog allows users to use a search form
to filter the lookup data list and to select an entry, which return value then
is added as the value of the af:inputListOfValues
component.
Note: The model
driven LOV can be configured in ADF Business Components to update multiple
attributes with the user selection, though the most common use case is to
update the value of a single attribute.
A question on OTN was how to access the row of the selected
return value on the ADF Faces front end. For this, you need to know that there
is a Model property defined on the af:inputListOfValues that
references the ListOfValuesModel
implementation in the model. It is the value of this Model property that you need to get
access to.
The af:inputListOfValues
has a ReturnPopupListener property that
you can use to configure a managed bean method to receive notification when the
user closes the LOV popup dialog by selecting the Ok button. This listener is not triggered when the cancel button is
pressed. The managed bean signature can be created declaratively in Oracle
JDeveloper 11g using the Edit option
in the context menu next to the ReturnPopupListener field in the
PropertyInspector. The empty method signature looks as shown below
public
void returnListener(ReturnPopupEvent returnPopupEvent) { }
The ReturnPopupEvent
object gives you access the RichInputListOfValues
component instance, which represents the af:inputListOfValues component at runtime. From
here you access the Model property
of the component to then get a handle to the CollectionModel.
The CollectionModel
returns an instance of JUCtrlHierBinding
in its getWrappedData
method. Though there is no tree binding definition for the list of values
dialog defined in the PageDef, it exists. Once you have access to this, you can
read the row the user selected in the list of values dialog. See the following
code:
public void returnListener(ReturnPopupEvent returnPopupEvent) {
//access UI component instance from return event
RichInputListOfValues lovField =
(RichInputListOfValues)returnPopupEvent.getSource();
//The LOVModel gives us access to the Collection Model and
//ADF tree binding used to populate the lookup table
ListOfValuesModel lovModel = lovField.getModel();
CollectionModel collectionModel =
lovModel.getTableModel().getCollectionModel();
//The collection model wraps an instance of the ADF
//FacesCtrlHierBinding, which is casted to JUCtrlHierBinding
JUCtrlHierBinding treeBinding =
(JUCtrlHierBinding) collectionModel.getWrappedData();
//the selected rows are defined in a RowKeySet.As the LOV table only
//supports single selections, there is only one entry in the rks
RowKeySet rks = (RowKeySet) returnPopupEvent.getReturnValue();
//the ADF Faces table row key is a list. The list contains the
//oracle.jbo.Key
List tableRowKey = (List) rks.iterator().next();
//get the iterator binding for the LOV lookup table binding
DCIteratorBinding dciter = treeBinding.getDCIteratorBinding();
//get the selected row by its JBO key
Key key = (Key) tableRowKey.get(0);
Row rw = dciter.findRowByKeyString(key.toStringFormat(true));
//work with the row
// ...
}