ADF applications are typically heavily into data. One of the major strengths of the framework is the data binding layer that allows rapid development of complex user interfaces bound to underlying data controls. These data controls expose data sources such as relational databases, web services, content management systems, JMX beans (as of 11g), REST/URL services and plain files. ADF applications in the recent past had to be developed with all these data sources present – without them the UI components could not be rendered and the application would not run.
This limits the flexibility during the development process: data sources are required for creating the databound user interface. Without them, no meaningful user interfacer can be created.
With 11g, a new type of data control is introduced: the Placeholder Data Control. Placeholder Data Controls are the stand-ins for real data controls. They can be used when the real data control and its underlying data source are not yet available or the application is temporarily off line without access to the database or web services that underpin the model. Placeholder Data Controls allow the creation of a data bound user interface in the absense of the data sources. They UI designers/web specialists to create a functional application with meaningful data and working navigation without knowledge of the business services.
Creation of a Placeholder Data Control and its Data Types is a simple task – and using them is even simpler:
– create a new Placeholder Data control – specify a name
– create a Data Type under this Data Control – specify a name, the attributes and sample data (rows of data that will be displayed when the application is run with the placeholder data control still in place)
– optional: create additional Data Types (note: data types can have a master detail relationship with other data types)
The Placeholder Data Control is visible in the DataControl palette and can be used (drag & drop, bind to components) just like any other data control. From the perspective of the ADF Faces components, it is no different from other data controls.
Let take a quick look at these steps:
– start JDeveloper, create/open an Application, Create/Open a project
– from the New Gallery, Under Business Tier, node Data Controls, select Placeholder Data Control
– enter the name and optionally a description
– data control is displayed in the dc palette.
– from the context menu on the data control, select the option to create a data type
– specify name, attributes, types, label etc.
– go to sample data tab; enter rows of data
In the Data Control Palette, you will now find the Data Type under the Placeholder Data Control .
Now you are ready to use the placeholder data control in your pages. Create a new JSF page or open an existing one. Drag and drop the Person node under the MyPeoplePlaceholder to the JSF page:
Select ADF Read Only Table. Edit the Table Columns in the aptly named popup:
Press OK. The page is displayed, with the data from the Person Data Type already displayed in the visual editor:
Now you can run the page – to see what this offline ADF application without any proper data control looks like:
There seems to be an issue with the Birthdate column: the display format for Date Column is not correct, even though the display format was set to SimpleDate – dd-MM-yyyy. Maybe this format was not applied to the sample data as well. The format with which the sample data should have been entered is probably different from the dd-MM-yyyy format. Also note that in the current build of JDeveloper 11g I had an issue with ADF (editable) Table – dropping the Placeholder Data Control’s Person Data Type on the JSF page as an ADF (Editable) Table resulted in the strange phenomenon that in the browser (when running the page) three rows are visible – but no data is shown. So I can tell the table contains three records, but none of the cell values are visible.
Summary
The Placeholder Data Control is very easy to use. It gives us the opportunity to create (prototype) a User Interface in the absence of real underlying data sources. It also allows us to create demo-applications, samples and training exercises without the need for a database or other backend service.
In a other articles we will take a closer look at:
– creating Data Types from CSV files with sample data
– establishing master detail relationships between data types
– creating (project wide) reusable Placeholder Data Controls
– rebinding ADF components – replacing binding to a Placeholder Data Control with binding to an actual Data Control.
I think Edwin that really rapid prototyping and simple demos or class practices (or blogs) to introduce a specific feature/trick in the Rich Faces components or ADF Faces Controller layer represent probably the most useful business cases. And perhaps we should try functional analysts and GUI designers employed on ADF Faces projects to live a little bit closer to reality than Photoshop; this could be a way to achieve that. We will have to see though how things prove their worth in the real life.
regards, Lucas
I am very curious who will use this features. I believe gui designers just want to create a page and drag a table on it or a input field. After the drag they want to fill the data in the table. Now gui designers need to know too much of adf and jdev. They want to have the components palette and use it in an Adobe producrt.
For developers they can just create an adf bc project with the right viewobjects and drag these viewobject on the page. This will be faster when you have to 2 or more viewobjects. Or use Jheadstart.