GWT代码拆分下载progressbar-like gmail

GWT代码拆分下载progressbar-like gmail,gwt,download,progress-bar,Gwt,Download,Progress Bar,我必须在我的项目中使用代码拆分。但是无论如何,有一些代码是第一次下载的 现在我想向最终用户展示代码下载(.cache.html-或其他代码拆分)的进度,比如gmail启动进度 你能帮帮我吗 RGDSGWT没有任何类似进度条的小部件。我还想将此功能添加到我的应用程序中,但我不能 您可以使用孵化器进度条 也许你可以试试这个,如果它有效或无效,请发表评论 我只发送html文件给你。您可以根据您的代码进行设计。 这真是太棒了。有一个div元素,包括“加载”。当页面第一次加载简单html时,将显示加载文本

我必须在我的项目中使用代码拆分。但是无论如何,有一些代码是第一次下载的

现在我想向最终用户展示代码下载(.cache.html-或其他代码拆分)的进度,比如gmail启动进度

你能帮帮我吗


RGDS

GWT没有任何类似进度条的小部件。我还想将此功能添加到我的应用程序中,但我不能

您可以使用孵化器进度条


也许你可以试试这个,如果它有效或无效,请发表评论

我只发送html文件给你。您可以根据您的代码进行设计。 这真是太棒了。有一个div元素,包括“加载”。当页面第一次加载简单html时,将显示加载文本。加载html文件后,nocache.js文件将启动(仍然是可见的loaidng文本)。在js文件加载之后,onmoduleload脚本将启动(仍然可以看到文本加载),在创建所有小部件和面板等准备就绪之后。尝试下面的代码并从屏幕上删除“加载”文本

com.google.gwt.user.client.Element loading = DOM.getElementById("loading");
DOM.removeChild(RootPanel.getBodyElement(), loading);
proje.html

 <!doctype html>
<!-- The DOCTYPE declaration above will set the    -->
<!-- browser's rendering engine into               -->
<!-- "Standards Mode". Replacing this declaration  -->
<!-- with a "Quirks Mode" doctype may lead to some -->
<!-- differences in layout.                        -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <!--                                                               -->
    <!-- Consider inlining CSS to reduce the number of requested files -->
    <!--                                                               -->
    <link type="text/css" rel="stylesheet" href="<proje>.css">
    <link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css" />

    <!--                                           -->
    <!-- Any title is fine                         -->
    <!--                                           -->
    <title><Proje></title>

    <!--                                           -->
    <!-- This script loads your compiled module.   -->
    <!-- If you add any GWT meta tags, they must   -->
    <!-- be added before this line.                -->
    <!--                                           -->
    <script type="text/javascript" language="javascript" src="<proje>/<proje>.nocache.js"></script>
  </head>

  <!--                                           -->
  <!-- The body can have arbitrary html, or      -->
  <!-- you can leave the body empty if you want  -->
  <!-- to create a completely dynamic UI.        -->
  <!--                                           -->
  <body>

    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

    <!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
    <noscript>
      <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">

      </div>
    </noscript>

    <div align="center" id="loading"> 
        <table style="height:600px;" border="0">
            <tr height="100%">
                <td align="center">
                    <b>Loading...</b>
                </td>
            </tr>
        </table>
    </div>

    <div id="main" style="display:none">
       <table border="0" width="100%" height="100%" align="center" cellspacing="0">
              <tr>
                <td colspan="2" width="100%" id="ustMenuPanel"></td>
              </tr>
              <tr height="100%" valign="top">
                <td id="menuPanel" width="20%"></td>
                <td id="modulPanel" width="80%"></td>
              </tr>
        </table>
    </div>
  </body>
</html>

加载。。。
根据(大致上)的说法,它提到了在有意义的地方分离模块,因为它在技术上不支持预取;也就是说,我只能假设GMail根据通过回调检查的模块加载进度显示进度(即
GWT.runAsync()
)。并非所有模块的大小都相同,但您可以“猜测”并为每个模块分配一个加权百分比(参见GWT)

  • 如果您的初始页面大小下载量很大(>=1MB),我建议您考虑重构和优化您的设计,使其更加轻量级(scaffolding)。这将意味着更多的服务器访问,但限制初始下载大小。这将为向用户提供更精确的反馈提供依据,即页面正在“工作”(即不确定的进度条),并避免不必要的精度

  • 总页面大小是一件很难在通往客户机/浏览器的过程中真正测量的事情,向用户显示这一点会带来更多麻烦。您可能可以通过几个轻量级模块来实现这一点,但您必须补偿所有生成的资源,如
    ClientBundle
    ,因为GWT为每个浏览器排列创建一个特定的集合

  • 旁注
    在将文件(例如图像、视频、音乐等)下载到用户硬盘驱动器时,通常使用实时反馈,例如文件大小精度进度(例如1.29MB的80 KB(6%完成))。此时的数据不再是暂时的,存储空间可能是一个问题,缓存被清除并刷新,因此网页的大小通常不是什么大问题

    您可以采用与相同的方法,即在应用程序加载时仅显示动画gif。加载应用程序后,它会通过主机页的dom结构删除动画gif。

    问题是,用户不知道加载了多少。你有什么想法吗,我怎么能得到像“从500kb加载100kb”这样的东西吗?@Chris_Boesing是的,你是对的,我只是试着给你问题的起点一个样本。是的,伙计们,它是有效的,但正如Chris说的,我想知道百分比是如何完成的谢谢你的回答。这个问题不是关于你的应用程序中的progressbar,而是关于在应用程序完全加载之前显示的progressbar,以便用户知道他需要等待多长时间。@Chris感谢你的评论。我只想展示progressbar及其用法