Pages

Saturday, June 14, 2014

Switcher in ADF

A requirement lead me to play around the components. while clicking button I need to toggle components. 

Requirement rules:
1.Should not use render/visible property.
2.Toggle should happen page itself. it should not taken it into bean.
I studied about switcher.I got a chance to implement it.

Step 1: Have Switcher in your page. Under switcher have your components. 

Important note: 
             Components should folds of f:facet. Switcher facet Name play key role. it will decide which will show up on the screen. 



Step 2: Finally requirement accomplished.

Clicking First button,



Clicking Second button,



Download here

Enable/Disable the Input Fields/Input Value holders

Here I got requirement like Enable/Disable the bunch of fields. It's hard to bind each and every fields and toggle it. I read some blogs. Accessing appropriate classes we can do that.


Step 1: Here we go, standard code for accessing class with appropriate attributes.



Step 2: While clicking edit button call out the method.
pass the 'AdfFacesContext' Instance , bind the Parent Layout and pass the appropriate Boolean values. 


Step 3: Finally call out the method for update button.


Note : Code will works, First Level Immediate Children as like of structure shown.



Download Here

Debugging in ADF - Part I

Developer & Development Time basically get reduces if you are using Debugger WLS,

Here we go,

1.System.out.println  -  Newbie will use s.o.p each and every statement. so what's going on.
2.Avoid Re-run. - For a Small Change in Java Class(Application Module/EO/VO/Bean). No Need to Run Entire Application.
3.Bug Findings - Easy error findings.

Various Options for Debugging:

Option 1:  By using this statement "-Djbo.debugoutput=console"  in Model Layer. you can see SQL query being sent to server in your console log.



Note : If you are going to use this option means, After pressing OK button. need to restart your server.

Option 2:  Have a break point (by pressing 'F5') in your java code.then start debugger along with your application.




While Performing Selection/Action. By pressing F8(Step by step execution on code)
By pressing F9(Navigate to Next Break point). Blue Color shows Execution Point.




After execution of a row. you can mouse over on the particular class for see the values.
say as e.g.: After execution row class. I can able to see a entire row what i selected in page.



Options 2.1: By using "EL Evaluator" you can debug. With the help of El expression i can able to get the row count.



Options 2.2: By this "Smart Data" you can debug Model and its values (say as e.g.: debug the queries)



Options 2.3: By this "Data" you can debug the Bean and its values.




Options 2.4 : By this "ADF Data" you can debug the Various Scope and its values

Request Scope: Bindings Flows out on this scope.



View Scope: PageDef Flows out on this scope.



Session Scope: Active Data Services Flows on this scope.




Application Scope: Application name and its location flows on this scope.


 

While debugging,
In Browser: Few couple of things can able be noticed


In Application Data: Entire db data can able to see here



I

By this way you see the state of Enity Object and its Data.



In Jspx Page: By this way you see the entire value and expersion of an Page.



Option 3:  Configuring Diagnostic Logging.



Tune into Finest Level.


These are the various kind of Debugging.

Debugging Part 2 & 3(LifeCycle Level) in future posts.

Select Boolean Check Box in ADF

Here I got a requirement like on select boolean check box, while selecting a row corresponding row check box should be selected.


Step 1: As per requirement, I added a Transient Attribute as Boolean and also i make it is as passivated.



Step 2: Then I drag and drop as Table. By default it will input text box. select the Check Box field then use right click select 'Convert To..' option. Another panel box will opens in that choose "Select Boolean Check box". Click OK button. Finally it looks like following image



Step 3: Two things need to do.

First one remove the existing Selection Listener.Then use edit option it will direct you to create a bean and register then bean in adfc-config.xml(automatically).

Second one bind your af:table in bean.



Step 4: With help of ADF Utilities make our work easy. Our af:table work functionality based on 'Collection Model' Class. 'makeCurrent' will identify the user row selection.




Grab the Current Row, based on selection set value as true. 
Make PPR on af:table.

Step 5: Finally requirement accomplished.




Download Here