<commit_before>package authoring_environment;

import gamedata.gamecomponents.Patch;
import gamedata.gamecomponents.Piece;

import java.util.HashMap;
import java.util.Map;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.SingleSelectionModel;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

/**
 * @author <NAME>
 * 
 * GUI components for the library displayed on the left side of the
 * game authoring environment, which contains all instantiated units
 * and terrain. From here, the user can open the Unit/TerrainEditors
 * to edit the units and terrain, as well as select them for
 * placement on the grid.
 */
public class LibraryView extends TabPane {
	
	private final int HEIGHT = 300;
	private final int WIDTH = 580;
	private final String UNITS = "Units";
	private final String TERRAIN = "Terrain";
	private final String DELETE = "Delete";
	private Map<String, VBox> myLibraryMap;
	private Map<String, Tab> myTabMap;
	private SingleSelectionModel<Tab> mySelection;
	public static Piece currentlySelectedUnit;
	public static Patch currentlySelectedTerrain;
	public static boolean unitSelected;
	public static boolean reset;
	
	/**
	 * LibraryView constructor. Initializes two tabs - one for units,
	 * one for terrain. Units and terrain are added dynamically to
	 * their respective tabs as they are created in the UnitCreator
	 * and TerrainCreator.
	 */
	public LibraryView(){
		mySelection = this.getSelectionModel();
		this.setPrefSize(HEIGHT, WIDTH);
		unitSelected = false;
		reset = true;
		
		Tab unitTab = new Tab(UNITS);
		unitTab.setClosable(false);
		ScrollPane unitContent = new ScrollPane();
		VBox unitLibrary = new VBox();
		Button unitDelete = new Button(DELETE);
		unitDelete.setOnAction(new EventHandler<ActionEvent>(){
			@Override
			public void handle(ActionEvent e){
				unitSelected = true;
				reset = true;
			}
		});
		unitLibrary.getChildren().add(unitDelete);
		unitContent.setContent(unitLibrary);
		unitTab.setContent(unitContent);
		
		Tab terrainTab = new Tab(TERRAIN);
		terrainTab.setClosable(false);<commit_msg>Updating Library View<commit_after>package authoring_environment;

import gamedata.gamecomponents.Patch;
import gamedata.gamecomponents.Piece;

import java.util.HashMap;
import java.util.Map;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Separator;
import javafx.scene.control.SingleSelectionModel;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

/**
 * @author <NAME>
 * 
 * GUI components for the library displayed on the left side of the
 * game authoring environment, which contains all instantiated units
 * and terrain. From here, the user can open the Unit/TerrainEditors
 * to edit the units and terrain, as well as select them for
 * placement on the grid.
 */
public class LibraryView extends TabPane {
	
	private final int HEIGHT = 300;
	private final int WIDTH = 580;
	private final String UNITS = "Units";
	private final String TERRAIN = "Terrain";
	private final String DELETE = "Delete";
	private Map<String, VBox> myLibraryMap;
	private Map<String, Tab> myTabMap;
	private SingleSelectionModel<Tab> mySelection;
	public static Piece currentlySelectedUnit;
	public static Patch currentlySelectedTerrain;
	public static boolean unitSelected;
	public static boolean reset;
	
	/**
	 * LibraryView constructor. Initializes two tabs - one for units,
	 * one for terrain. Units and terrain are added dynamically to
	 * their respective tabs as they are created in the UnitCreator
	 * and TerrainCreator.
	 */
	public LibraryView(){
		mySelection = this.getSelectionModel();
		this.setPrefSize(HEIGHT, WIDTH);
		unitSelected = false;
		reset = true;
		
		Tab unitTab = new Tab(UNITS);
		unitTab.setClosable(false);
		ScrollPane unitContent = new ScrollPane();
		VBox unitLibrary = new VBox();
		Button unitDelete = new Button(DELETE);
		unitDelete.setOnAction(new EventHandler<ActionEvent>(){
			@Override
			public void handle(ActionEvent e){
				unitSelected = true;
				reset = true;
			}
		});
		unitLibrary.getChildren().addAll(new Label("Global Commands"),unitDelete,new Separator());
		unitContent.setContent(unitLibrary);
		unitTab.setContent(unitContent);
		
		Tab terrainTab = new Tab(TERRAIN);
		terrainTab.setClosable(false);
{'fraction_non_alphanumeric': 0.08755364806866953, 'fraction_numerical': 0.002575107296137339, 'mean_word_length': 4.840852130325815, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5384470', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1335, 'n_words': 426}