Monday, March 18, 2013

Value Change Listener

Value Change Listener on Input Text Field

In Bean:
    public void editInputValueChangeListener(ValueChangeEvent vcl){


        System.out.println(vcl.getOldValue()); //returns old value
        System.out.println(vcl.getNewValue()); //returns new value


       //Calling AM method..
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
        OperationBinding opb = bindings.getOperationBinding("setJob");
        opb.execute();

    }

In AMImpl:

    public void setJob(){
        PprVOImpl pVO = getPprVO();
        PprVORowImpl pRow = (PprVORowImpl)pVO.first();
        System.out.println("Selected Vlaue Ename is :"+pRow.getName()); //returns OLD value
    }


Value Change Listener on Message Choice

In jspx:
In Bean:
    public void editMChoiceValueChangeListener(ValueChangeEvent vcl){


        System.out.println(vcl.getOldValue()); // returns rowid of the old value
        System.out.println(vcl.getNewValue()); // returns rowid of the new value
     
        Map p = ((UIComponent)vcl.getSource()).getAttributes();
        System.out.println("Selected Value"+p.get("rowIndexVal")); //returns old value

        vcl.getComponent().processUpdates(FacesContext.getCurrentInstance());
        Map p = ((UIComponent)vcl.getSource()).getAttributes();
        System.out.println("Selected Value"+p.get("rowIndexVal")); //returns new value
             
        //Calling AM method..
        BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
        OperationBinding opb = bindings.getOperationBinding("setJobx");
        opb.execute();
    }

In AMImpl:
    public void setJobx(){

        PprVOImpl pVO = getPprVO();
        PprVORowImpl pRow = (PprVORowImpl)pVO.first();
        System.out.println("Selected Vlaue Ename is :"+pRow.getName()); //returns NEW value
    }




Related Posts Plugin for WordPress, Blogger...