Search in sources :

Example 6 with SimpleBooleanProperty

use of javafx.beans.property.SimpleBooleanProperty in project bitsquare by bitsquare.

the class TorNetworkNode method shutDownTimerTriggered.

private BooleanProperty shutDownTimerTriggered() {
    final BooleanProperty done = new SimpleBooleanProperty();
    shutDownTimeoutTimer = UserThread.runAfter(() -> {
        log.error("A timeout occurred at shutDown");
        done.set(true);
    }, SHUT_DOWN_TIMEOUT_SEC);
    return done;
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty)

Example 7 with SimpleBooleanProperty

use of javafx.beans.property.SimpleBooleanProperty in project jgnash by ccavanaugh.

the class Options method createBooleanProperty.

private static SimpleBooleanProperty createBooleanProperty(final String name, final boolean defaultValue) {
    final SimpleBooleanProperty property = new SimpleBooleanProperty(null, name, p.getBoolean(name, defaultValue));
    property.addListener(booleanChangeListener);
    return property;
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty)

Example 8 with SimpleBooleanProperty

use of javafx.beans.property.SimpleBooleanProperty in project jgnash by ccavanaugh.

the class NotificationDialog method initialize.

@FXML
private void initialize() {
    final TableColumn<PendingReminder, Boolean> enabledColumn = new TableColumn<>(resources.getString("Column.Approve"));
    enabledColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue().isApproved()));
    enabledColumn.setCellFactory(CheckBoxTableCell.forTableColumn(enabledColumn));
    tableView.getColumns().add(enabledColumn);
    final TableColumn<PendingReminder, LocalDate> dateColumn = new TableColumn<>(resources.getString("Column.Date"));
    dateColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getCommitDate()));
    dateColumn.setCellFactory(cell -> new DateTableCell());
    tableView.getColumns().add(dateColumn);
    final TableColumn<PendingReminder, String> descriptionColumn = new TableColumn<>(resources.getString("Column.Description"));
    descriptionColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getReminder().getDescription()));
    tableView.getColumns().add(descriptionColumn);
    tableView.setItems(observableReminderList);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    // Toggle the selection
    tableView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            newValue.setApproved(!newValue.isApproved());
            tableView.refresh();
            Platform.runLater(() -> tableView.getSelectionModel().clearSelection());
        }
    });
    okButton.onActionProperty().set(event -> handleOkayAction());
    cancelButton.onActionProperty().set(event -> handleCancelAction());
    selectAllButton.onActionProperty().set(event -> handleSelectAllAction());
    clearAllButton.onActionProperty().set(event -> handleClearAllAction());
    invertButton.onActionProperty().set(event -> handleInvertSelectionAction());
    snoozeComboBox.setSelectedPeriod(Options.reminderSnoozePeriodProperty().get());
    // Bind options to the snooze period property
    Options.reminderSnoozePeriodProperty().bind(snoozeComboBox.periodProperty());
    MessageBus.getInstance().registerListener(this, MessageChannel.SYSTEM);
}
Also used : PendingReminder(jgnash.engine.recurring.PendingReminder) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) TableColumn(javafx.scene.control.TableColumn) LocalDate(java.time.LocalDate) FXML(javafx.fxml.FXML)

Example 9 with SimpleBooleanProperty

use of javafx.beans.property.SimpleBooleanProperty 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($);
            }
        }
    });
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper) Parent(javafx.scene.Parent) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Example 10 with SimpleBooleanProperty

use of javafx.beans.property.SimpleBooleanProperty in project bitsquare by bitsquare.

the class TorNetworkNode method torNetworkNodeShutDown.

private BooleanProperty torNetworkNodeShutDown() {
    final BooleanProperty done = new SimpleBooleanProperty();
    executorService.submit(() -> {
        Utilities.setThreadName("torNetworkNodeShutDown");
        long ts = System.currentTimeMillis();
        log.debug("Shutdown torNetworkNode");
        try {
            if (torNetworkNode != null)
                torNetworkNode.shutdown();
            log.debug("Shutdown torNetworkNode done after " + (System.currentTimeMillis() - ts) + " ms.");
        } catch (Throwable e) {
            log.error("Shutdown torNetworkNode failed with exception: " + e.getMessage());
            e.printStackTrace();
        } finally {
            UserThread.execute(() -> done.set(true));
        }
    });
    return done;
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty)

Aggregations

SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)17 BooleanProperty (javafx.beans.property.BooleanProperty)8 FXML (javafx.fxml.FXML)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 ObservableValue (javafx.beans.value.ObservableValue)3 ActionEvent (javafx.event.ActionEvent)3 IManager (EmployeeContracts.IManager)2 ConnectionFailure (EmployeeDefs.AEmployeeException.ConnectionFailure)2 EmployeeNotConnected (EmployeeDefs.AEmployeeException.EmployeeNotConnected)2 InvalidParameter (EmployeeDefs.AEmployeeException.InvalidParameter)2 Manager (EmployeeImplementations.Manager)2 CriticalError (SMExceptions.CommonExceptions.CriticalError)2 InjectionFactory (UtilsImplementations.InjectionFactory)2 StackTraceUtil (UtilsImplementations.StackTraceUtil)2 JFXButton (com.jfoenix.controls.JFXButton)2 JFXListView (com.jfoenix.controls.JFXListView)2 JFXTextField (com.jfoenix.controls.JFXTextField)2 URL (java.net.URL)2 HashSet (java.util.HashSet)2 ResourceBundle (java.util.ResourceBundle)2