Showing posts with label JDeveloper. Show all posts
Showing posts with label JDeveloper. Show all posts

Thursday, May 11, 2017

Jdeveloper windows not showing


 Problems:
Jdeveloper windows are not showing properly 

Solution:
Rename or delete this file from Jdeveloper direcotry 
windowinglayout.xml
just search it and delete it

second option 

Reset windows to factory settings 

Wednesday, March 6, 2013

Adding and Using Jar files in Oracle ADF Application/Project

In this project i will show how to add and use a Jar file of some other ADF Project in your ADF application. First create a Jar file which you want to use in your ADF application and then add them into your application by using following procedure.

1) In your Oracle ADF application go to "Resource Palette", if not visible then go to view and click on "Resource Palette " and now you will be able to see this.

2) Next do this, select new connection and choose file system.
 3) Now from pop give connection name and choose directory path which contain these jars. Just locate the directory not the jar as shown in below snapshot.
4) Now you will be able to see your Jar file as i can see my Jar file.
5) Now Right click on any Jar file and select add to project as shown below. from popup just choose add jar library.


Tuesday, March 5, 2013

Displaying alternative values for specific attributes in Oracle ADF

Sometime we come across such type of requirement in Oracle ADF when we want to display some alternative value of attribute based on some condition. For example if we have a column in database that represents status of something, then instead of storing whole word like "Approve", "Reject", "Pending" etc we can just store "A", "R" ,"P" respectively to save space and to improve performance as well. But it is not good to show "A, R , P " etc on UI because it is not user friendly. Alternatively we can show Approve, Reject or pending etc.

  To implement this, go to your ViewrowImpl class, if not created already just create it now. Now go to your desire attribute function and implement it. Below is my code sample.


    "    public String getReqStatus() {
        reqstatus=(String) getAttributeInternal(REQSTATUS);
     
        try{
        if(reqstatus.equalsIgnoreCase("A"))
        return "Approved";
        else if(reqstatus.equalsIgnoreCase("R"))
        return "Rejected";
        else if(reqstatus.equalsIgnoreCase("P"))
        return "Pending";
        else
        return "Not Reviewed";
        }
        catch(Exception Exe)
        {
        System.out.print("Hello Nasir"+Exe);
        }
        return reqstatus;

    }"
I did it for my requisition status. Now on UI you will see the your desire value instead of database specific value. 

Create Sequence in Oracle ADF

In this post i will show how we can create and use sequence in Oracle ADF by using Groovy expression. First create a sequence in your database then use the following code to implement it.
(new oracle.jbo.server.SequenceImpl("PURCHASEREQ_SEQ",adf.object.getDBTransaction())).getSequenceNumber()

here PURCHASEREQ_SEQ is my sequence name that I have created in Database. See the below snapshot for clarification.
so this is really simple and easy way to implement sequence.

Friday, March 1, 2013

Delete Multiple records in Oracle ADF Table

In this post i am going to show how to delete multiple records in Oracle ADF table. You can select multiple records and then delete them in one transaction instead of doing one by one.

1) Create a new fusion application and create Employees entity object, then its view object.

2) Create an application module and add your view object in it. you can perform all above step in just one wizard as well.

3) Double click on EmpoyeeVo and go to Java tab as shown in the following snap
4) Click on Edit icon in front of Java classes and then on pop up select "Generate view object class " and "Generate view row class" and click Ok.
5) Now go to your AppModule and double click on it. then go to Java tab and click on edit icon from of Java classes. and from pop up choose " Generate application module class" and click ok
6) Now go to your EmployeeViewImpl class as shown in the following snap.

7) Past the following code in EmployeeViewImpl class


"     public void deleteEmps(List <Key> empKeys )
    {
        if(empKeys!= null)
            {
            for(Key k: empKeys)
            {
                Row[] row = this.findByKey(k, 1);
                if(row!= null && row.length==1)
                {
                    EmployeeVORowImpl r = (EmployeeVORowImpl)row[0];
                    r.remove();
                }
                }
            }
    }"

this is the complete code of EmployeeViewImpl

"package model;

import java.util.List;

