Yesterday i saw in the OTN Forum about the Advance Option hide in ListOfValues
http://forums.oracle.com/forums/thread.jspa?threadID=2153584&tstart=0
I made a sample long time ago for setting access keys for "OK" and "Cancel" Buttons in ListOfValues, which Mr.Frank Nimphius has posted in "Nov-2010" month OTN Harvest. Further to the sample i thought of extending it to hide the Advance button option.
Download Link Sample For Access Key And Advance Hide
In the below output screen you can see that AccessKey for OK and Cancel And AdvanceMode of LOV is not visible.
Output Screen:
Program Logic :
Basically we need to get the LOV Object in our control which we can get after the popup is launched, for that we need af:serverlistener to call java method in our af:form.
For Invoking the ServerListener we need generate runtime javascript using ExtendedRenderKit which the current ListOfValues component Id as parameter to the ServerListener.
Inside the LaunchPopupListener we need to write the logic of adding the javascript.
<af:serverListener type="lovafterlaunch"
method="#{lovBean.lovAfterLaunch}"/>
The Script which is generated the at the runtime will invoke the method which we have mentioned in the serverlistener.
Inside the method we can access the RichPopup , RichDialog & RichQuery of the RichInputListOfValues by the below code.
http://forums.oracle.com/forums/thread.jspa?threadID=2153584&tstart=0
I made a sample long time ago for setting access keys for "OK" and "Cancel" Buttons in ListOfValues, which Mr.Frank Nimphius has posted in "Nov-2010" month OTN Harvest. Further to the sample i thought of extending it to hide the Advance button option.
Download Link Sample For Access Key And Advance Hide
In the below output screen you can see that AccessKey for OK and Cancel And AdvanceMode of LOV is not visible.
Output Screen:
Program Logic :
Basically we need to get the LOV Object in our control which we can get after the popup is launched, for that we need af:serverlistener to call java method in our af:form.
For Invoking the ServerListener we need generate runtime javascript using ExtendedRenderKit which the current ListOfValues component Id as parameter to the ServerListener.
Inside the LaunchPopupListener we need to write the logic of adding the javascript.
Next we need to Place the serverlistener in our jspx after af:form.public void lovLaunch(LaunchPopupEvent launchPopupEvent) { RichInputListOfValues inputListOfValues = RichInputListOfValues)launchPopupEvent.getComponent(); if (inputListOfValues != null) { FacesContext facesContext = FacesContext.getCurrentInstance(); String clientId = inputListOfValues.getClientId(facesContext); StringBuffer scriptBuffer = new StringBuffer(); scriptBuffer.append(" var docComp = AdfPage.PAGE.findComponent(\"f1\"); var comp = AdfPage.PAGE.findComponent(\""); scriptBuffer.append(clientId).append("\"); "); scriptBuffer.append(" if (comp != null && docComp != null) { var CompId = comp.getId(); "); scriptBuffer.append(" AdfCustomEvent.queue(docComp,\"lovafterlaunch\",{compId:CompId},true);}"); String script = scriptBuffer.toString(); ExtendedRenderKitService erks = Service.getService(facesContext.getRenderKit(), ExtendedRenderKitService.class); erks.addScript(facesContext, script); } }
<af:serverListener type="lovafterlaunch"
method="#{lovBean.lovAfterLaunch}"/>
The Script which is generated the at the runtime will invoke the method which we have mentioned in the serverlistener.
Inside the method we can access the RichPopup , RichDialog & RichQuery of the RichInputListOfValues by the below code.
public void lovAfterLaunch(ClientEvent clientEvent) { if (clientEvent.getParameters().size() > 0 && clientEvent.getParameters().get("compId") != null) { String compId = clientEvent.getParameters().get("compId").toString(); RichInputListOfValues inputListOfValues = (RichInputListOfValues)JSFUtils.findComponentInRoot(compId); if (inputListOfValues != null) { IteratorfacetNames = inputListOfValues.getFacetNames(); RichPopup richPopup = null; String facetName = null; UIComponent componentFacet = null; UIComponent componentdialog = null; while(facetNames.hasNext()) { facetName = facetNames.next(); if (facetName != null) { componentFacet = inputListOfValues.getFacet(facetName); if (componentFacet != null && componentFacet instanceof RichPopup) { richPopup = (RichPopup)componentFacet; break; } } } if (richPopup != null) { List uiCompList = richPopup.getChildren(); if (uiCompList.size() > 0) { componentdialog = uiCompList.get(0); if (componentdialog != null && componentdialog instanceof RichDialog) { RichDialog richDialog = (RichDialog)componentdialog; if (richDialog != null) { richDialog.setAffirmativeTextAndAccessKey("&OK"); richDialog.setCancelTextAndAccessKey("&Cancel"); AdfFacesContext.getCurrentInstance().addPartialTarget(richDialog); if (richDialog.getChildCount() == 1 && richDialog.getChildren().get(0) != null && richDialog.getChildren().get(0) instanceof RichPanelGroupLayout) { RichPanelGroupLayout panelGroupLayout = (RichPanelGroupLayout)richDialog.getChildren().get(0); uiCompList = panelGroupLayout.getChildren(); if (uiCompList.size() > 0 && uiCompList.get(0) != null && uiCompList.get(0) instanceof RichPanelHeader) { RichPanelHeader richPanelHeader = (RichPanelHeader)uiCompList.get(0); if (richPanelHeader.getChildCount() == 1 && richPanelHeader.getChildren().get(0) != null && richPanelHeader.getChildren().get(0) instanceof RichQuery) { RichQuery richQuery = (RichQuery)richPanelHeader.getChildren().get(0); if (richQuery != null) { richQuery.setModeChangeVisible(false); AdfFacesContext.getCurrentInstance().addPartialTarget(richQuery); } } } } } } } } } } }
The sample app cannot be found. Is there a new location? Thanks.
ReplyDeleteSample app has been uploaded
ReplyDeleteThere is a problem when you use this resolution with required fields.
ReplyDeleteIf you have more fields which are required and you click on this InputListOfValues component
then required validation fires on another fields and error messages are appear.
Thank You and I have a dandy present: Who Repairs House Siding house repair quotes
ReplyDelete