Thursday, September 29, 2011

Navigation based on popup outcome

To navigate to some other page you should not use dialoglistener because it will not navigate from your method instead you should define buttons in your popup and the action of these buttons to return to some page e.g.

public String gotoHomePage(){
return "gotoHome"
}

This will not work with dialoglistener buttons but will work and navigate to home page if custom buttons are used. :)

Thursday, September 15, 2011

Custom Methods in Application Module & ViewObject

We can define method inside Application Moduel Impl class for funtionality which is using multiple viewobjects and ViewObject Impl class is used for functionality specific to a particular Viewobject.

ViewObject Impl and RowImpl:
- We have two java clases for each view object
- Impl java class can contain method to either delete a row from this view object e.g.



public void deleteEmployee() {
Row currentRow = this.getCurrentRow();
if (currentRow != null) {
currentRow.remove();
this.getDBTransaction().commit();
}
}

Now you need to expose this method to client interfcae (This is present in Viewobject-> Java->ClientInterface\


- Now in your jspx/jsf page definition insert bindings methodAction, select Employees Viewobject and this mehthod will be available in operations.


- Now to invoke this method you can either call it on mehtod click in ActionListener give this value #{bindings.deleteEmployee.execute}

Wednesday, September 14, 2011

Detailed Table Edit Selected Row (Click to Edit) Attribute

Assume that we have a detailed employee table and when we select a particular row I want that row to become editable.

For this to happen select adf table i.e. af:table t1 and in property listener in Behaviour tab set EditMode property value to "clickToEdit" and thats it. (Note the adf table should not be read only)

Attribute level Custom Message Display

E.g. When creating new employee if the user forgets to provide mandatory field e.g. firstname then you can specify the required message details field in property inspector as follows

{0} is Mandatory.Please provide value

The value in {} should be 0 to reflect to current fields.

Message will be displayed like "FirstName is Mandatory. Please provide value"

Tuesday, September 6, 2011

SelectOneChoice Selected value in attribute without loop

1) Go to page definition
2) Create Employees Iterator from employees view object.
3) In bindings create a list for employees first name list as in screen shot (does not update base datasource).

4)On jsf page drag selectone choice from components section and in popup give binding for the list that you created in step 3 also set autosubmit property to true for this dropdown.

5) Now in page definition create a

6) Create one output textfield in jsf page and give its value as #{bindings.FirstName.inputValue} and set partial trigger property to the dropdown id
n attributebinding with the same iterator.

Monday, September 5, 2011

Attribute Binding

Attribute Binding is of greate help, It can be used to get the values of current selected row in table, selectonechoice etc instead of iterating through the viewobject iterator.

1) On you jsf/jsff page right click and say goto page definition.
2) In bindings click to add (+) and select attributevalues
3) Select datasource and in second dropdown select the attribute you want this variable to store e.g. emp id, name etc
4) Now which ever row/record you select dynamically this attribute will hold the value of that record e.g. for employee if you select some middle row this will show the emp id of that record.
5) The value of this variable is accessed using following expression:
#{bindings.FirstName.inputValue} (based upon the attribute you have specified) or programmatically

DCBindingContainer dbc = (DCBindingContainer)this.getBindings();

AttributeBinding attr =((AttributeBinding)dbc.getControlBinding("FirstName"));

Your can even specific this as input parameter to you execute with parameter operations.

ADF Dialog confirmation

Dialog Tutorial Link:
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/77-ok-cancel-support-in-dialog-351871.pdf