【发布时间】:2015-05-05 22:28:15
【问题描述】:
我使用 Vaadin Labs 的 Visual Designer 创建了一个 VaadIn 设计
它是一个基本的登录面板
<!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>
当我调用登录屏幕(下面的代码)时,我看到了它,但我无能为力。 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 的更改值,但在屏幕上没有...?
通常您创建按钮并添加标题和侦听器。在这里我需要单独添加监听器......?!
我做错了什么......任何建议!谢谢!
【问题讨论】:
标签: java eclipse vaadin vaadin7