VaadIn Visual Designer - 面板问题

时间:2015-05-05 22:28:15

标签: java eclipse vaadin vaadin7

我使用Vaadin Labs的Visual Designer创建了一个VaadIn Design

它是一个基本的登录面板



<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8" name="design-properties" content="{&quot;RULERS_VISIBLE&quot;:true,&quot;GUIDELINES_VISIBLE&quot;:false,&quot;SNAP_TO_OBJECTS&quot;:true,&quot;SNAP_TO_GRID&quot;:true,&quot;SNAPPING_DISTANCE&quot;:10.0,&quot;PAPER_WIDTH&quot;:1440,&quot;PAPER_HEIGHT&quot;:900,&quot;JAVA_SOURCES_ROOT&quot;:&quot;src&quot;,&quot;THEME&quot;:&quot;sws_7_2&quot;}">
 </head> 
 <body> 
  <v-panel caption="Login" width="40%" height="40%" _id="login"> 
   <v-vertical-layout spacing="true" size-full="true" margin=""> 
    <v-horizontal-layout spacing="true" width-full="true"> 
     <v-label size-auto="true" plain-text="" :middle="" :right="" _id="lblLoginName">
       Login naam : 
     </v-label> 
     <v-text-field :middle="" _id="txtLoginName"></v-text-field> 
    </v-horizontal-layout> 
    <v-horizontal-layout spacing="true" width-full="true"> 
     <v-label size-auto="true" plain-text="" :middle="" :right="" _id="lblPassword">
       Paswoord : 
     </v-label> 
     <v-text-field :middle="" _id="txtPassword"></v-text-field> 
    </v-horizontal-layout> 
    <v-horizontal-layout spacing="true" width-full="true"> 
     <v-button plain-text="" :middle="" :right="" _id="btnLogin">
       Login 
     </v-button> 
     <v-button plain-text="" :middle="" _id="btnCancel">
       Annuleren 
     </v-button> 
    </v-horizontal-layout> 
    <v-horizontal-layout spacing="true" width-full="true"> 
     <v-button plain-text="" :middle="" :center="" _id="btnLoginPasswordForgotten">
       Login / paswoord vergeten? 
     </v-button> 
    </v-horizontal-layout> 
    <v-horizontal-layout width-full="true"> 
     <v-label width="6px" plain-text="" :middle="" :center="" _id="lblError"></v-label> 
    </v-horizontal-layout> 
   </v-vertical-layout> 
  </v-panel>  
 </body>
</html>
&#13;
&#13;
&#13;

当我调用loginscreen(下面的代码)时,我看到了它,但我无法用它做任何事情。 ClickListner无法正常工作,我甚至无法更改标签值或其他内容......

public class Login extends LoginDesign implements Button.ClickListener {
private static final long serialVersionUID = 1L;
private UI mainUI;
private ClickListener listner = this;

public Panel createLoginPanel(UI mainUI) {
    this.mainUI = mainUI;
    LoginDesign login = new LoginDesign();
    btnLogin.addClickListener(listner);
    lblError.setValue("Problem");
    System.out.println(lblError.getValue());
    return login;
}....

我在控制台中看到lblError的更改值,但屏幕上没有...?

通常,您可以创建按钮并添加标题和监听器。在这里,我需要分别添加听众......?!

我做错了什么......有什么建议! THX!

1 个答案:

答案 0 :(得分:0)

解决了它。

我接受了生成文件的实例,但您需要使用扩展类..。

public class Login extends LoginDesign implements Button.ClickListener {
private static final long serialVersionUID = 1L;

private UI mainUI;

private ClickListener listner = this;

public Panel createLoginPanel(UI mainUI) {
    this.mainUI = mainUI;
    Login login = new Login();
    btnLogin.addClickListener(listner);
    lblError.setValue("Problem");
    System.out.println(lblError.getValue());
    return login;
}....

解决了它