Example usage for javafx.scene Parent getUserData

List of usage examples for javafx.scene Parent getUserData

Introduction

In this page you can find the example usage for javafx.scene Parent getUserData.

Prototype

public Object getUserData() 

Source Link

Document

Returns a previously set Object property, or null if no such property has been set using the Node#setUserData(java.lang.Object) method.

Usage

From source file:ExcelFx.FXMLDocumentController.java

@FXML
private void Open(ActionEvent event) throws NullPointerException, IOException {

    System.out.println("-----------------------------------------------------------");
    System.out.println("Pressed open Button ");
    File universityFile = new File("university.json");
    File collegeFile = new File("college.json");
    System.out.println("University File emty is " + String.valueOf(universityFile.length() == 0));
    System.out.println("College File emty is " + String.valueOf(collegeFile.length() == 0));

    //File codesFile = new File("codes.json");
    if ((universityFile.exists()) && (collegeFile.exists()) /*&& (codesFile.exists())*/) {
        try {// w  ww .j a  v  a  2  s.c o  m
            this.universityJson.jsonRead("university.json");
            this.collegeJson.jsonRead("college.json");
            //this.codesJson.jsonRead("codes.json");
            this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/);
        } catch (IOException | ParseException ex) {
            Alert alert = new Alert(Alert.AlertType.INFORMATION);
            alert.setTitle("");
            alert.setHeaderText(" ? ? ");
            alert.setContentText(ex.toString());
            alert.showAndWait();
            Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
        }

    } else {
        try {
            FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml"));
            this.fileOpenParent = (Parent) fxmlLoader.load();
            Stage stage = new Stage();
            stage.initModality(Modality.APPLICATION_MODAL);
            stage.initStyle(StageStyle.DECORATED);
            stage.setTitle(" ");
            stage.setScene(new Scene(this.fileOpenParent));

            stage.showAndWait();
        } catch (Exception e) {
            System.err.println(e);

        }

        this.jsonXLSXData.setAll(universityJson, collegeJson/*, codesJson*/);
    }

    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("InitalData.fxml"));
    Parent root1 = (Parent) fxmlLoader.load();
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.initStyle(StageStyle.DECORATED);

    stage.setTitle(" ");
    stage.setScene(new Scene(root1));
    stage.showAndWait();
    setProgressBar(-1.);

    Task task = new Task<Void>() {

        @Override
        protected Void call() throws Exception {

            initaldata = (JsonWrite) root1.getUserData();
            System.out.println("Inital Data empty is " + initaldata.isEmpty());

            initaldata.setPage(String.valueOf(Integer.parseInt(initaldata.getPage()) - 1));

            Parser parser = new Parser();

            list = parser.parseInitalData(initaldata.getPatch(), Integer.parseInt(initaldata.getPage()));
            //System.out.println(list.size());
            Sort sort = new Sort(list, jsonXLSXData, initaldata.getYStart(), initaldata.getYEnd());
            HashMap<String, HashMap<String, ArrayList<String>>> hm = sort
                    .professionsGrouping(initaldata.getYStart(), initaldata.getYEnd());

            sortProf = sort.addWay(hm);

            return null;
        }

    };
    mainProcessing(task);

    System.out.println("button open finished");
    System.out.println("-----------------------------------------------------------");

}