Thursday, 19 October 2017

JDeveloper R12 Popup for DML Operations

Popup Operations:
1.       Create new ADF Application.
2.       Create ADFTaskflow fragment.
3.       Create a View Activity.
4.       Double click on View Activity.
5.       Select Department VO, Click and Drag as ReadOnly.
6.       Select Table and surround with PanelCollection.
7.       Select Panel Collection.
8.       Select Toolbar in Components, Click and Drag into Toolbar section of PanelCollection.
9.       Insert 4 Buttons in Toolbar. Add, Edit and Delete.
10.   Insert three popup components in PanelCollection.
11.   Select First Popup and select properties common properties of popup Id=>pNew, Content Delivery => LazyUnched.
12.   Select Second Popup and select properties common properties of popup Id=>pEdit, Content Delivery => LazyUnched.
13.   Select Third Popup and select properties common properties of popup Id=>pDelete, Content Delivery => LazyUnched.
14.   Insert three Dialog component in each popup.
15.   Drag and drop updatable View instance from Data Control to Dialog box of pNew (First) popup.
16.   Drag and drop updatable View instance from Data Control to Dialog box of pEdit (Second) popup.
17.   Drag and drop ReadOnly View instance from Data Control to Dialog box of pDelete (Third) popup.
18.   Select Popup Behaviour Component, Click and drag into Button1 (New), Select PopupId (pNew).
19.   Select Popup Behaviour Component, Click and drag into Button2 (Update), Select PopupId (pEdit).
20.   Select Popup Behaviour Component, Click and drag into Button3 (Delete), Select PopupId (pDelete).
21.   Mouse right click on ViewController. New => From Gallery => General => Java Class.
22.   Type DeptInfoPage in Name, Click on Ok.
23.   Double click on Taskflow Definition.xml file, Click on Managed Beans.
24.   Enter Name: DeptInfoPage Class: view. DeptInfoPage Scope: view.
25.   Select pNew Popup, Double click on dialog in Structure Window.
26.   Properties for dialog: Title => Add New Department Info, CloseIconVisible=>false
27.   Double click on .jsff page, Right mouse click on Table blank area. Click on Bindings.
28.   Click on Bindings [+] sign. Double click on Action, Select DataModel, VO, Operations => CreateInsert => Click on Ok.
29.   Similarly add Delete, Commit and Rollback.
30.   Create ManagedBean method for pNew popup.
31.   Select pNew popUp, Select properties popUpFetchListner=> Edit => Choose ManagedBean, Create New Method name (onNewDept)
32.   Select pNew popup dialog, Properties Behaviour => Dialog Listener => Edit => Choose Managed Bean -=> Enter (onOkCancelforNewpopup).
33.   Create Operation Binding for Table: Select table, Select Advanced=>Binding => Edit , Managed Bean Name,  property Name => deptTableBind.







    public void onNewDept(PopupFetchEvent popupFetchEvent) {
        BindingContainer bc= BindingContext.getCurrent().getCurrentBindingsEntry();
        OperationBinding opb= bc.getOperationBinding("CreateInsert");
        opb.execute();
    }

    public void onOkCancelforNewpopup(DialogEvent dialogEvent) {
        if(DialogEvent.Outcome.ok==dialogEvent.getOutcome().ok) {
            BindingContainer bc= BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding opb= bc.getOperationBinding("Commit");
            opb.execute();
            AdfFacesContext.getCurrentInstance().addPartialTarget(deptTableBind);
        }
        else {
            BindingContainer bc= BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding opb= bc.getOperationBinding("Rollback");
            opb.execute();
        }
    }
   
    public void onDeleteDept(DialogEvent dialogEvent) {
        if(DialogEvent.Outcome.ok==dialogEvent.getOutcome().ok) {
            BindingContainer bc= BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding opbd= bc.getOperationBinding("Delete");
            opbd.execute();
            OperationBinding opb= bc.getOperationBinding("Commit");
            opb.execute();
            AdfFacesContext.getCurrentInstance().addPartialTarget(deptTableBind);
           //Change Event Policy = None, set Immediate property to True
        }
        else {
           // BindingContainer bc= BindingContext.getCurrent().getCurrentBindingsEntry();
           // OperationBinding opb= bc.getOperationBinding("Rollback");
           // opb.execute();
        }
    } 

No comments:

Post a Comment