Search in sources :

Example 11 with BorderPane

use of javafx.scene.layout.BorderPane in project aima-java by aimacode.

the class OsmLRTAStarAgentApp method createRootPane.

/**
	 * Defines state view, parameters, and call-back functions and calls the
	 * simulation pane builder to create layout and controller objects.
	 */
@Override
public Pane createRootPane() {
    BorderPane root = new BorderPane();
    List<Parameter> params = createParameters();
    StackPane mapPane = new StackPane();
    mapPaneCtrl = new MapPaneCtrl(mapPane);
    loadMap();
    SimulationPaneBuilder builder = new SimulationPaneBuilder();
    builder.defineParameters(params);
    builder.defineStateView(mapPane);
    builder.defineInitMethod(this::initialize);
    builder.defineSimMethod(this::simulate);
    simPaneCtrl = builder.getResultFor(root);
    simPaneCtrl.setParam(SimulationPaneCtrl.PARAM_SIM_SPEED, 0);
    return root;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) MapPaneCtrl(aimax.osm.gui.fx.viewer.MapPaneCtrl) SimulationPaneBuilder(aima.gui.fx.framework.SimulationPaneBuilder) Parameter(aima.gui.fx.framework.Parameter) StackPane(javafx.scene.layout.StackPane)

Example 12 with BorderPane

use of javafx.scene.layout.BorderPane in project jgnash by ccavanaugh.

the class MainView method start.

public void start(final Stage stage, @Nullable final File dataFile, final char[] password, @Nullable final String host, final int port) throws Exception {
    ThemeManager.restoreLastUsedTheme();
    primaryStage = stage;
    busyPane = new BusyPane();
    final FXMLLoader fxmlLoader = new FXMLLoader(MenuBarController.class.getResource("MainMenuBar.fxml"), resources);
    menuBar = fxmlLoader.load();
    final ToolBar mainToolBar = FXMLLoader.load(MainToolBarController.class.getResource("MainToolBar.fxml"), resources);
    tabViewPane = new TabViewPane();
    final VBox top = new VBox();
    top.getChildren().addAll(menuBar, mainToolBar);
    top.setFillWidth(true);
    statusBar = new StatusBar();
    final BorderPane borderPane = new BorderPane();
    borderPane.setTop(top);
    borderPane.setCenter(tabViewPane);
    borderPane.setBottom(statusBar);
    final StackPane stackPane = new StackPane();
    stackPane.getChildren().addAll(borderPane, busyPane);
    final Scene scene = new Scene(stackPane, 640, 480);
    scene.getStylesheets().add(DEFAULT_CSS);
    scene.getRoot().styleProperty().bind(ThemeManager.styleProperty());
    stage.setTitle(title);
    stage.getIcons().add(StaticUIMethods.getApplicationIcon());
    stage.setScene(scene);
    stage.setResizable(true);
    // enforce a min width to prevent it from disappearing with a bad click and drag
    stage.setMinWidth(640);
    stage.setMinHeight(480);
    installHandlers();
    MessageBus.getInstance().registerListener(this, MessageChannel.SYSTEM);
    StageUtils.addBoundsListener(stage, MainView.class);
    stage.show();
    Engine.addLogHandler(statusBarLogHandler);
    EngineFactory.addLogHandler(statusBarLogHandler);
    YahooParser.addLogHandler(statusBarLogHandler);
    UpdateFactory.addLogHandler(statusBarLogHandler);
    // listen to my own logger
    logger.addHandler(statusBarLogHandler);
    stage.toFront();
    stage.requestFocus();
    if (host != null) {
        // connect to a remote server instead of loading a local file
        new Thread(() -> {
            try {
                Thread.sleep(BootEngineTask.FORCED_DELAY);
                backgroundExecutor.execute(() -> JavaFXUtils.runLater(() -> BootEngineTask.initiateBoot(null, password, true, host, port)));
            } catch (InterruptedException e) {
                logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
            }
        }).start();
    } else if (dataFile != null) {
        // Load the specified file, this overrides the last open file
        new Thread(() -> {
            try {
                Thread.sleep(BootEngineTask.FORCED_DELAY);
                backgroundExecutor.execute(() -> JavaFXUtils.runLater(() -> BootEngineTask.initiateBoot(dataFile.getAbsolutePath(), password, false, null, 0)));
            } catch (InterruptedException e) {
                logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
            }
        }).start();
    } else if (Options.openLastProperty().get()) {
        // Load the last open file if enabled
        new Thread(() -> {
            try {
                Thread.sleep(BootEngineTask.FORCED_DELAY);
                backgroundExecutor.execute(() -> JavaFXUtils.runLater(BootEngineTask::openLast));
            } catch (InterruptedException e) {
                logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
            }
        }).start();
    }
    loadPlugins();
    checkForLatestRelease();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) StatusBar(jgnash.uifx.control.StatusBar) TabViewPane(jgnash.uifx.control.TabViewPane) BusyPane(jgnash.uifx.control.BusyPane) BootEngineTask(jgnash.uifx.tasks.BootEngineTask) ToolBar(javafx.scene.control.ToolBar) VBox(javafx.scene.layout.VBox) StackPane(javafx.scene.layout.StackPane)

