package gae.waveeditor;

import engine.gameobject.GameObject;
import gae.listView.LibraryData;
import gae.openingView.UIObject;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.text.Text;

public class WavePart implements UIObject {

    private HBox rootNode;
    private WaveEnemyTable parent;
    private TextField quantityField;
    private ComboBox<String> gameObjectSelector;

    public WavePart(WaveEnemyTable parent) {
        this.parent = parent;
        initialize();
    }

    private void initialize () {
        rootNode = new HBox();

        //TODO: make pull from created game objects
        
        LibraryData gameObjects = LibraryData.getInstance();
        ObservableList<String> options = 
                FXCollections.observableArrayList(
                                                  "Enemy 1",
                                                  "Enemy 2",
                                                  "Enemy 3"
                        );
        gameObjectSelector = new ComboBox<String>(options);
        
        quantityField = new TextField("Enter Quantity");
        quantityField.setEditable(true);
        
        Button deleteButton = new Button("Delete");
        deleteButton.setOnAction(e -> parent.deleteWavePart(this));
        
        rootNode.getChildren().addAll(new Text("Enemy Type: "), gameObjectSelector, new Text ("Quantity"), quantityField, deleteButton);
        rootNode.setSpacing(5);
        
    }

    @Override
    public Node getObject () {
        return rootNode;
    }

    public int getQuantity () {
        return Integer.parseInt(quantityField.getText());
    }
    
    public GameObject getGameObject() {
        return gameObjectSelector.getSelectionModel().getSelectedItem();
    }
}

@@ -51,24 +51,67 @@
 GameObject;%0A
+import engine.gameobject.GameObjectSimple;%0A
 import gae.l
@@ -131,16 +131,16 @@
 ryData;%0A
-
 import g
@@ -160,24 +160,47 @@
 w.UIObject;%0A
+import java.util.List;%0A
 import javaf
@@ -639,22 +639,32 @@
 omboBox%3C
-String
+GameObjectSimple
 %3E gameOb
@@ -932,19 +932,15 @@
 ata 
-gameObjects
+libData
  = L
@@ -961,24 +961,123 @@
 Instance();%0A
+        ObservableList%3CGameObjectSimple%3E enemyList = libData.getEditableObservableList();%0A        %0A
         Obse
@@ -1412,23 +1412,35 @@
 Box%3C
-String%3E(options
+GameObjectSimple%3E(enemyList
 );%0A 

Save before merge with gae