I have a simple program I am working on. It's basically like a task tracker it has the main view that consists of a table view and a adding menu, a different stage. How can i get data from AddingController And send it to "ViewController" so that info appears in my table view. I have attempted to use oblist but it doesn't seem to be working or I am doing smth wrong.
Thank you,
ViewController:
package sample;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.stage.Stage;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
public class ViewController implements Initializable {
    ContextMenu context = new ContextMenu();
    @FXML
    TableView<ModelTable> tableView;
    @FXML
    public TableColumn<String, ModelTable> columnId;
    @FXML
    public TableColumn<String, ModelTable> columnDesc;
    @FXML
    public TableColumn<String, ModelTable> columnCat;
    @FXML
    public TableColumn<String, ModelTable> columnResp;
    ObservableList<ModelTable> oblist = FXCollections.observableArrayList();
    @Override
    public void initialize(URL location, ResourceBundle resources) {
        MenuItem itemOpen = new MenuItem("Open");
        MenuItem itemAdd = new MenuItem("Add");
        MenuItem itemRemove = new MenuItem("Remove");
        context.getItems().addAll(itemOpen, itemAdd, itemRemove);
        tableView.setContextMenu(context);
        itemAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                try {
                    Parent addTaskParent = FXMLLoader.load(getClass().getResource("AddingMenu.fxml"));
                    Scene addTaskScene = new Scene(addTaskParent);
                    Stage stage = new Stage();
                    stage.setTitle("Adding Ticket");
                    stage.setScene(addTaskScene);
                    stage.show();
                } catch (IOException e) {
                    System.out.println(e.getMessage());
                }
            }
        });
    columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
    columnDesc.setCellValueFactory(new PropertyValueFactory<>("description"));
    columnCat.setCellValueFactory(new PropertyValueFactory<>("category"));
    columnResp.setCellValueFactory(new PropertyValueFactory<>("responsible"));
    tableView.setItems(oblist);
    }
}
Adding Controller
package sample;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import java.net.URL;
import java.util.ResourceBundle;
public class AddingController implements Initializable {
    @FXML
    Button btnSubmit;
    @FXML
    Button btnCancel;
    @FXML
    Label lblReqID;
    @FXML
    ChoiceBox cbCategory;
    @FXML
    ChoiceBox cbResponsible;
    @FXML
    TextArea taDesc;
    ObservableList<ModelTable> oblist = FXCollections.observableArrayList();
    public void submit(ActionEvent e) {
        if (cbCategory.getValue() != null && cbResponsible.getValue() != null && taDesc.getLength() > 3) {
            oblist.add(new ModelTable(123, taDesc.getText(), cbCategory.getValue().toString(),cbResponsible.getValue().toString()));
        } else {
            System.out.println("Booooooo!!!");
        }
    }
    @Override
    public void initialize(URL location, ResourceBundle resources) {
        cbCategory.getItems().add("Support");
        cbCategory.getItems().add("Maintenance");
        cbResponsible.getItems().add("R");
        cbResponsible.getItems().add("T");
    }
}
Model Table:
package sample;
public class ModelTable {
    int id;
    String Description, Category, Responsible;
    public ModelTable(int id, String description, String category, String responsible) {
        this.id = id;
        Description = description;
        Category = category;
        Responsible = responsible;
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getDescription() {
        return Description;
    }
    public void setDescription(String description) {
        Description = description;
    }
    public String getCategory() {
        return Category;
    }
    public void setCategory(String category) {
        Category = category;
    }
    public String getResponsible() {
        return Responsible;
    }
    public void setResponsible(String responsible) {
        Responsible = responsible;
    }
}
