Created
May 30, 2014 23:44
-
-
Save katernya/9dbf2aa23cadd73dae24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package webapp.client.view; | |
import com.google.gwt.core.client.GWT; | |
import com.google.gwt.event.dom.client.ClickEvent; | |
import com.google.gwt.uibinder.client.UiBinder; | |
import com.google.gwt.uibinder.client.UiField; | |
import com.google.gwt.uibinder.client.UiHandler; | |
import com.google.gwt.user.client.History; | |
import com.google.gwt.user.client.TakesValue; | |
import com.google.gwt.user.client.rpc.AsyncCallback; | |
import com.google.gwt.user.client.ui.*; | |
import us.heptet.magewars.webapp.client.LoginServiceAsync; | |
import us.heptet.magewars.webapp.client.SignUpEvent; | |
import us.heptet.magewars.webapp.client.SignedUpEvent; | |
import us.heptet.magewars.webapp.client.SignupServiceAsync; | |
/** | |
* Created by kay on 5/15/2014. | |
*/ | |
public class LoginViewImpl extends Composite implements LoginView { | |
private Presenter presenter; | |
interface LoginViewUiBinder extends UiBinder<FlowPanel, LoginViewImpl> {} | |
private static LoginViewUiBinder uiBinder = GWT.create(LoginViewUiBinder.class); | |
@UiField | |
TextBox username; | |
@UiField | |
TextBox password; | |
@UiField | |
FlowPanel loginPanel; | |
@UiField | |
FlowPanel signupPanel; | |
@UiField | |
Label statusLabel; | |
@UiField | |
Button loginButton; | |
@UiField | |
TextBox signupUsername; | |
@UiField | |
PasswordTextBox signupPassword; | |
@UiField | |
PasswordTextBox confirmPassword; | |
@UiField | |
TextBox email; | |
@UiField | |
Button signupButton; | |
public LoginViewImpl() { | |
initWidget(uiBinder.createAndBindUi(this)); | |
username.ensureDebugId("username-box"); | |
} | |
@UiHandler("loginButton") | |
void handleLoginClick(ClickEvent e) | |
{ | |
presenter.onLoginButtonClicked(); | |
} | |
@UiHandler("signupLink") | |
void handleSignupClick(ClickEvent event) | |
{ | |
loginPanel.setVisible(false); | |
signupPanel.setVisible(true); | |
} | |
public FlowPanel getFlowPanel() | |
{ | |
return (FlowPanel)getWidget(); | |
} | |
@UiHandler("signupButton") | |
void signupButtonClick(ClickEvent event) | |
{ | |
presenter.onSignupButtonClicked(); | |
} | |
@Override | |
public void setStatusVisible(boolean b) { | |
statusLabel.setVisible(b); | |
} | |
@Override | |
public void setPresenter(Presenter presenter) { | |
this.presenter = presenter; | |
} | |
@Override | |
public Widget asWidget() { | |
return this; | |
} | |
@Override | |
public TakesValue<String> getStatus() { | |
return statusLabel.asEditor(); | |
} | |
@Override | |
public HasValue<String> getUsername() { | |
return username; | |
} | |
@Override | |
public HasValue<String> getPassword() { | |
return password; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment