gpt4 book ai didi

java - 如何在使用 inputfile adf 上传文件时显示弹出窗口

转载 作者:行者123 更新时间:2023-11-29 09:29:53 24 4
gpt4 key购买 nike

我在 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);
}
}
}

这是managedbean中inputfile的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();");
}

有人可以帮忙吗?

最佳答案

你做了很长的解释,我无法发现你真正的问题是什么。但是我认为你想要实现的是在这里解释:

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

关于java - 如何在使用 inputfile adf 上传文件时显示弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23287085/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com