import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.server.ViewObjectImpl;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Fri Mar 01 16:39:55 PKT 2013
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class EmployeeVoImpl extends ViewObjectImpl {
    /**
     * This is the default constructor (do not remove).
     */
    public EmployeeVoImpl() {
    }
    public void deleteEmps(List <Key> empKeys )
    {
        if(empKeys!= null)
            {
            for(Key k: empKeys)
            {
                Row[] row = this.findByKey(k, 1);
                if(row!= null && row.length==1)
                {
                    EmployeeVoRowImpl r = (EmployeeVoRowImpl)row[0]; //EmployeeVoRowImpl class that //we have create earlier
                    r.remove();
                }
                }
            }
    }
}
"
8) Now go to your view layer and double click on adfc-config.xml for creating and Unbounded task flow.
9) Drag and drop a view component from component palette.
  10) Double click on it and choose defaults from popup and then drag and drop EmployeeView1 data control on page  as a ADF table and make sure you have selected multiple rows from popup as shown in the following snaps.

11) Now from structure window select af:table and then go to advanced properties section and from binding field select down arrow and choose edit.

12) then click new to create new bean give it name delEmps and class name as well other choose default and click ok. Now in front of property click new to create new property in java bean
13) go to your newly created bean and copy past following code in it.

    public List TableKey()
    {
        List<Key> list= new ArrayList<Key>();
        for(Object empKey:empsTable.getSelectedRowKeys())
        empsTable.setRowKey(empKey);
        JUCtrlHierNodeBinding data = (JUCtrlHierNodeBinding)empsTable.getRowData();
        list.add(data.getRow().getKey());
        return list;
        }
following is the my complete code of backing bean


package view;

import java.util.ArrayList;
import java.util.List;

import oracle.adf.view.rich.component.rich.data.RichTable;

import oracle.jbo.Key;
import oracle.jbo.uicli.binding.JUCtrlHierNodeBinding;

public class delEmps {
    private RichTable empsTable;

    public delEmps() {
    }

    public void setEmpsTable(RichTable empsTable) {
        this.empsTable = empsTable;
    }

    public RichTable getEmpsTable() {
        return empsTable;
    }
    public List TableKey()
    {
        List<Key> list= new ArrayList<Key>();
        for(Object empKey:empsTable.getSelectedRowKeys())
        empsTable.setRowKey(empKey);
        JUCtrlHierNodeBinding data = (JUCtrlHierNodeBinding)empsTable.getRowData();
        list.add(data.getRow().getKey());
        return list;
        }
}




14) Now Drag and drop PanelGroup Layout on before af:Table. Look at the below snap
15) Now go to your view object, double click to open it and from java tab, click edit icon in front of client interface and from popup move deleteEmps to right as shown below. It will now appear in your data control.

16) Now go to your jsf page again and then go to data control and drag and drop deleteEmps on PanelGroupLayout and choose ADF button. see below snap.
17) In value field choose expression builder select the method of your bean as shown below
18) then click ok and then go to your jsf page again and after this from data control operation section choose commit function and then drop it on panelGroupLayout as adf button.

19) Now one last thing go to binding from jsf page and form binding section  choose deleteEmps and then click on source tab. the code will be like this

<methodAction id="deleteEmps" RequiresUpdateModel="true" Action="invokeMethod" MethodName="deleteEmps"
                  IsViewObjectMethod="true" DataControl="AppModuleDataControl"
                  InstanceName="data.AppModuleDataControl.EmployeeVo1" IterBinding="EmployeeVo1Iterator">
      <NamedData NDName="empKeys" NDValue="#{delEmps.empsTable}" NDType="java.util.List&lt;oracle.jbo.Key>"/>
    </methodAction>

change it to


<methodAction id="deleteEmps" RequiresUpdateModel="true" Action="invokeMethod" MethodName="deleteEmps"
                  IsViewObjectMethod="true" DataControl="AppModuleDataControl"
                  InstanceName="data.AppModuleDataControl.EmployeeVo1" IterBinding="EmployeeVo1Iterator">
      <NamedData NDName="empKeys" NDValue="#{delEmps.empsTable}" NDType="java.util.List"/>
    </methodAction>

I have just removed &lt;oracle.jbo.Key from about code. save all the code and go to jsf page and run it and test it.

Wednesday, February 20, 2013

Oracle ADF Dynamic Region, Runtime content changing

In one of my projects, I have a requirement to change pages at run time when somebody click on a link .I have used ADF dynamic region to achieve this. Here i will show you how to implement dynamic region in Oracle ADF.

1) Create two entity objects named employees and departments and then their view objects.

2) Create a new app module and add these view object to it so that we would work on view layer.

3) Create two task flow name EmployeeTF and DepartmentTF as shown in following figures




4) Drag and drop a view component from component pallet and add it on EmployeeTF and give it name like EmployeePage and double click on it. Click ok to choose defaults and drag and drop employeeview1 data control on it as a read only table.




