我正在使用jdeveloper中的adf。我有一个af:inputfile,它使用valuechangelistener来检查文件类型,然后上传到服务器。
我需要在这些过程发生时显示弹出窗口(加载图像)。
我已经尝试了下面的代码,但是弹出窗口总是在流程完成后显示,但它不会隐藏:
这是输入文件代码:
<af:inputFile label="Invoice Document" id="if1"
valueChangeListener="#{invoiceBatchManagedBean.onAddInvoiceDocument}"
showRequired="true" required="true" immediate="false" autoSubmit="true"
readOnly="#{pageFlowScope.uploadPageStateViewBean.inReadOnlyState}" />
这是弹出代码:
<f:view>
<af:document id="d1" title="#{ipmPortalResource['supplierInvoice.title']}">
<af:resource type="javascript" source="../../../../js/pop-up.js"/>
<af:form id="f1" usesUpload="true">
<af:popup id="p1" contentDelivery="immediate" clientComponent="true" binding="#{pageFlowScope.InvoiceBatchManagedBean.myGlassPane}">
<af:dialog id="d2" type="none" title="" closeIconVisible="false">
<af:panelGroupLayout id="pgl1" layout="vertical">
<af:image source="../../../../images/loading0.png" inlineStyle="width:130px;height:45px;border:none;" id="i3"/>
<af:image source="../../../../images/loading1.gif" id="i2" inlineStyle="margin-left:42.5px;margin-right:auto;margin-bottom:15px;width:50px;height:50px;border:none;"/>
<af:outputText value="please wait ..." id="ot11z"/>
</af:panelGroupLayout>
</af:dialog>
</af:popup>
....
这是javascript代码:
function enforcePreventUserInput(evt){
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');
if (popup != null){
AdfPage.PAGE.addBusyStateListener(popup,handleBusyState);
evt.preventUserInput();
}
}
//JavaScript call back handler
function handleBusyState(evt){
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');
if(popup!=null){
if (evt.isBusy()){
popup.show();
} else if (popup.isPopupVisible()) {
popup.hide();
AdfPage.PAGE.removeBusyStateListener(popup, handleBusyState);
}
}
}
这是由managedfile中的valuechangelistener调用的函数:
public void onAddInvoiceDocument(ValueChangeEvent valueChangeEvent) {
this.showPopup(getMyGlassPane());
try{
UploadedFile file = (UploadedFile) valueChangeEvent.getNewValue();
this.onAddDocument(file, INVOICE_DOCUMENT_TYPE,true);
}catch(Exception ex){
RichInputFile comp = (RichInputFile) valueChangeEvent.getComponent();
comp.setValid(false);
comp.setValue(null);
JSFUtils.addFacesErrorMessage(ex.getMessage());
}
this.hidePopup(getMyGlassPane());
}
public void showPopup(RichPopup popup) {
FacesContext fct = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(fct, ExtendedRenderKitService.class);
service.addScript(fct,"AdfPage.PAGE.findComponent('p1').show();");
}
//method to hide the glass pane component
public void hidePopup(RichPopup popup) {
FacesContext fct = FacesContext.getCurrentInstance();
ExtendedRenderKitService service = Service.getRenderKitService(fct,ExtendedRenderKitService.class);
service.addScript(fct, "AdfPage.PAGE.findComponent('p1').hide();");
}
有人可以帮忙吗?
答案 0 :(得分:-1)
你做了很长的解释,我无法察觉你的真正问题是什么。但是我认为你想要实现的目标在这里解释:
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/27-long-running-queries-169166.pdf
http://tamanmohamed.blogspot.com/2012/06/adf-how-to-use-afpopup-during-long.html