ADF Bindings
ADF Bindings
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release and timing of any development release, features or functionality described for Oracles products remains at the sole discretion of Oracle.
Demonstration
Data Control Artifacts
Custom Templates
/jdev/system/oracle.adfm.dt.faces.10.1.3.(n) j y ( ) For JSF: faces_creator_configuration.xml
<creator name="outputlabel_ad _faces a e output abe adf aces bindingsTypes="primitiveText rank=".45f namespace="http://xmlns.oracle.com/adf/faces representativeNamespace="http://java.sun.com/jsf/html localName="outputLabel binderClass oracle.adfdtinternal.view.faces.binding.binder.LabelBinder binderClass="oracle.adfdtinternal.view.faces.binding.binder.LabelBinder properties="readOnly rebindOnly"> <![CDATA[ <af:outputLabel #if ($properties.get("primitive:suggestedLabel")) value="${properties.get("primitive:suggestedLabel")}" #else value="${model.getLabelExpression()}" #end /> ]]> </creator>
Binding Container
Data Control
DataBindings.cpx
Locates the correct PageDef for a page Defines the Data Control usages of the p j g project
<?xml version="1.0" encoding="UTF-8" ?> <Application xmlns="http://xmlns.oracle.com/adfm/application" version="10.1.3.40.33" id="DataBindings" SeparateXMLFiles="false" Package=oracle.demo.view" ClientType="Generic"> <pageMap> p g p <page path="/home.jspx" usageId="homePageDef"/> <page path="..." /> </pageMap> <pageDefinitionUsages> <page id="homePageDef" path="oracle.demo.view.pageDefs.homePageDef"/> <page id="..."/> p g / </pageDefinitionUsages> <dataControlUsages> <BC4JDataControl id="AppModuleDataControl" Package="oracle.demo.model" FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl" SupportsTransactions="true" SupportsFindMode="true" SupportsRangesize true SupportsResetState true SupportsRangesize="true" SupportsResetState="true" SupportsSortCollection="true" Configuration="AppModuleLocal" syncMode="Immediate" xmlns="http://xmlns.oracle.com/adfm/datacontrol"/> </dataControlUsages> </Application>
XML File
Demonstration
Turning the Tables g
Executables
Iterators
Link other bindings to a Data Control (mostly) Either Attributes directly or collections Types: Iterator basic link data to binding Method iterator link the results of a method call to a binding Accessor Iterator link to detail collections for nested objects (not used with ADF BC) Variable Iterator access to local data defined in the pagedef d f Most often used for method arguments Not linked to a Data Control
Executables Cont.
InvokeAction
Allows the invocation of a method binding automatically within the lifecycle An alternative to invocation via user action e.g. button press Controlled using: Refresh attribute: When in the lifecycle it fires RefreshCondition: EL expression to refine execution Examples:
RefreshCondition="${(!adfFacesContext.postback)}"/> RefreshCondition= "${(userState.currentSvrId != bindings.svrId.inputValue) ||(userState.editRefresh)} ||(userState.editRefresh)}"
Important!
Pay attention to side effects, for example: Double Invocation when Bindings based on a method iterator will implicitly invoke the method
Refresh Settings
Value
always deferred d f d ifNeeded never prepareModel renderModel
Meaning
Invoke on page entry or postback Only invoke if the binding is used (e.g. table may or may not be rendered based on some other condition) Let ADF decide often used with ADF BC where the model is "self aware" Use when only invoking from code See lifecycle next also has ifNeeded variant See lifecycle next also has ifNeeded variant
The LifeCycle
Request
Invoke Application
Invoke Application
Request
Invoke Application
Model
Request
Init Context
Prepare Model
Render Response
Prepare Render
Invoke Application
Response
Code
PagePhaseListener Decorates the lifecycle Custom page controller - subclass and extend the lifecycle for a page Use with caution remember to call the super-class! p Complete custom lifecycle
Page Controller
Extend
oracle.adf.controller.v2.lifecycle.PageController
Plugged in
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="" id="homePageDef" Package="groundside.com.view.pageDefs" ControllerClass="groundside.com.fwkext.CookieSettingListener">
Can be replaced
public class SRDemoADFPhaseListener extends ADFPhaseListener { protected PageLifecycle createPageLifecycle() { return new SRDemoPageLifecycle(); }
Add getters and setters for oracle.binding.BindingContainer JDeveloper will do this automatically if you let it maintain backing beans for you
Changes in 11g
1. Getting access to the binding in code g g
Lookup the object in the getter
public BindingContainer getBindings() { if (this.bindings == null) { FacesContext fc = FacesContext.getCurrentInstance(); g this.bindings = (BindingContainer)fc.getApplication().evaluateExpressionGet(fc, "#{bindings}", BindingContainer.class); } return this.bindings; }
JDeveloper will do this automatically if you let it maintain backing beans for you
OperationBinding operationBinding = getBindings().getOperationBinding("findDepartmentManagerId"); Map params = operationBinding.getParamsMap(); params.put("searchTerm","Sales"); Number deptManager = operationBinding.execute();
Debugging!
-Djbo.debugoutput=console New Debugger
Demonstration
Debugging Bindings in 11g gg g g g
More at OOW
Upcoming Related Sessions g
MS Office Front Ends for Oracle Application Development Framework Applications. 4pm today RIAs and Web 2.0 Development Made Simple 1:30pm Thursday
<Insert Picture Here>
Hands On Labs
D t Visualization f Web Applications 4 Data Vi li ti for W b A li ti 4pm t d today
Learn More
Oracle.com/technology/jdev gy j
Download Tutorials Discussion forum Blogs Samples
Win a Wii
Help us build tools that help you. and Receive a Gift and a chance to win a Wii.