<commit_before>package ui;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;

import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.event.Event;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.controlsfx.control.NotificationPane;
import org.eclipse.egit.github.core.IRepositoryIdProvider;

import service.ServiceManager;
import storage.DataManager;
import ui.issuecolumn.ColumnControl;
import util.DialogMessage;

public class LoginDialog extends Dialog<Boolean> {
	private static final Logger logger = LogManager.getLogger(LoginDialog.class.getName());
	
	private TextField repoOwnerField;
	private TextField repoNameField;
	private TextField usernameField;
	private PasswordField passwordField;
	private NotificationPane notificationPane;
	private ColumnControl columns;
	private Button loginButton;
	private Label statusLabel;

	public LoginDialog(Stage parentStage, ColumnControl columns) {
		super(parentStage);
		this.columns = columns;
	}
	
	@Override
	protected void onClose(WindowEvent e) {
		completeResponse(false);
	}
	
	@Override
	protected Parent content() {

		setTitle("GitHub Login");
		setSize(320, 200);
		setStageStyle(StageStyle.UTILITY);
		
		notificationPane = new NotificationPane();
		
		GridPane grid = new GridPane();
		grid.setAlignment(Pos.CENTER);
		grid.setHgap(10);
		grid.setVgap(10);
		grid.setPadding(new Insets(25, 25, 25, 25));

		Label repoNameLabel = new Label("Repository:");
		grid.add(repoNameLabel, 0, 0);

		repoOwnerField = new TextField("Owner");
		grid.add(repoOwnerField, 1, 0);

		Label slash = new Label("/");
		grid.add(slash, 2, 0);

		repoNameField = new TextField("RepoName");
		grid.add(repoNameField, 3, 0);

		Label usernameLabel = new Label("Username:");
		grid.add(usernameLabel, 0, 1);

		usernameField = new TextField();
		grid.add(usernameField, 1, 1, 3, 1);

		Label passwordLabel = new Label("Password:");
		grid.add(passwordLabel, 0, 2);

		passwordField = new PasswordField();
		grid.add(passwordField, 1, 2, 3, 1);

		statusLabel = new Label();
		HBox.setHgrow(statusLabel, Priority.ALWAYS);
		grid.add(statusLabel, 0, 3);
		
		repoOwnerField.setMaxWidth(80);
		repoNameField.setMaxWidth(80);

		loginButton = new Button("Sign in");
		loginButton.setOnAction(this::login);

		repoOwnerField.setOnAction(this::login);
		repoNameField.setOnAction(this::login);
		usernameField.setOnAction(this::login);
		passwordField.setOnAction(this::login);

		HBox buttons = new HBox(10);
		buttons.setAlignment(Pos.BOTTOM_RIGHT);
		buttons.getChildren().add(loginButton);
		grid.add(buttons, 3, 3);
		
		notificationPane.setContent(grid);
		
		return notificationPane;
	}
	
	private void login(Event e) {
		<commit_msg>Widened and improved appearance of login dialog; fixes #283<commit_after>package ui;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;

import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.event.Event;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.egit.github.core.IRepositoryIdProvider;

import service.ServiceManager;
import storage.DataManager;
import ui.issuecolumn.ColumnControl;
import util.DialogMessage;

public class LoginDialog extends Dialog<Boolean> {
	private static final Logger logger = LogManager.getLogger(LoginDialog.class.getName());
	
	private TextField repoOwnerField;
	private TextField repoNameField;
	private TextField usernameField;
	private PasswordField passwordField;
	private ColumnControl columns;
	private Button loginButton;

	public LoginDialog(Stage parentStage, ColumnControl columns) {
		super(parentStage);
		this.columns = columns;
	}
	
	@Override
	protected void onClose(WindowEvent e) {
		completeResponse(false);
	}
	
	@Override
	protected Parent content() {

		setTitle("GitHub Login");
		setSize(440, 200);
		setStageStyle(StageStyle.UTILITY);
		
		GridPane grid = new GridPane();
		grid.setAlignment(Pos.CENTER);
		grid.setHgap(7);
		grid.setVgap(10);
		grid.setPadding(new Insets(25));

		ColumnConstraints column = new ColumnConstraints();
	    column.setPercentWidth(20);
	    grid.getColumnConstraints().add(column);
	    
	    column = new ColumnConstraints();
	    column.setPercentWidth(30);
	    grid.getColumnConstraints().add(column);

	    column = new ColumnConstraints();
	    column.setPercentWidth(2);
	    grid.getColumnConstraints().add(column);

	    column = new ColumnConstraints();
	    column.setPercentWidth(48);
	    grid.getColumnConstraints().add(column);

	    grid.setPrefSize(390, 100);
	    grid.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
	    
		Label repoNameLabel = new Label("Repository:");
		grid.add(repoNameLabel, 0, 0);

		repoOwnerField = new TextField("<owner>");
		repoOwnerField.setPrefWidth(140);
		grid.add(repoOwnerField, 1, 0);

		Label slash = new Label("/");
		grid.add(slash, 2, 0);

		repoNameField = new TextField("<repository>");
		repoNameField.setPrefWidth(250);
		grid.add(repoNameField, 3, 0);

		Label usernameLabel = new Label("Username:");
		grid.add(usernameLabel, 0, 1);

		usernameField = new TextField();
		grid.add(usernameField, 1, 1, 3, 1);

		Label passwordLabel = new Label("Password:");
		grid.add(passwordLabel, 0, 2);

		passwordField = new PasswordField();
		grid.add(passwordField, 1, 2, 3, 1);

		repoOwnerField.setOnAction(this::login);
		repoNameField.setOnAction(this::login);
		usernameField.setOnAction(this::login);
		passwordField.setOnAction(this::login);

		HBox buttons = new HBox(10);
		buttons.setAlignment(Pos.BOTTOM_RIGHT);
		loginButton = new Button("Sign in");
		loginButton.setOnAction(this::login);
		buttons.getChildren().add(loginButton);
		grid.add(buttons, 3, 3);
		
		return grid;
	}
	
	private void login(Event e) {
		
{'fraction_non_alphanumeric': 0.11668357733004783, 'fraction_numerical': 0.01579939121611828, 'mean_word_length': 5.341911764705882, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6924822', 'n_tokens_mistral': 2375, 'n_tokens_neox': 2103, 'n_words': 456}