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;
}
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();
}
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();
}
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();
}
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();
}
Aggregations