use of javafx.scene.control.Alert in project dwoss by gg-net.
the class ImportImageIdsAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
Ui.exec(() -> {
Optional<File> inFile = Ui.fileChooser().open().opt();
if (!inFile.isPresent())
return;
Ui.build().dialog().eval(() -> new Alert(CONFIRMATION, "ImageIds aus der Datei:" + inFile.get().getPath() + " importieren ?")).opt().filter(b -> b == OK).map(b -> TikaUtil.isExcel(inFile.get())).filter(Ui.failure()::handle).map(Reply::getPayload).map(f -> Ui.progress().call(() -> Dl.remote().lookup(ImageIdHandler.class).importMissing(new FileJacket("in", ".xls", f)))).filter(Ui.failure()::handle).isPresent();
});
}
use of javafx.scene.control.Alert in project Smartcity-Smarthouse by TechnionYP5777.
the class SendMessageController method loadFields.
public void loadFields() {
this.currentSensor = this.getModel().getSensor(getSelectedSensor());
Label l = new Label(currentSensor.getAlias() + " Fields:");
l.setFont(new Font("Arial", 20));
mainPane.getChildren().add(l);
this.typesList = getObservablePaths(currentSensor);
this.typesList.forEach(p -> {
Class c = p.getValue();
if (c.equals(Double.class))
addDoubleField(p.getKey());
if (c.equals(Integer.class))
addIntegerField(p.getKey());
if (c.equals(Boolean.class))
addBoolField(p.getKey());
if (c.equals(String.class))
addStringField(p.getKey());
});
Button saveButton = new Button("Send");
saveButton.setOnAction(__1 -> {
ranges = new HashMap<>();
issues = new ArrayList<>();
consumers.forEach(c -> c.accept(ranges));
if (encounterdIssue) {
errorMessage = "";
issues.forEach(s -> errorMessage += s + "\n");
encounterdIssue = false;
final Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error Dialog");
alert.setHeaderText("Invalid Field Ranges!");
alert.setContentText(errorMessage);
alert.showAndWait();
return;
}
currentSensor.streamMessages(ranges);
Stage stage = (Stage) saveButton.getScene().getWindow();
stage.close();
});
mainPane.getChildren().add(saveButton);
}
use of javafx.scene.control.Alert in project Smartcity-Smarthouse by TechnionYP5777.
the class ConfigurationWindowController method addField.
private void addField() {
String fieldName = addNameField.getText();
final Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error Dialog");
alert.setHeaderText("Invalid Field Name");
if ("".equals(fieldName)) {
alert.setContentText("Field Name cant be empty.");
alert.showAndWait();
return;
}
for (Pair<String, Class> x : this.typesList) if (x.getKey().equals(fieldName)) {
alert.setContentText("Field Name allready exists.");
alert.showAndWait();
return;
}
this.typesList.add(new Pair<String, Class>(addNameField.getText(), addTypeField.getValue().getEClass()));
addNameField.clear();
}
use of javafx.scene.control.Alert in project Smartcity-Smarthouse by TechnionYP5777.
the class DeveloperSimulatorController method openMessageWindow.
public void openMessageWindow() {
if (getObservablePaths(this.getModel().getSensor(getSelectedSensor())).isEmpty()) {
final Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error Dialog");
alert.setHeaderText("Sensor has no fields");
alert.setContentText("Make sure to configure the sensor before starting to stream.");
alert.showAndWait();
return;
}
this.messageController = createChildController(getClass().getResource("/message_ui.fxml"));
messageController.loadFields();
final Stage stage = new Stage();
stage.setScene(new Scene(messageController.getRootViewNode(), 500, 200));
stage.show();
}
use of javafx.scene.control.Alert in project Smartcity-Smarthouse by TechnionYP5777.
the class MappingController method addRoom.
void addRoom(String roomName) {
if (!mappingInformaton.addRoom(roomName)) {
final Alert alert = new Alert(AlertType.ERROR);
alert.setTitle("Error Dialog");
alert.setHeaderText("Room allready exists");
alert.setContentText("Make sure to give a unique name to each room.");
alert.showAndWait();
}
sensors.values().forEach(e -> e.updateRooms());
drawMapping();
}
Aggregations