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

Monday, August 22, 2011

SelectOneChoice selected value stored in variable

1) In view object define a drop down list for department name (it should display a list of departments).
2) Drag and drop a table attribute(column eg Department name column alone) on a jsff page.
3) Right click on jsff page and select goto page definition. (use this rather than bindings tab)
4) In page definition.xm file goto source tab and find variablesIterator tag. If this tag is not present in design tab in executables region add variablesIterator by click the + sign and creating variable iterator object.
5) In source tab under variableIterator table define a variable name as under:
(lessthansign)variable name="personId" type="oracle.jbo.domain.Number" (greatthansign)
6) Now goto jsff page of page definition inside bindings create one attributeValues binding by clicking + sign. Specify the Datasource as variables and select Attribute name as varDeptId as declared earlier.
7) Now goto page bindings and double click the LOV of department name that you have created in step 2. Select base data source type as variables.
In list datasource select departments view. In data value select the variable and in list attribute select the attribute you want from department column e.g department id and select the display element i.e. the value you want to display on screen.
8) This binding varaible we contain the value you have selected in dropdown list. Your can use JSFUtils to resolve the expression value or assign this value to and execute with paramters operation. The expression for this values is #{bindings.varDeptId1.inputValue}