Thursday 26 December 2013

How to do hour and time format restriction for inputText



The below code required for the time format restriction to restrict the time for up to 23:59


<af:inputText label="" id="time" simple="true" value="" contentStyle="width:30px;"                  maximumLength="5">

<af:validateRegExp pattern="([01][0-9]|2[0-3]):[0-5][0-9]" messageDetailNoMatch="Time   Format must match HH:MM" hint="Time Format: HH:MM"/>

</af:inputText>

Thanks..

Wednesday 25 December 2013

af:inputDate disabling the input through keyboard


The below code will use to disabling the keyboard input on af:inputDate


<f:view>

        <af:document title="PanelBoxDemo.jspx" id="d1" binding="#{backingBeanScope.backing_PanelBoxDemo.d1}">

        <af:resource type="javascript">

       function disableDatePicker(evt){

        evt.cancel();

       }

     </af:resource>

            <af:form id="f1" binding="#{backingBeanScope.backing_PanelBoxDemo.f1}">

                <af:inputDate label="Label 1" id="id1" binding="#{backingBeanScope.backing_PanelBoxDemo.id1}">

                    <af:clientListener method="disableDatePicker" type="keyDown"/>

                </af:inputDate>

            </af:form>

        </af:document>
    </f:view>

Thanks..

Disclose the panel Box with a double-click on the header


The below code will use to disclose the panel Box with double-click on the header.


<f:view>

        <af:document title="PanelBoxDemo.jspx" id="d1" binding="#{backingBeanScope.backing_PanelBoxDemo.d1}">

        <af:resource type="javascript">

       function openPanelBox(mouseEvent){

          var pbx = mouseEvent.getSource();

          pbx.broadcast(new AdfDisclosureEvent(pbx, !pbx.getDisclosed()));

       }

     </af:resource>

            <af:form id="f1" binding="#{backingBeanScope.backing_PanelBoxDemo.f1}">

                <af:panelBox text="PanelBox1" id="pb1" binding="#{backingBeanScope.backing_PanelBoxDemo.pb1}">

                    <f:facet name="toolbar"/>

                    <af:clientListener method="openPanelBox" type="dblClick"/>

                </af:panelBox>

            </af:form>

        </af:document>

    </f:view>

Thanks..

Sunday 15 December 2013

How to display Error/Warning/Information/Exception Messages in ADF Applications

This blog we will see how to display Error/Warning/Information/Exception Messages in backing bean and implementation class.

The below example required for displaying error message from backing bean:

FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while Execution","Error while Execution");
facesCntx.addMessage(null,msg);


The below example required for displaying warning message from backing bean:

FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Execute Successfully", "Execute Successfully");
facesCntx.addMessage(null,msg);


The below example required for displaying information message from backing bean:

FacesContext facesCntx = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Executed Successfully", "Executed Successfully");
facesCntx.addMessage(null,msg);


The below example required for displaying warning message from implementation class:

getDBTransaction().addWarning(new JboWarning("Warning Occur"));


The below example required for displaying exception message from implementation class:


throw new JboException("Exception Occur");


Thanks..

Saturday 14 December 2013

Working with different scopes in ADF

This blog we will see how to use the different scopes like Application Scope, PageFlow Scope, Session Scope, Request Scope in ADF.

Request Scope:

FacesContext fcx =FacesContext.getCurrentInstance();
 

// Set Into Request Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx.getRequestMap().put("key","value");
 

//get Request Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx .getRequestMap ().get("key");


Application Scope:

FacesContext fcx =FacesContext.getCurrentInstance();
 

// Set Into Application Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx.getApplicationMap().put("key","value");
 

//get Application Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx . getApplicationMap ().get("key");


Session Scope:

FacesContext fcx =FacesContext.getCurrentInstance();


// Set Session Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx.getSessionMap ().put("key","value");


//get Session Scope value
ExternalContext exCntx =fcx.getExternalContext();
exCntx . getSessionMap ().get("key");


PageFlow Scope:

// Set Into PageFlow Scope value
RequestContext.getCurrentInstance().getPageFlowScope().put("key","value);
 

// Get PageFlow Scope value
RequestContext.getCurrentInstance().getPageFlowScope().get(name);


Thanks..