<commit_before>package application.controllers;

import javafx.geometry.Rectangle2D;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Screen;

/**
 * Created by <NAME> on 30-5-2016.
 */
public class ListFactory {
    private ListView list;
    private TextFlow infoList;
    private VBox listVBox;
    private Text id;
    private ScrollPane infoScroller;
    private Rectangle2D screenSize;

    /**
     * Constructor - Create a new ListFactory
     */
    public ListFactory() {
        this.screenSize = Screen.getPrimary().getVisualBounds();
    }


    /**
     * Method to create the GUI aspects of the InfoList
     *
     * @param info the info to be shown
     * @return the create InfoList
     */
    public VBox createInfoList(String info) {
        listVBox = new VBox();
        infoScroller = new ScrollPane();

        listVBox.setMinWidth(248.0);
        listVBox.setPrefWidth(248.0);
        listVBox.setMaxWidth(248.0);

        infoScroller.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        infoScroller.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        infoScroller.prefHeightProperty().bind(listVBox.heightProperty());
        infoScroller.prefWidth(screenSize.getWidth() / 5);

        if (info.isEmpty()) {
            createList();
        }

        createNodeInfo();

        infoScroller.setContent(infoList);
        listVBox.getChildren().addAll(list, infoScroller);

        return listVBox;
    }

    /**
     * Create a list on the right side of the screen with all genomes.
     */
    private void createList() {
        list = new ListView<>();
        list.setPlaceholder(new Label("No Genomes Loaded."));
        list.prefHeightProperty().bind(listVBox.heightProperty());
        list.prefWidthProperty().bind(listVBox.widthProperty());
    }


    /**
     * Create an info panel to show the information on a node.
     */
    private void createNodeInfo() {
        infoList = new TextFlow();
        infoList.prefHeightProperty().bind(infoScroller.heightProperty());
        infoList.prefWidthProperty().bind(infoScroller.widthProperty());

        id = new Text();
        id.setText("Select Node to view info");

        infoList.getChildren().addAll(id);
    }

    /**
     * Modify the information of the Node.
     *
     * @param id desired info.
     */
    public void modifyNodeInfo(String id) {
        this.id.setText(id);
    }

    /**
     * Getter method for the list
     *
     * @return the list
     */
    public ListView getList() {
        return list;
    }

    /**
     * Getter method for the InfoScroller
     *
     * @return the InfoScroller<commit_msg>Added line wrapping for node info text box<commit_after>package application.controllers;

import javafx.geometry.Rectangle2D;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Screen;

/**
 * Created by <NAME> on 30-5-2016.
 */
public class ListFactory {
    private ListView list;
    private TextFlow infoList;
    private VBox listVBox;
    private Text id;
    private ScrollPane infoScroller;
    private Rectangle2D screenSize;

    /**
     * Constructor - Create a new ListFactory
     */
    public ListFactory() {
        this.screenSize = Screen.getPrimary().getVisualBounds();
    }


    /**
     * Method to create the GUI aspects of the InfoList
     *
     * @param info the info to be shown
     * @return the create InfoList
     */
    public VBox createInfoList(String info) {
        listVBox = new VBox();
        infoScroller = new ScrollPane();

        listVBox.setMinWidth(248.0);
        listVBox.setPrefWidth(248.0);
        listVBox.setMaxWidth(248.0);

        infoScroller.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        infoScroller.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        infoScroller.prefHeightProperty().bind(listVBox.heightProperty());
        infoScroller.prefWidth(screenSize.getWidth() / 5);

        if (info.isEmpty()) {
            createList();
        }

        createNodeInfo();

        infoScroller.setContent(infoList);
        listVBox.getChildren().addAll(list, infoScroller);

        return listVBox;
    }

    /**
     * Create a list on the right side of the screen with all genomes.
     */
    private void createList() {
        list = new ListView<>();
        list.setPlaceholder(new Label("No Genomes Loaded."));
        list.prefHeightProperty().bind(listVBox.heightProperty());
        list.prefWidthProperty().bind(listVBox.widthProperty());
    }


    /**
     * Create an info panel to show the information on a node.
     */
    private void createNodeInfo() {
        infoList = new TextFlow();
        infoList.prefHeightProperty().bind(infoScroller.heightProperty());
        infoList.prefWidthProperty().bind(infoScroller.widthProperty());

        id = new Text();
        id.setText("Select Node to view info");

        infoList.getChildren().addAll(id);
    }

    /**
     * Modify the information of the Node.
     *
     * @param id desired info.
     */
    public void modifyNodeInfo(String id) {
        this.id.setText(id);
        this.id.setWrappingWidth(infoScroller.widthProperty().doubleValue());
    }

    /**
     * Getter method for the list
     *
     * @return the list
     */
    public ListView getList() {
        return list;
    }

    /**
     * Getter method for the InfoScroller
     *
     * @return the InfoScroller
{'fraction_non_alphanumeric': 0.10829132626455762, 'fraction_numerical': 0.0076481835564053535, 'mean_word_length': 2.549660703269587, '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': '5624791', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1643, 'n_words': 385}