简体   繁体   English

GWT面板类型的问题

[英]Problems with GWT panel types

thanks in advance for your help. 在此先感谢您的帮助。

I'm currently trying to create a w3c standards compliant HTML/CSS interface for a GWT app, much of this rests on using the right types of panel in the right place rather than using nested horizontal and vertical panels which write out tables in the UI. 我目前正在尝试为GWT应用创建符合w3c标准的HTML / CSS界面,其中大部分取决于在正确的位置使用正确的面板类型,而不是使用嵌套的水平和垂直面板在UI中写出表格。

I'm a total n00b at GWT and cannot figure out why replacing the top Vertical Panel in the code below causes the app to stop working. 我在GWT上总共是n00b,无法弄清楚为什么替换下面代码中的顶部“垂直面板”会导致应用停止运行。 Any UI coding resources, advice of any kind would be very much appreciated. 任何UI编码资源,任何形式的建议都将不胜感激。

<g:VerticalPanel>
    <g:FormPanel ui:field="loginFormPanel" action="/cms/j_acegi_security_check.rpc" >
      <g:HTMLPanel>     

          <g:Label ui:field="signinLabel" styleName="{style.signinStyle}">
            <ui:msg key="signInText">Welcome to Perform CMS</ui:msg>
          </g:Label> 



          <g:Label ui:field="emailLabel" styleName="{style.loginFontStyle}">
            <ui:msg key="emailAddress">Email adress</ui:msg>
            address
          </g:Label>  

            <g:TextBox ui:field="email" name="j_username" styleName="{style.loginTextBoxStyle}"/>

            <g:Label styleName="{style.fontStyle}" ui:field="usernameError"/>

          <g:Label ui:field="passwordLabel" styleName="{style.loginFontStyle}">
            <ui:msg key="password">Password</ui:msg>
          </g:Label>         

            <g:PasswordTextBox ui:field="password" name="j_password" styleName="{style.loginTextBoxStyle}"/>

            <g:Label styleName="{style.fontStyle}" ui:field="passwordError"/>


        <g:HTMLPanel ui:field="submitPanel">
            <g:HTMLPanel ui:field="submitButtonPanel" styleName="{style.buttonPanelStyle}">
              <g:Image url="/cms/images/new_button_search_left.png" styleName="{style.image}"></g:Image>
              <g:Label ui:field="signIn" styleName="{style.submitLabelStyle}">
                <ui:msg key="signIn">Sign in</ui:msg>
              </g:Label>
              <g:SubmitButton styleName="{style.hide}">Submit</g:SubmitButton> 
              <g:Image url="/cms/images/new_button_search_right.png" styleName="{style.image}"></g:Image>
            </g:HTMLPanel>
        </g:HTMLPanel>


        <g:HTMLPanel ui:field="submitErrorsPanel" styleName="{style.submitErrorPanel}">

          <g:Label styleName="{style.fontStyle}" ui:field="submitErrorMessages"/>
        </g:HTMLPanel>


      </g:HTMLPanel>
    </g:FormPanel> 
    <g:HTMLPanel ui:field="loginSuccessPanel" styleName="{style.hide}">
      <g:Label styleName="{style.fontStyle}" ui:field="loginSuccessMessageLabel"/>
   </g:HTMLPanel>
  </g:VerticalPanel>

You don't say how your app stops working, but the GWT compiler generates different JS for every user agent specified in your project's gwt.xml. 您没有说应用程序如何停止运行,但是GWT编译器会为项目的gwt.xml中指定的每个用户代理生成不同的JS。 By default there may be 5 or 6 different versions of your program and the right one is decided in at runtime. 默认情况下,程序可能有5或6个不同的版本,而正确的版本则在运行时确定。 These versions exist because there is no such thing as W3C compliance in browsers. 之所以存在这些版本,是因为浏览器中没有W3C合规性。 One browser might get closer than others but all have their quirks that GWT tries to hide you from. 一种浏览器可能会比其他浏览器靠近,但是所有浏览器都有其古怪之处,GWT试图将您隐藏起来。

The GWT vertical panel at your root usually gets turned into a table with each child being a cell in a row. 您根部的GWT垂直面板通常会变成一张桌子,每个孩子都是一个单元格。 Note you still need a root element in the XML, but it could be a flow or html panel. 请注意,您仍然需要XML中的根元素,但是它可以是流面板或html面板。 Changing from a vertical panel will probably cause the child elements to flow sideways or do other weird things. 从垂直面板更改可能会导致子元素向侧面流动或发生其他奇怪的事情。 If you wanted them to stay vertical you could throw a <br> between them, or style the enclosing <div> . 如果希望它们保持垂直,则可以在它们之间扔一个<br> ,或设置封闭的<div>样式。

The best thing to do for layout issues is to install a tool into your browser which allows you to inspect the DOM. 解决布局问题的最佳方法是在浏览器中安装一个工具,使您可以检查DOM。 For example, Firefox has Firebug, IE has the IE Developer Toolbar, Opera has a developer console etc. You can select the errant element and see its place in the hierarchy as well as which styles apply to that element. 例如,Firefox具有Firebug,IE具有IE开发人员工具栏,Opera具有开发人员控制台等。您可以选择errant元素并查看其在层次结构中的位置以及适用于该元素的样式。 Firebug even let you tweak styles in real time which can be handy for on the spot experimentation. Firebug甚至可以让您实时调整样式,这对于现场实验非常方便。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM