Example usage for javafx.scene.layout BorderPane disableProperty

List of usage examples for javafx.scene.layout BorderPane disableProperty

Introduction

In this page you can find the example usage for javafx.scene.layout BorderPane disableProperty.

Prototype

public final BooleanProperty disableProperty() 

Source Link

Document

Defines the individual disabled state of this Node .

Usage

From source file:org.jevis.jeconfig.JEConfig.java

/**
 * Build an new JEConfig Login and main frame/stage
 *
 * @param primaryStage//  w  w  w .  j av  a2 s  .co m
 */
//AITBilal - Login  
private void initGUI(Stage primaryStage) {
    Scene scene;
    LoginGlass login = new LoginGlass(primaryStage);

    AnchorPane jeconfigRoot = new AnchorPane();
    AnchorPane.setTopAnchor(jeconfigRoot, 0.0);
    AnchorPane.setRightAnchor(jeconfigRoot, 0.0);
    AnchorPane.setLeftAnchor(jeconfigRoot, 0.0);
    AnchorPane.setBottomAnchor(jeconfigRoot, 0.0);
    //        jeconfigRoot.setStyle("-fx-background-color: white;");
    //        jeconfigRoot.getChildren().setAll(new Label("sodfhsdhdsofhdshdsfdshfjf"));

    Screen screen = Screen.getPrimary();
    Rectangle2D bounds = screen.getVisualBounds();

    // @AITBilal - Main frame elemente wird aufgerufen nachdem man sich eingeloggt hat.
    login.getLoginStatus().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                System.out.println("after request");
                _mainDS = login.getDataSource();
                ds = _mainDS;

                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        FadeTransition ft = new FadeTransition(Duration.millis(1500), login);
                        ft.setFromValue(1.0);
                        ft.setToValue(0);
                        ft.setCycleCount(1);
                        ft.play();
                    }
                });

                JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo());
                JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO);
                JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO);

                preLodedClasses = login.getAllClasses();
                preLodedRootObjects = login.getRootObjects();

                PluginManager pMan = new PluginManager(ds);
                //@AITBilal - Toolbar fr save, newB, delete, sep1, form
                GlobalToolBar toolbar = new GlobalToolBar(pMan);
                pMan.addPluginsByUserSetting(null);

                //                    StackPane root = new StackPane();
                //                    root.setId("mainpane");
                BorderPane border = new BorderPane();
                VBox vbox = new VBox();
                vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory());
                border.setTop(vbox);
                //@AITBilal - Alle Plugins Inhalt fr JEConfig (Resources... | System | Attribute)
                border.setCenter(pMan.getView());

                Statusbar statusBar = new Statusbar(ds);

                border.setBottom(statusBar);

                System.out.println("show welcome");

                //Disable GUI is StatusBar note an disconnect
                border.disableProperty().bind(statusBar.connectedProperty.not());

                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        AnchorPane.setTopAnchor(border, 0.0);
                        AnchorPane.setRightAnchor(border, 0.0);
                        AnchorPane.setLeftAnchor(border, 0.0);
                        AnchorPane.setBottomAnchor(border, 0.0);

                        jeconfigRoot.getChildren().setAll(border);
                        //                            try {
                        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/"));
                        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3"));

                        //                            Task<Void> showWelcome = new Task<Void>() {
                        //                                @Override
                        //                                protected Void call() throws Exception {
                        try {
                            WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());
                        } catch (URISyntaxException ex) {
                            Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (MalformedURLException ex) {
                            Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        //                                    return null;
                        //                                }
                        //                            };
                        //                            new Thread(showWelcome).start();

                        //                                WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());
                        //                            } catch (URISyntaxException ex) {
                        //                                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        //                            } catch (MalformedURLException ex) {
                        //                                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        //                            }
                    }
                });
            }

        }
    });

    AnchorPane.setTopAnchor(login, 0.0);
    AnchorPane.setRightAnchor(login, 0.0);
    AnchorPane.setLeftAnchor(login, 0.0);
    AnchorPane.setBottomAnchor(login, 0.0);
    //@AITBilal - Login Dialog
    scene = new Scene(jeconfigRoot, bounds.getWidth(), bounds.getHeight());
    scene.getStylesheets().add("/styles/Styles.css");
    primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png"));
    primaryStage.setTitle("JEConfig");
    primaryStage.setScene(scene);
    maximize(primaryStage);
    primaryStage.show();

    //        Platform.runLater(new Runnable() {
    //            @Override
    //            public void run() {
    //@AITBilal - Inhalt bzw. die Elemente von LoginDialog
    jeconfigRoot.getChildren().setAll(login);
    //            }
    //        });

    primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() {

        @Override
        public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov,
                EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) {
            try {
                System.out.println("Disconnect");
                ds.disconnect();
            } catch (JEVisException ex) {
                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}