Example 13 with BorderPane

use of javafx.scene.layout.BorderPane in project Gargoyle by callakrsos.

the class EditableTableViewExam method start.

@Override
public void start(Stage primaryStage) throws Exception {
    Button btnExec = new Button("Exec.");
    Button btnAdd = new Button("Add ");
    Button btnRemove = new Button("Remove");
    Button btnSave = new Button("Save");
    btnAdd.setDisable(true);
    TextField textField = new TextField();
    HBox hBox = new HBox(5, textField, btnExec, btnAdd, btnRemove, btnSave);
    EditableTableView editableTableView = new EditableTableView(new Supplier<Connection>() {

        @Override
        public Connection get() {
            try {
                return DbUtil.getConnection();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }
    });
    editableTableView.tableNameProperty().addListener((oba, oldval, newval) -> {
        btnAdd.setDisable(false);
    });
    //  editableTableView.execute("tbm_sm_realtime_search");
    btnExec.setOnAction(e -> {
        String tableName = textField.getText();
        try {
            editableTableView.readByTableName("select * from " + tableName, tableName);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    });
    btnAdd.setOnAction(ev -> {
        editableTableView.getItems().add(new HashMap<>());
        editableTableView.getSelectionModel().selectLast();
        editableTableView.scrollTo(editableTableView.getItems().size() - 1);
    });
    btnRemove.setOnAction(ev -> {
        editableTableView.getItems().removeAll(editableTableView.getSelectionModel().getSelectedItems());
    });
    btnSave.setOnAction(ev -> {
        try {
            editableTableView.save();
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    });
    editableTableView.setOnMouseClicked(ev -> {
        Map<ColumnExpression, ObjectProperty<ValueExpression>> selectedItem = editableTableView.getSelectionModel().getSelectedItem();
        System.out.println(selectedItem);
    });
    BorderPane root = new BorderPane(editableTableView);
    root.setTop(hBox);
    Scene value = new Scene(root);
    //  ".table-row{ -fx-background-color: red; }"
    //  value.getStylesheets().add(EditableTableViewExam.class.getResource("EditableTableViewExam.css").toExternalForm());
    primaryStage.setScene(value);
    primaryStage.show();
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) HBox(javafx.scene.layout.HBox) BorderPane(javafx.scene.layout.BorderPane) EditableTableView(com.kyj.fx.voeditor.visual.component.grid.EditableTableView) Connection(java.sql.Connection) Scene(javafx.scene.Scene) Button(javafx.scene.control.Button) ColumnExpression(com.kyj.fx.voeditor.visual.component.grid.EditableTableView.ColumnExpression) TextField(javafx.scene.control.TextField)

Example 14 with BorderPane

use of javafx.scene.layout.BorderPane in project Gargoyle by callakrsos.

the class FXMLPreviewLoader method start.

/**
	 * @inheritDoc
	 */
@Override
public void start(Stage primaryStage) throws Exception {
    BorderPane borderPane = new BorderPane();
    FXMLLoader loader = new FXMLLoader() {
    };
    // InputStream resourceAsStream =
    // FXMLPreviewLoader.class.getResourceAsStream("lang_ko.properties");
    //
    // loader.setResources(new PropertyResourceBundle(new
    // InputStreamReader(resourceAsStream, "UTF-8")) {
    // /*
    // * @inheritDoc
    // */
    // @Override
    // public boolean containsKey(String key) {
    // return true;
    // }
    //
    // /*
    // * @inheritDoc
    // */
    // @Override
    // public Object handleGetObject(String key) {
    // if (key == null) {
    // return "";
    // }
    //
    // Object result = null;
    //
    // try {
    // result = super.handleGetObject(key);
    // } catch (Exception e) {
    // ;
    // }
    //
    // return (result == null) ? key : result;
    // }
    // });
    // loader.setLocation(/*FXMLPreviewLoader.class.getResource("ColumnExam3.fxml")*/url);
    loader.setBuilderFactory(new BuilderFactory() {

        @Override
        public Builder<?> getBuilder(Class<?> param) {
            return new JavaFXBuilderFactory().getBuilder(param);
        }
    });
    loader.setControllerFactory(new Callback<Class<?>, Object>() {

        @Override
        public Object call(Class<?> param) {
            return null;
        }
    });
    FileInputStream inputStream = new FileInputStream(file);
    InputStream is = null;
    try {
        SAXParserFactory spf = SAXParserFactory.newInstance();
        SAXParser sp = spf.newSAXParser();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        FXMLSaxHandler handler = new FXMLSaxHandler(out);
        sp.parse(inputStream, handler);
        String string = out.toString("UTF-8");
        string = ValueUtil.regexReplaceMatchs("<!\\[CDATA\\[[?<a-zA-Z. *?>]+]]>", string, str -> {
            return ValueUtil.regexMatch("<\\?import [a-zA-Z.*?]+>", str);
        });
        System.out.println(string);
        byte[] bytes = string.getBytes();
        is = new ByteArrayInputStream(bytes);
    } catch (Exception e) {
        e.printStackTrace();
    }
    // FileInputStream inputStream = new FileInputStream(file);
    borderPane.setCenter(loader.load(is));
    Scene scene = new Scene(borderPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) FXMLSaxHandler(com.kyj.fx.voeditor.visual.framework.parser.FXMLSaxHandler) FXMLSaxHandler(com.kyj.fx.voeditor.visual.framework.parser.FXMLSaxHandler) Scene(javafx.scene.Scene) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) SAXParserFactory(javax.xml.parsers.SAXParserFactory) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) FileInputStream(java.io.FileInputStream) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) Application(javafx.application.Application) Matcher(java.util.regex.Matcher) ByteArrayInputStream(java.io.ByteArrayInputStream) Stage(javafx.stage.Stage) FXMLLoader(javafx.fxml.FXMLLoader) SAXParser(javax.xml.parsers.SAXParser) Pattern(java.util.regex.Pattern) BorderPane(javafx.scene.layout.BorderPane) BuilderFactory(javafx.util.BuilderFactory) Callback(javafx.util.Callback) Builder(javafx.util.Builder) InputStream(java.io.InputStream) BorderPane(javafx.scene.layout.BorderPane) FileInputStream(java.io.FileInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Builder(javafx.util.Builder) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) JavaFXBuilderFactory(javafx.fxml.JavaFXBuilderFactory) BuilderFactory(javafx.util.BuilderFactory) FileInputStream(java.io.FileInputStream) FileNotFoundException(java.io.FileNotFoundException) ByteArrayInputStream(java.io.ByteArrayInputStream) SAXParser(javax.xml.parsers.SAXParser) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Example 15 with BorderPane

use of javafx.scene.layout.BorderPane in project Gargoyle by callakrsos.

the class FileCompareExam method start.

@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(DiffAppController.class.getResource("FileBaseDiffApp.fxml"));
    BorderPane load = loader.load();
    FileBaseDiffAppController controller = loader.getController();
    URL resource1 = FileCompareExam.class.getResource("Test1");
    URL resource2 = FileCompareExam.class.getResource("Test2");
    File ordinalFile = new File(resource1.toURI());
    controller.setDiffFile(ordinalFile, new File(resource2.toURI()));
    Scene scene = new Scene(load);
    primaryStage.setScene(scene);
    primaryStage.show();
}
Also used : FileBaseDiffAppController(com.kyj.fx.voeditor.visual.component.FileBaseDiffAppController) DiffAppController(com.kyj.fx.voeditor.visual.component.DiffAppController) FileBaseDiffAppController(com.kyj.fx.voeditor.visual.component.FileBaseDiffAppController) BorderPane(javafx.scene.layout.BorderPane) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) File(java.io.File) URL(java.net.URL)

Aggregations

BorderPane (javafx.scene.layout.BorderPane)95 Scene (javafx.scene.Scene)58 Button (javafx.scene.control.Button)19 Label (javafx.scene.control.Label)17 FXMLLoader (javafx.fxml.FXMLLoader)14 Stage (javafx.stage.Stage)14 StackPane (javafx.scene.layout.StackPane)12 IOException (java.io.IOException)11 Parameter (aima.gui.fx.framework.Parameter)10 SimulationPaneBuilder (aima.gui.fx.framework.SimulationPaneBuilder)10 File (java.io.File)10 HBox (javafx.scene.layout.HBox)9 HashMap (java.util.HashMap)8 Insets (javafx.geometry.Insets)8 TextField (javafx.scene.control.TextField)8 Map (java.util.Map)6 MenuItem (javafx.scene.control.MenuItem)6 TableColumn (javafx.scene.control.TableColumn)6 TableView (javafx.scene.control.TableView)6 List (java.util.List)5