5) similarly drag and drop a view object from component pallet and drop it on DepartmentTF.xml file. now double click to open it and give it name like DepartmentPage and click ok. now drag and drop departmentview1 data control on DepartmentPage as read only table.

6) Now its time to create dynamic region. create new jsf page dynamicRegion.jsf, from page templates select Oracle three column layout then click ok.

7) Drag and drop EmployeeTF.xml into center of dynamicRegion.jsf and choose dynamic region and it will prompt for bean. click plus icon to create it. give the name and class name "dynamicRegion" and from scope select "view" .see example snaps.


8) Click ok if any popup appears. Now drag and drop EmployeeTF.xml to start facet of page and choose dynamicregionlink-dynamicregion1. see snap for clarification


9) Similarly drag and drop DepartmentTF.xml and drop it on start facet just like step 8 and choose dynamicregionlink-dynamicregion1. The page will look like this.



10) save all and right click on dynamicResion.jsf and click run. following snap showing the result.


Wednesday, February 6, 2013

What is Oracle ADF Mobile AMX

AMX stand for ADF Mobile XML, It is a subframewok within ADF mobile. It provides different components for development of mobile applications for example Layout, data and fields components. It is valid for both iOS and android phones. AMX also supports some of Oracle ADF components, data controls, bindings and the expression language.

Tuesday, February 5, 2013

Oracle ADF Mobile , ADF Mobile Performance, Future of ADF mobile

    I was very confused about Oracle ADF Mobile. I was confused whether Oracle ADF Mobile future will be good or not. ADF Mobile performance was another confusion . Should we start learning ADF mobile and what about the Market of ADF mobile. I discussed these things on ADF OTN forum and the replied answers are very nice and cleared everything.

   Now I am very motivated about ADF Mobile. I have already good know how of Oracle ADF and some other Oracle related technology stack and in my point of view ADF mobile will be ice on a cake. Please must read this useful thread if you are mobile development lover.

ADF Mobile: Confusion

Wednesday, January 30, 2013

About Oracle ADF future and Importance of ADF for Java Developer

Recently I have read a very useful article about Oracle Application Development Framework (ADF) Importance, future and ADF importance for Java developer. I have read many blogs and other forums where people have asked about future of Oracle ADF and I myself was one of them :P. But I realized that with the passage of time ADF getting mature. You know Oracle already developing their application by using ADF and now the Oracle ADF Mobile will be ice on a cake in my point of view.

 This post will help you to understand about Oracle ADF, Why ADF, Future of ADF, and how to get started with Oracle ADF. Please must read this post.


Dear Java/JEE developer – why should you care about ADF?



Saturday, June 9, 2012

Increase LOV size in Oracle ADF JDeveloper

Some Time we need to increase the LOV (List of Values) Size in Oracle ADF form. So to Increase its size

1) Click On the LOV
2) Go To properties
3) Then go to "Content Style" Property
4) write "width:190px" in it and then save the Project.
5) Now the Size of LOV will Increase


Friday, June 8, 2012

Transient Attribute in Oracle ADF 11g

We Know That attributes in entity objects comes from underlying database tables. But some time we want an attribute for showing some results or multiplication or addition or something else for two attributes. But we have not any attribute in our database. So how we can perform this types of tasks.

We can use a Transient Attribute for this purpose. Transient Attribute has no link to database it just use to show some informations i.e total salary etc.We can use groovy and java language to assign values to this attribute.
  To create a Transient Attribute;
1) Go to Your entity Object and Open it.
2) Go to Attributes tab.
3) Click on Green Plus button and select "add new attribute"
4) Give the name of attribute and then from detail tab select "Transient" and then set its data types
accordingly.

Friday, May 18, 2012

Merging Table Column in Oracle ADF

Some time we require to merge two or more column in Oracle ADF table under one heading. I am posting because I need this solution to Implement in my project. So after solving this problem I decide to Post this solution for Oracle ADF developer.
Just Follow the following steps. Lets Suppose I want "delete" and "edit" operation under one heading name
"Operations"
1) In Your ADF table add a new column from Component Pallete.
2) Now Add a Delete Operation from your data control of that table and add it as commandtoolbarButton.
3) Now Right Click on This button go to surround it by toolbar.
4) Now add another commandToolbarButton from Component Pallete and also add it in your delete operation column, after this surround it by toolbar and then you got your required result.
Hope this will solve your problem