我使用Vaadin Labs的Visual Designer创建了一个VaadIn Design
它是一个基本的登录面板
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="design-properties" content="{"RULERS_VISIBLE":true,"GUIDELINES_VISIBLE":false,"SNAP_TO_OBJECTS":true,"SNAP_TO_GRID":true,"SNAPPING_DISTANCE":10.0,"PAPER_WIDTH":1440,"PAPER_HEIGHT":900,"JAVA_SOURCES_ROOT":"src","THEME":"sws_7_2"}">
</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;
当我调用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!
答案 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;
}....
解决了它