<commit_before>package org.fedorahosted.flies.webtrans.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratedPopupPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.widgetideas.client.GlassPanel;

public class LoginPanel extends DecoratedPopupPanel implements LoginPresenter.Display {

	private final TextBox username;
	private final PasswordTextBox password;
	private final Button loginButton;
	private final Label errorLabel;

	private final GlassPanel glassPanel;
	
	public LoginPanel() {

		FlexTable layout = new FlexTable();
		layout.setWidth("400px");
		layout.setCellPadding(6);

		username = new TextBox();
		password = new PasswordTextBox();
		loginButton = new Button("Login");
		glassPanel = new GlassPanel(false);
		errorLabel = new Label("Invalid Username / Password combination.");
		errorLabel.setVisible(false);
		layout.setWidget(0, 0, errorLabel);
		layout.setHTML(1, 0, "Username");
		layout.setWidget(1, 1, username);
		layout.setHTML(2, 0, "Password");
		layout.setWidget(2, 1, password);
		layout.setWidget(3, 2, loginButton);

		setAnimationEnabled(true);
		setModal(true);
		add(layout);
	}
	
	@Override
	public void showError() {
		errorLabel.setVisible(true);
	}

	@Override
	public void show() {
		RootPanel.get().setSize("100%", "100%");
		RootPanel.get().add( glassPanel, 0, 0);
		int w = RootPanel.get().getOffsetWidth();
		int h = RootPanel.get().getOffsetHeight();
		super.show();
		setPopupPosition( (w/2) - (getOffsetWidth()/2), (h/2) - (getOffsetHeight()/2) );
	}
	
	@Override
	public void hide() {
		glassPanel.removeFromParent();
		super.hide();
	}


	@Override
	public Button getLoginButton() {
		return loginButton;
	}

	@Override
	public PasswordTextBox getPasswordField() {
		return password;
	}


	@Override
	public TextBox getUsernameField() {
		return username;
	}


	@Override
	public Widget asWidget() {
		return this;
	}

	@Override
	public void startProcessing() {
		enableAll(false);
	}

	@Override
	public void stopProcessing() {
		enableAll(true);
	}

	private void enableAll(boolean enable){
		loginButton.setEnabled(enable);
		username.setEnabled(enable);
		password.setEnabled(enable);
	}
}
<commit_msg>- Add welcome prompt to login view. - Move error message to the bottom.<commit_after>package org.fedorahosted.flies.webtrans.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratedPopupPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.widgetideas.client.GlassPanel;

public class LoginPanel extends DecoratedPopupPanel implements LoginPresenter.Display {

	private final TextBox username;
	private final PasswordTextBox password;
	private final Button loginButton;
	private final Label errorLabel;

	private final GlassPanel glassPanel;
	
	public LoginPanel() {

		FlexTable layout = new FlexTable();
		layout.setWidth("400px");
		layout.setCellPadding(6);

		username = new TextBox();
		password = new PasswordTextBox();
		loginButton = new Button("Login");
		glassPanel = new GlassPanel(false);
		errorLabel = new Label("Invalid Username / Password combination.");
		errorLabel.setVisible(false);
		layout.setHTML(0, 1, "Welcome to Flies");
		layout.setHTML(1, 0, "Username");
		layout.setWidget(1, 1, username);
		layout.setHTML(2, 0, "Password");
		layout.setWidget(2, 1, password);
		layout.setWidget(3, 2, loginButton);
		layout.setWidget(3, 1, errorLabel);

		setAnimationEnabled(true);
		setModal(true);
		add(layout);
	}
	
	@Override
	public void showError() {
		errorLabel.setVisible(true);
	}

	@Override
	public void show() {
		RootPanel.get().setSize("100%", "100%");
		RootPanel.get().add( glassPanel, 0, 0);
		int w = RootPanel.get().getOffsetWidth();
		int h = RootPanel.get().getOffsetHeight();
		super.show();
		setPopupPosition( (w/2) - (getOffsetWidth()/2), (h/2) - (getOffsetHeight()/2) );
	}
	
	@Override
	public void hide() {
		glassPanel.removeFromParent();
		super.hide();
	}


	@Override
	public Button getLoginButton() {
		return loginButton;
	}

	@Override
	public PasswordTextBox getPasswordField() {
		return password;
	}


	@Override
	public TextBox getUsernameField() {
		return username;
	}


	@Override
	public Widget asWidget() {
		return this;
	}

	@Override
	public void startProcessing() {
		enableAll(false);
	}

	@Override
	public void stopProcessing() {
		enableAll(true);
	}

	private void enableAll(boolean enable){
		loginButton.setEnabled(enable);
		username.setEnabled(enable);
		password.setEnabled(enable);
	}
}

{'fraction_non_alphanumeric': 0.130659253375695, 'fraction_numerical': 0.011517077045274026, 'mean_word_length': 4.736902050113895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1697406', 'n_tokens_mistral': 1787, 'n_tokens_neox': 1630, 'n_words': 355}