Pageviews

Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Friday, April 19, 2013

Steps to create Dynamic/Shared Popup in ADF



af:clientAttribute – This tag is used to pass the parameter from a client component such as commandLink.  In the below example, this tag is used to pass the name-value of an attribute to an ADF popup.
af:showPopupBehavior – This tag is used to launch the ADF popup in response to a client-side event. The client event is specified using the triggertype attribute. If triggertype attribute is undefined, then this attribute defaults to “action” event.
Note:
Use alignId and align attribute to position the location of the popup when it is opened.
Use shortDesc attribute to specify the tool tip.




af:setPropertyListener tag provides a declarative way to assign values when a client event is fired. “type” attribute defined as part of this tag indicate which event type it should listen. In the below example, the action has to happen when the popup is launched. So use type=”popupFetch” to set the viewScope values when the popup is launched.

launchervar – name of the variable used to reference the launch component.
eventContext - This attribute is set to “launcher” in order to retrieve the parameter values.
f:attribute tag is used to pass parameter to backend bean.





  In the back end bean, use ResetUtils  class to clear the popup component to reset the user input selections. Check out the below code samples for details.


For creating ADF dialog popup, first create a launch client component.
 
 and then add the ADF dialog popup....




Output:

Popup 1:





Popup 2:





Popup 3:


Popup 4:

Wednesday, April 3, 2013

how to add a custom alert message in ADF ?

    Today's problem to solve is, how to add a custom alert message in ADF ?
   
    ADF components has built in alert message when it comes to component level validation. But when you need to display a custom alert message before or after processing an action, then you need to something like shown below.
   
    In general there are two kinds of messages that can be created. One at the component level message and the other is global level messages. Component level messages are associated with the clientId that was passed to the addMessage method.  Global level messages are not asscociated to any components and so clientID is set to null when calling the addMessage method.





The following method needs to be added to the back-end bean.
   
    Here is an example...
   
    // import statements
    import javax.faces.application.FacesMessage;
    import javax.faces.context.FacesContext;


     /**
     * Method to display custom alert message.
     */
   public String showMessage(){
        String msg= "Global alert message to display";
        FacesContext ctx = getContext();
        FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, "");
        ctx.addMessage(null,fm);
        return null;
    }
   
          /**
     * @param
     * Method to return the current context .   
     */   
    private FacesContext getContext() {
               return FacesContext.getCurrentInstance();
        }



Other Message Severity Levels are ....

FacesMessage.Severity     SEVERITY_ERROR      Message severity level indicating an error.
FacesMessage.Severity     SEVERITY_FATAL        Message severity level indicating about a serious error.
FacesMessage.Severity     SEVERITY_INFO        Message severity level indicating an informational message.
FacesMessage.Severity     SEVERITY_WARN        Message severity level indicating a warning message.


Output: