作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 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/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!