Author: athimel Date: 2010-11-03 16:15:50 +0100 (Wed, 03 Nov 2010) New Revision: 3 Url: http://chorem.org/repositories/revision/incubator/3 Log: Add an example with LazyInstantiation Added: refComp/client/src/main/java/fr/inra/refcomp/client/example1/ refComp/client/src/main/java/fr/inra/refcomp/client/example1/LoginExampleLazyInstantiation.java Added: refComp/client/src/main/java/fr/inra/refcomp/client/example1/LoginExampleLazyInstantiation.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/example1/LoginExampleLazyInstantiation.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/example1/LoginExampleLazyInstantiation.java 2010-11-03 15:15:50 UTC (rev 3) @@ -0,0 +1,76 @@ +package fr.inra.refcomp.client.example1; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.TextBox; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class LoginExampleLazyInstantiation implements EntryPoint { + + Label loginLabel; + TextBox loginBox; + Label pwdLabel; + TextBox pwdBox; + Button button; + + public void onModuleLoad() { + RootPanel.get("loginLabel").add(getLoginLabel()); + RootPanel.get("loginBox").add(getLoginBox()); + RootPanel.get("pwdLabel").add(getPwdLabel()); + RootPanel.get("pwdBox").add(getPwdBox()); + RootPanel.get("submitButton").add(getButton()); + + getButton().addClickHandler(new ClickHandler(){ + public void onClick(ClickEvent event) { + //Window.Location.assign("Search/Search.html"); + Window.Location.replace("../fr.inra.refcomp.Search/Search.html"); + //Window.open("Search.html", "_self", ""); + } + }); + + } + + protected Label getLoginLabel() { + if (loginLabel == null) { + loginLabel = new Label("Login : "); + } + return loginLabel; + } + + protected TextBox getLoginBox() { + if (loginBox == null) { + loginBox = new TextBox(); + } + return loginBox; + } + + public Label getPwdLabel() { + if (pwdLabel == null) { + pwdLabel = new Label("Password : "); + } + return pwdLabel; + } + + public TextBox getPwdBox() { + if (pwdBox == null) { + pwdBox = new TextBox(); + } + return pwdBox; + } + + public Button getButton() { + if (button == null) { + button = new Button("Submit"); + } + return button; + } + +}