Search in sources :

Example 96 with Alert

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();
    });
}
Also used : Alert(javafx.scene.control.Alert) FileJacket(eu.ggnet.dwoss.util.FileJacket) AccessableAction(eu.ggnet.saft.core.auth.AccessableAction) Ui(eu.ggnet.saft.Ui) ActionEvent(java.awt.event.ActionEvent) File(java.io.File) Dl(eu.ggnet.saft.Dl) CONFIRMATION(javafx.scene.control.Alert.AlertType.CONFIRMATION) TikaUtil(eu.ggnet.dwoss.util.TikaUtil) Reply(eu.ggnet.saft.api.Reply) IMPORT_IMAGE_IDS(eu.ggnet.dwoss.rights.api.AtomicRight.IMPORT_IMAGE_IDS) ImageIdHandler(eu.ggnet.dwoss.misc.ee.ImageIdHandler) Optional(java.util.Optional) OK(javafx.scene.control.ButtonType.OK) ImageIdHandler(eu.ggnet.dwoss.misc.ee.ImageIdHandler) Alert(javafx.scene.control.Alert) FileJacket(eu.ggnet.dwoss.util.FileJacket) File(java.io.File)

Example 97 with Alert

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);
}
Also used : Button(javafx.scene.control.Button) RadioButton(javafx.scene.control.RadioButton) Label(javafx.scene.control.Label) Stage(javafx.stage.Stage) Alert(javafx.scene.control.Alert) Font(javafx.scene.text.Font)

Example 98 with Alert

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();
}
Also used : Alert(javafx.scene.control.Alert)

Example 99 with Alert

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();
}
Also used : Stage(javafx.stage.Stage) Alert(javafx.scene.control.Alert) Scene(javafx.scene.Scene)

Example 100 with Alert

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();
}
Also used : Alert(javafx.scene.control.Alert)

Aggregations

Alert (javafx.scene.control.Alert)213 ButtonType (javafx.scene.control.ButtonType)71 FXML (javafx.fxml.FXML)55 Stage (javafx.stage.Stage)53 ActionEvent (javafx.event.ActionEvent)36 KeyFrame (javafx.animation.KeyFrame)32 Timeline (javafx.animation.Timeline)32 EventHandler (javafx.event.EventHandler)32 File (java.io.File)21 IOException (java.io.IOException)17 Button (javafx.scene.control.Button)15 Label (javafx.scene.control.Label)15 TextInputDialog (javafx.scene.control.TextInputDialog)15 GridPane (javafx.scene.layout.GridPane)13 FileChooser (javafx.stage.FileChooser)13 TextArea (javafx.scene.control.TextArea)11 GoToOperation (operation.GoToOperation)11 AlertType (javafx.scene.control.Alert.AlertType)10 DialogPane (javafx.scene.control.DialogPane)10 PrintWriter (java.io.PrintWriter)9