This blog will cover Oracle ADF, Weblogic, Oracle Application Server, Oracle Collaboration Suite etc....
Tuesday, September 4, 2012
Named Criteria: ViewCriteria
Named Criteria:
Create new view criteria for viewobject. If you have added this view object to app module remove it and add it again. Once you add this viewobject with viewcriteria refresh data controls pallet and under viewobject named criteria you will see the custom created named criteria.
Wednesday, July 18, 2012
AutoSuggest For InputTextField
AutoSuggest is a very good feature in terms of LOV
Below are the step to create AutoSuggest
1)Create a ViewObject (EmployeesVO)
2)For Department Attribute Define List Of Values - Note below items when you define this
- You will have to define VO on Read Only access through SQL Query (You need this becasue in this query you need to have an attribute to hold department name for autosuggest to pull this value you need to create a query like below and make sure in Viewobject for each attribute you set the updateable property to Always)
SELECT Emp.FirstName,
Emp.LastName,
Emp.DeptId,
(SELECT Dept.DeptName FROM Department Dept WHERE Dept.DeptId = Emp.DeptId) DeptName
FROM Employees Emp
You autoSuggest will work on this attribute.
3)Define default viewobject for Departments table, this will be the lov for the attribute DeptNm in Employees.
4) In EmployeesVO select attribute DeptName and define lov, make sure when you select DepartmentVO in list datasource in your return value you should have two values something like
ViewAttribute ListAttribute
DeptName DepartmentName
DeptId DepartmentId
What will happen is when ever you whill select department name using autosuggest the corresponding value for deptid will be copied to DeptId column in EmployeeVO.
5) In UI Hints select InputText with List Of Values and diplay attribute set to Department Name
5) Now on you JSF page drag and drop EmployeesVO as table for the DepartmentName attribute copy below line before the closing column tag
af:autoSuggestBehavior suggestedItems="#{row.bindings.DeptName.suggestedItems}"/
No need to add any list in page definition it will automatically pick up from the LOV defined in the viewobject.
Create New Rows
The best way to create new rows is in pagedefinition define oprataion createInsert or createWithParm for viewobject and execute this operation programmatically. This can even be used when we have to create n number of rows. If you use viewobject.createRow() this will take lot of time to load.
Sample code is:
op = dbc.getOperationBinding("Createwithparameters");
for(int i=1; i<=15;i++){
op.getParamsMap().put("parm1", value1);
op.getParamsMap().put("parm2",value2);
op.execute();
if(!op.getErrors().isEmpty()){
bhcLogger.severe("Error in Initializing");
}
}
Friday, July 6, 2012
LOV View Accessors from Viewobject View Criteria
ViewAccessors are nothing but the List of values that you can assign to the arrtibutes of view object.
In this post we are looking into defining an accessor created based on view criteria of a view object to its attribute.
1) You have defined a view object say deptvo. In this vo you have defined a viewcriteria say deptvc_10_50 (only depts between 10 to 50)
2) Now say you want to create another view object and in its dept dropdown it should only display the values from the above view criteria i.e. dept 10 - 50 only.
3) Create second viewobject say emp_in_dept10_50VO goto attribute deptno attribute on List Of Values region click the + sign this will open the create list of values panel
4)In this click the green + sign and select the viewobject that you have defined in step 1. Now once you have shuttled this viewobject on the right you need to click the Edit button on this window (View Accessors window) and select the viewcriteria to be associated with this lov.
Thursday, May 3, 2012
Friday, April 20, 2012
Scrollbar
ScrollBar: For scrollbar we need to use/surround table or other components with PanelGrouplayout. Panelgrouplayout has property called layout under Apperence, set this value to scroll and you will see scrollbars.
Wednesday, April 18, 2012
PageFlowScope Variables Programmatically
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
Map pageFlowScope = adfFacesContext.getPageFlowScope();
pageFlowScope.put("firstName","Tanveer");
pageFlowScope.get("firstName");
Map
pageFlowScope.put("firstName","Tanveer");
pageFlowScope.get("firstName");
Tuesday, April 17, 2012
Working With SelectOneChoice
One of the simpler way to work with selectone choice is as under.
1) In page definition(bindings) create an iterator from view object in executables.
2) In bindings section click on '+' and select table from list. Select the viewobject you want to deal with. Select the attributes you want to reference.
3) Now on you jsf/jsff page write below code for selectonechoice component.
4) No create Managed bean and create variable of type RichSelectOneChoice as: private RichSelectOneChoice deptName;
and generate accessors for it.
5) The selectonechoice in jsff is binded to this variable. Now you can create a button to test the value for this using below code on action
System.out.println(submType.getValue());
1) In page definition(bindings) create an iterator from view object in executables.
2) In bindings section click on '+' and select table from list. Select the viewobject you want to deal with. Select the attributes you want to reference.
3) Now on you jsf/jsff page write below code for selectonechoice component.
4) No create Managed bean and create variable of type RichSelectOneChoice as: private RichSelectOneChoice deptName;
and generate accessors for it.
5) The selectonechoice in jsff is binded to this variable. Now you can create a button to test the value for this using below code on action
System.out.println(submType.getValue());
Wednesday, March 28, 2012
Partial Trigger programmatically
In actionlister or your bean write below code
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTargets();
e.g. say we have two text fields it1 and it2. Set it1 autoSubmit to true and in valuechangelister give below code
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
System.out.println("entered");
it2.setValue(it1.getValue());
adfFacesContext.addPartialTarget(it2);
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTargets(
e.g. say we have two text fields it1 and it2. Set it1 autoSubmit to true and in valuechangelister give below code
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
System.out.println("entered");
it2.setValue(it1.getValue());
adfFacesContext.addPartialTarget(it2);
Tuesday, March 27, 2012
ViewObject Filtered Rows based on description / name /id
DCBindingContainer dcb = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dcb.findIteratorBinding("EmployeeIterator");
ViewObject view = iter.getViewObject();
Row[] rr =view.getFilteredRows("lastName", "Bill");
for(int i=0;i < rr.length ; i++) {
System.out.println(rr[i].getAttribute("empid")+" "+rr[i].getAttribute("firstName")+ " "+rr[i].getAttribute("lastName") );
}
DCIteratorBinding iter = dcb.findIteratorBinding("EmployeeIterator");
ViewObject view = iter.getViewObject();
Row[] rr =view.getFilteredRows("lastName", "Bill");
for(int i=0;i < rr.length ; i++) {
System.out.println(rr[i].getAttribute("empid")+" "+rr[i].getAttribute("firstName")+ " "+rr[i].getAttribute("lastName") );
}
Monday, March 26, 2012
RowSetIterator Use
RowSetIterator is used to navigate through viewobject iterator. It also have useful operations defined in it like row.previous() etc which can be used to capture previous row.
RowSetIterator rs= viewobject.createRowSetIterator(null);
while(rs.hasNext()) {
Row row = rs.next();
if(row.getAttribute("Attr_Value").toString().equalsIgnoreCase(Comparison value.toString())){
Row prRow = rs.previous();
}}
RowSetIterator rs= viewobject.createRowSetIterator(null);
while(rs.hasNext()) {
Row row = rs.next();
if(row.getAttribute("Attr_Value").toString().equalsIgnoreCase(Comparison value.toString())){
Row prRow = rs.previous();
}}
Sunday, March 25, 2012
Iterator Row changed to change the values of respecting Attributes: Automatic PPR Initiated by the ADF Binding Layer
In Oracle JDeveloper 11g, the change event policy feature can be used to refresh UI components
automatically that are bound to an ADF binding when data has changed in the model layer. To
use this feature, you set the ChangeEventPolicy property of the ADF iterator binding and the
attribute bindings to ppr, which also is the default setting.
In pagebinding select Iterator | in properties- Advanced - Change Event Policy : select value "ppr". What will happen is the moment you select a record in table other respective attributes on UI which were pointing to individual attributes from this iterator will display the new values else not.
automatically that are bound to an ADF binding when data has changed in the model layer. To
use this feature, you set the ChangeEventPolicy property of the ADF iterator binding and the
attribute bindings to ppr, which also is the default setting.
In pagebinding select Iterator | in properties- Advanced - Change Event Policy : select value "ppr". What will happen is the moment you select a record in table other respective attributes on UI which were pointing to individual attributes from this iterator will display the new values else not.
Friday, March 2, 2012
ADF Column Date Time Format
To display the timestamp attribute values in specific pattern, add convertDateTime tag to the respective attribte and specify the pattern you want to display.
Thursday, February 16, 2012
Programmatically Caputure Table values and update Viewobject
In case when data is coming from any webservice and you need to update any viewobject based on the updates the user is doing on UI table. The logic is to capture key of each row of UI table and find the key in the viewobject, get corresponding records and update the values as in table using below code. I have writtten it on button action.
public String cb1_action() {
// Add event code here...
RichTable table = this.getDtlTable();
System.out.println("Row Count:"+table.getRowCount());
Number keyValuePK;
// for (int i = 0; i < table.getRowCount(); i++)
// {
Row row = ((JUCtrlHierNodeBinding)table.getRowData(10)).getRow();
System.out.println(row.getAttribute(1)+" "+row.getAttribute(2));
keyValuePK = (Number)row.getAttribute("PrimaryFieldId"); //tenth row
System.out.println("Key Value: "+keyValuePK);
row.getAttribute("PrimaryFieldId");
//}
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding)dbc.findIteratorBinding("IteratorName");
Key k1 = new Key(new Object[]{keyValuePK}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
System.out.println(r1[0].getAttribute("PrimaryFieldId")+" "+r1[0].getAttribute("AnyotherDesc"));
r1[0].setAttribute("UpdateAnyAttr", 99999);
// row = iter.findRowsByKeyValues((Key[])row.getAttribute("SubmHeadId")) ;
return null;
}
public String cb1_action() {
// Add event code here...
RichTable table = this.getDtlTable();
System.out.println("Row Count:"+table.getRowCount());
Number keyValuePK;
// for (int i = 0; i < table.getRowCount(); i++)
// {
Row row = ((JUCtrlHierNodeBinding)table.getRowData(10)).getRow();
System.out.println(row.getAttribute(1)+" "+row.getAttribute(2));
keyValuePK = (Number)row.getAttribute("PrimaryFieldId"); //tenth row
System.out.println("Key Value: "+keyValuePK);
row.getAttribute("PrimaryFieldId");
//}
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding)dbc.findIteratorBinding("IteratorName");
Key k1 = new Key(new Object[]{keyValuePK}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
System.out.println(r1[0].getAttribute("PrimaryFieldId")+" "+r1[0].getAttribute("AnyotherDesc"));
r1[0].setAttribute("UpdateAnyAttr", 99999);
// row = iter.findRowsByKeyValues((Key[])row.getAttribute("SubmHeadId")) ;
return null;
}
Wednesday, February 15, 2012
Map Example
package view;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class MapExample {
public static void main(String[] args) {
Map
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class MapExample {
public static void main(String[] args) {
Map
Tuesday, February 7, 2012
Search Criteria - View Criteria
Create view criterias against a view object (you can also have lov in the view criteria fields i.e. by defining the attribute as selectively required, as in screeshot).
In your datacontrol panel inside named criteria
, you will see this viewcriteria drag and drop it as ADF Query panel with table.
In your datacontrol panel inside named criteria
, you will see this viewcriteria drag and drop it as ADF Query panel with table.
Monday, January 23, 2012
Key Sample: How to find row from viewobject based on key attribute
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeeIterator");
Key k1 = new Key(new Object[]{100}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
for(Row r: r1){
System.out.println(r.getAttribute(0)+" "+r.getAttribute(1));
}
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeeIterator");
Key k1 = new Key(new Object[]{100}); //employee id
Row[] r1 = iter.getViewObject().findByKey(k1, 1);
for(Row r: r1){
System.out.println(r.getAttribute(0)+" "+r.getAttribute(1));
}
TaskFlow as Popup Window
TaskFlow in Popup
You can run a taskflow like a popup window and also return value:
Two things to be taken care of 1) Create a bounded task flow (one which will be displayed in popup). In properties window for this taskflow, in behaviour tab set run as Dialog property to true and display type as inline popup. 2) The button, on click of which this should appear as popup. Select the button and in property window set below properties: - Use window : true - Window Height: 300 - Window Width:300 You can also set parameters as under. 1)In 1st taskflow definition drag and drop the taskflow which you want to run like a popup window
2) select that taskflow and in properties panel in return parameter you can specify a parameter, if you plan to return something
- In behaviour tab set Run as Dialog property to True & display type default(external window)
and then you can set pageflow scope varible to return value from here for selected record.
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("parameter", value);
You can run a taskflow like a popup window and also return value:
Two things to be taken care of 1) Create a bounded task flow (one which will be displayed in popup). In properties window for this taskflow, in behaviour tab set run as Dialog property to true and display type as inline popup. 2) The button, on click of which this should appear as popup. Select the button and in property window set below properties: - Use window : true - Window Height: 300 - Window Width:300 You can also set parameters as under. 1)In 1st taskflow definition drag and drop the taskflow which you want to run like a popup window
2) select that taskflow and in properties panel in return parameter you can specify a parameter, if you plan to return something
- In behaviour tab set Run as Dialog property to True & display type default(external window)
and then you can set pageflow scope varible to return value from here for selected record.
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("parameter", value);
AutoSuggest TextField (InputText Field).
AutoSuggest Behaviour on Text Fields
1) In ViewObjext definition create a new attribute (transient attribute, because autosuggest will work on the description / id lov for e.g. if you define the lov on any id field and you are displaying description / name as label then in that case the sorting will happen on ids and not on descripti
on).
To avoid this problem define transient attribute, name it accordingly and in lov Configuration Select that id attribute (employee id) as well as description, so what will happen is based on the description selected corresponding id will also be selected).
In UI Hints you can select the name/descirption field to display and List Type should be InputText with List of Values.
2) Now on you JSF page, lets say that you have dragged and dropped this viewobjects datacontrol as table and for this field you select it as textfild(default will be combo etc).
Add this code for you field
e.g.
Once you drag and drop view as table then the tree node is created in table and this expressions will work.
findRowByIteratorAttribute - Find a row within Iterator with some attribute value
Once we get hold of iterator and when we need to find a row in iterator based on any attribute value, we can use below code
String lName = "Joe";
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeesIterator");
RowIterator rIter= iter.findRowsByAttributeValue("LastName", true, lName);
String empId = rIter.first().getAttribute("AcctId").toString();
String lName = "Joe";
DCBindingContainer dbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = dbc.findIteratorBinding("EmployeesIterator");
RowIterator rIter= iter.findRowsByAttributeValue("LastName", true, lName);
String empId = rIter.first().getAttribute("AcctId").toString();
Sunday, January 22, 2012
Setting PageFlowScope Parameters from Button ActionListener withoout code
1) When we want to set pageflowscope parameters without writing code
- Attach SetActionListener Operation to button
The EmployeeId is defined against employee id attribute against employee iterator on pagedefinition.
We can have n number of the variables defined here to pass pageflow scope variables.
- Attach SetActionListener Operation to button
The EmployeeId is defined against employee id attribute against employee iterator on pagedefinition.
We can have n number of the variables defined here to pass pageflow scope variables.
Subscribe to:
Posts (Atom)