智能gwt。如何确定加载何时完成

时间:2010-11-23 16:40:46

标签: smartgwt progress

我正在尝试编写一个进度条或向我的Smart Gwt应用程序添加一个加载gif,该应用程序从onModuleLoad开始,并在应用即将显示时结束。是否有某种类型的事件处理程序可以确定这个?我看了,但我没有找到任何东西。

1 个答案:

答案 0 :(得分:2)

注意到在搜索其他内容时没有人回答过这个问题。 如果您查看SmartGWT展示,他们会在应用程序加载时显示一个弹出窗口。在我的应用程序中,我在那里采用了这种机制,您只需将其添加到您的webapp.html:

作为<head>

的一部分
<!--CSS for loading message at application Startup-->
<style type="text/css">
    body { overflow:hidden }
    #loading {
        border: 1px solid #ccc;
        position: absolute;
        left: 45%;
        top: 40%;
        padding: 2px;
        z-index: 20001;
        height: auto;
    }

    #loading a {
        color: #225588;
    }

    #loading .loadingIndicator {
        background: white;
        font: bold 13px tahoma, arial, helvetica;
        padding: 10px;
        margin: 0;
        height: auto;
        color: #444;
    }

    #loadingMsg {
        font: normal 10px arial, tahoma, sans-serif;
    }
</style>

作为加载WebApp.nocache.js的脚本标记前<body>的一部分:

<!--add loading indicator while the app is being loaded-->
<div id="loadingWrapper">
<div id="loading">
<div class="loadingIndicator">
    <!--<img src="images/pieces/48/cube_green.gif" width="32" height="32" style="margin-right:8px;float:left;vertical-align:top;"/>SmartGWT<br/>-->
    <img src="WebApp/sc/skins/EnterpriseBlue/images/loading.gif" width="16" height="16" style="margin-right:8px;float:left;vertical-align:top;"/>WebApp<br/>
    <span id="loadingMsg">Loading styles and images...</span></div>
    </div>
</div>

<!--load skin-->
<script type="text/javascript">document.getElementById('loadingMsg').innerHTML = 'Loading skin...';</script>

<script type="text/javascript">
document.write("<"+"script src=WebApp/sc/skins/EnterpriseBlue/load_skin.js isc_version=7.1.js><"+"/script>");
</script>

<script type="text/javascript">document.getElementById('loadingMsg').innerHTML = 'Loading Application<br>Please wait...';</script>
<!--include the application JS-->