Agenda
Worlss most comprehensive Hello World Demo
UI Component Tree
RichPanelHeader RichPanelGroupLayout RichPanelFormLayout RichInputText RichInputDate
6. Render Response
richInputText.setSubmittedValue(Steven) richInputDate.setSubmittedValue(04-12-2012)
Validate and convert (if needed) name and date Call richInputText.setValue() with converted value if valid Clear submittedValue Queue valueChange event (if applicable)
Request Values
Call HelloBean.setName with component value Call HelloBean.setDate with component value Clear submitted and (local) component value
Call HelloBean.sayHello
Clicking the Reset button should not fire validation, and should clear the Name and Date fields We need a lifecycle shortcut that bypasses validation (both client-side and server-side) and model update
We clicked the Reset button . Name and date are cleared in HelloBean . But we still see the old values in the page! How come??
Using af:resetActionListener
Easiest option, no Java method needed Automatically added when dragging and dropping a Rollback operation from Data Control Palette Lesson 3: af:resetActionListener does NOT reset child regions, use ResetUtils.reset() instead.
Agenda
Worlss most comprehensive Hello World Demo
Not really ..
No, model is no longer updated, getName() will return null (or old model value): remember lesson 1! AND (wrong) greeting will NOT be displayed anyway: remember lesson 2!
At least the suggested greeting is displayed now, although it is still the wrong default greeting because getName() returns null in the suggest method
Lesson 4: Always use ComponentReference in component binding getter/setter methods Lesson 5: Never use component binding in sessionscoped bean, even ComponentReference wont be safe then.
ValueChangeListener fires in phase 3. Process Validations That phase is skipped with immediate command Now, lets set immediate=true on name field
YES, this works, and the reset button still works too! But wait . it works too well
Method should not execute when name empty, or less than 4 chars
Agenda
Worlss most comprehensive Hello World Demo
Suggest button now works with empty date! Layout cleaned up! Pressing enter key on name shows suggested greeting! But wait . what is functionally different from previous samples? Greeting field is not required, what if we fix that?
No validation error on greeting field! But greeting no longer shown Lesson 11: Partial page refresh does not work across sub-forms Sub forms do not work for this use case
Sub forms can be used in corner cases to avoid premature validation Sub forms most useful for default command behavior
Agenda
Worlss most comprehensive Hello World Demo
Will field validations fire prematurely? Will greeting field be refreshed correctly?
So, with code in previous slide no premature validations fire but greeting field is not refreshed So, what will happen when we add partialTrigger property to greeting field?
Greeting field now processed as well -> validation error when null Solutions:
1. make greeting optional 2. add greeting programmatically as partial target
Why??
Agenda
A bit more on the ADF optimized lifecycle
When clicking on another row, changes in overflow area are now preserved
Clicking the New Employee button should also preserve changes made in table overflow area Easy works out-of-the-box Now, lets move that button to panelCollection toolbar
Agenda
Worlss most comprehensive Hello World Demo
Final Recommendation
Lesson 18: write previous 17 lessons down, print them, put them on the wall, learn them by heart, and rehearse them every week, it will save you tons of frustration!