Why we need placeholder data control ?
It is used to create a prototype or mock screens, which has no connections
with DB or web services.
1. Follow the post "How to create Oracle ADF Fusion Web Application?" to create an application, change Application name to
"SamplePlaceHolderDataControlApp" and suffix to
"samplePHDC".
2. Right click on model project and select New -> From Gallery.
3. Following screen appears and Search with PlaceHolder Data Control and select the Placeholder Data Control and click ok.
4. Fill the following fields :-
Name :- Name of placeholder data
control. Lets say "SampleOnePlaceHolder".
Package :- Select the package where to put this file.
Description :- Optional field
Then click ok.
5. Check out the project structure, you will see
that SampleOnePlaceHolder.xml file created and its entry in Data Control.
6. Now we will create the PlaceHolder Data Types.
Open the "SampleOnePlaceHolder.xml" file.
7. On the Data Type section select the data control placeholder and click on
add icon mention on right top on data type section.
8. A popup window appears and mention the following details :-
File Name :- Name of placeholder data type.Lets say
"OnePlaceholderDataType.xml"
Package :- Directory to place this xml file.
If you want to import csv file then click on "Import from"
checkbox and select the file from the location.
Here we create our own data, so unchecked the "Import from"
checkbox.and click ok.
9. A view object is created with an xml
file "OnePlaceHolderDataType.xml".And also added as an iterator on
data control which will be accessible at view layer.
10. Start adding the attributes by clicking on Add icon.
Lets create two attribute Id and Name and provide the
constraints like primary key, IsUnique, IsQueriable, IsNotNull, Deafult value
in an attribute property window.
You can also specify the default
components for this attribute to show at UI such as use that attribute
as a checkbox, inputbox as lov, chose, date etc. Here we are not using any component , so set it as default value.
So do it same for Name attribute according to the requirement.
And at Data Control section two attributes added on placeholder data type
iterator mentioned on orange circle.
Here we had mentioned Format type = 0000.
Example if data value is 1 then it will convert to 0001.
11. Now start creating the static data for this two attribute fields.
So click on Data tab in OnePlaceHolderDataType, and add the data by
clicking on Add icon or we can import the data from csv file as well by
clicking on import.
12. Now we will test this at model layer to check whether the PlaceHolder Data
control and its view object is created successfully or not.
For this right click on the "DataControl.dcx" file and select
run.
13. Oracle ADF Model Tester window will open and
then double click on OnePlaceHolderDayaType view instance.
14. Now we will start implementing this placeholder on page.
Create a jsf/jspx page , for this refer to the post "How to create JSF/JSPX page by using Jdeveloper 12c?", change the page name to "SamplePlaceHolderTestPage".
15. Drag and Drop the iterator from data control to the page as a ADF Table.
16. Now run this jspx page.
Work with master data relationship in placeholder data control refer to
post "Work with Master Detail relation using PlaceHolder Data Control?".
0 comments:
Post a Comment