use of javafx.fxml.FXMLLoader in project TrayNotification by PlusHaze.
the class TrayNotification method initTrayNotification.
private void initTrayNotification(String title, String message, NotificationType type) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/tray/views/TrayNotification.fxml"));
fxmlLoader.setController(this);
fxmlLoader.load();
initStage();
initAnimations();
setTray(title, message, type);
} catch (IOException e) {
e.printStackTrace();
}
}
use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.
the class SensorConfigurationController method initialize.
@Override
public void initialize(final URL location, final ResourceBundle __) {
nameColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getName()));
typeColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getType().getFieldDescription()));
deleteColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
deleteColumn.setCellFactory(p -> {
final ButtonCell $ = new ButtonCell();
$.setAlignment(Pos.CENTER);
return $;
});
backButton.setOnAction(__1 -> mainController.loadSensorList());
HBox.setHgrow(addNameField, Priority.ALWAYS);
HBox.setHgrow(addTypeField, Priority.ALWAYS);
HBox.setHgrow(saveButton, Priority.ALWAYS);
addTypeField.setPromptText("Sensor Type");
addTypeField.getItems().addAll(Types.values());
final int btnCount = buttonBox.getChildren().size();
addNameField.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
addTypeField.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
saveButton.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
saveButton.setOnAction(__1 -> addField());
deleteButton.setOnAction(__1 -> {
mainController.removeSensor(currentSensor);
mainController.loadSensorList();
});
messageButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent __1) {
try {
final FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("message_ui.fxml"));
final Parent root1 = (Parent) fxmlLoader.load();
((MessageViewController) fxmlLoader.getController()).setCurrentSensor(currentSensor);
final Stage stage = new Stage();
stage.setScene(new Scene(root1));
stage.show();
} catch (final Exception $) {
System.out.println($);
}
}
});
}
use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.
the class SensorListViewController method enterSensorConfig.
private void enterSensorConfig(final SensorData d) {
if (d == null)
return;
final FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("sensor_configuration_ui.fxml"));
try {
JavaFxHelper.placeNodeInPane(fxmlLoader.load(), mainController.sidePane);
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final SensorConfigurationController controller = fxmlLoader.getController();
controller.setSensor(d).setMainController(mainController);
}
use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.
the class SimulatorController method loadSensorList.
public void loadSensorList() {
final FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("sensors_list_ui.fxml"));
try {
JavaFxHelper.placeNodeInPane(fxmlLoader.load(), sidePane);
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tableController = fxmlLoader.getController();
tableController.setMainController(this).setData(sensors);
}
use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.
the class SystemPresenter method createChildPresenter.
private PresenterInfo createChildPresenter(final URL fxmlLocation) throws Exception {
final FXMLLoader loader = new FXMLLoader(fxmlLocation);
loader.setControllerFactory(param -> {
try {
final SystemPresenter p = (SystemPresenter) param.newInstance();
p.systemCore = getModel();
p.parent = this;
return p;
} catch (final Exception e) {
log.error("Couldn't start child controller", e);
}
return null;
});
return loadPresenter(loader);
}
Aggregations