<commit_before>package org.sagebionetworks.web.client.view;

import org.sagebionetworks.web.client.DisplayConstants;
import org.sagebionetworks.web.client.DisplayUtils;
import org.sagebionetworks.web.client.SageImageBundle;
import org.sagebionetworks.web.client.SynapseJSNIUtilsImpl;
import org.sagebionetworks.web.client.widget.footer.Footer;
import org.sagebionetworks.web.client.widget.header.Header;

import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class ChangeUsernameViewImpl extends Composite implements ChangeUsernameView {

	public interface ChangeUsernameViewImplUiBinder extends UiBinder<Widget, ChangeUsernameViewImpl> {}

	@UiField
	SimplePanel header;
	@UiField
	SimplePanel footer;
	@UiField
	Button changeUsernameButton;
	@UiField
	TextBox username;
	@UiField
	SpanElement messageLabel;
	
	private Presenter presenter;
	private Header headerWidget;
	private Footer footerWidget;
	
	@Inject
	public ChangeUsernameViewImpl(ChangeUsernameViewImplUiBinder binder,
			Header headerWidget, Footer footerWidget,
			SageImageBundle imageBundle) {		// TODO: Ask Jay if this SageImageBundle should be there? If so, why? (It isn't used anywhere).	
		initWidget(binder.createAndBindUi(this));
		
		this.headerWidget = headerWidget;
		this.footerWidget = footerWidget;
		headerWidget.configure(false);
		header.add(headerWidget.asWidget());
		footer.add(footerWidget.asWidget());
		
		username.getElement().setAttribute("placeholder", "Username");
		changeUsernameButton.setText(DisplayConstants.SAVE_BUTTON_LABEL);
		changeUsernameButton.addClickHandler(new ClickHandler() {			
			@Override
			public void onClick(ClickEvent event) {
				messageLabel.setInnerHTML("");
				changeUsernameButton.setEnabled(false);
				presenter.setUsername(username.getValue());
			}
		});
	}

	@Override
	public void setPresenter(final Presenter presenter) {
		this.presenter = presenter;
		header.clear();
		headerWidget.configure(false);<commit_msg>Got rid of unneeded comment.<commit_after>package org.sagebionetworks.web.client.view;

import org.sagebionetworks.web.client.DisplayConstants;
import org.sagebionetworks.web.client.DisplayUtils;
import org.sagebionetworks.web.client.SageImageBundle;
import org.sagebionetworks.web.client.SynapseJSNIUtilsImpl;
import org.sagebionetworks.web.client.widget.footer.Footer;
import org.sagebionetworks.web.client.widget.header.Header;

import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class ChangeUsernameViewImpl extends Composite implements ChangeUsernameView {

	public interface ChangeUsernameViewImplUiBinder extends UiBinder<Widget, ChangeUsernameViewImpl> {}

	@UiField
	SimplePanel header;
	@UiField
	SimplePanel footer;
	@UiField
	Button changeUsernameButton;
	@UiField
	TextBox username;
	@UiField
	SpanElement messageLabel;
	
	private Presenter presenter;
	private Header headerWidget;
	private Footer footerWidget;
	
	@Inject
	public ChangeUsernameViewImpl(ChangeUsernameViewImplUiBinder binder,
			Header headerWidget, Footer footerWidget,
			SageImageBundle imageBundle) {
		initWidget(binder.createAndBindUi(this));
		
		this.headerWidget = headerWidget;
		this.footerWidget = footerWidget;
		headerWidget.configure(false);
		header.add(headerWidget.asWidget());
		footer.add(footerWidget.asWidget());
		
		username.getElement().setAttribute("placeholder", "Username");
		changeUsernameButton.setText(DisplayConstants.SAVE_BUTTON_LABEL);
		changeUsernameButton.addClickHandler(new ClickHandler() {			
			@Override
			public void onClick(ClickEvent event) {
				messageLabel.setInnerHTML("");
				changeUsernameButton.setEnabled(false);
				presenter.setUsername(username.getValue());
			}
		});
	}

	@Override
	public void setPresenter(final Presenter presenter) {
		this.presenter = presenter;
		header.clear();
		headerWidget.configure(false);
{'fraction_non_alphanumeric': 0.10374583251617964, 'fraction_numerical': 0.0, 'mean_word_length': 5.836461126005362, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5566133', 'n_tokens_mistral': 1701, 'n_tokens_neox': 1603, 'n_words': 263}