Example usage for javafx.scene.control Tooltip Tooltip

List of usage examples for javafx.scene.control Tooltip Tooltip

Introduction

In this page you can find the example usage for javafx.scene.control Tooltip Tooltip.

Prototype

public Tooltip(String text) 

Source Link

Document

Creates a tooltip with the specified text.

Usage

From source file:dsfixgui.view.DSFSavesPane.java

private void initializeEventHandlers() {

    applySettingsButton.setOnAction(e -> {
        ui.applyDSFConfig();/* www . j  a  v  a2s.  c om*/
    });

    restoreDefaultsButton.setOnAction(e -> {
        ContinueDialog cD = new ContinueDialog(300.0, 80.0, DIALOG_TITLE_RESET, DIALOG_MSG_RESTORE_SETTINGS,
                DIALOG_BUTTON_TEXTS[2], DIALOG_BUTTON_TEXTS[1]);

        if (cD.show()) {
            config.restoreDefaultSaveOptions();
            ui.refreshUI();
        }
    });

    saveBackupsPicker.setOnAction(e -> {
        if (saveBackupsPicker.getValue().equals(DISABLE_ENABLE[0])) {
            saveIntervalField.setDisable(true);
            maxSavesField.setDisable(true);
            config.enableBackups.set(0);
        } else {
            saveIntervalField.setDisable(false);
            maxSavesField.setDisable(false);
            config.enableBackups.set(1);
        }
    });

    saveIntervalField.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldText, String newText) {
            try {
                if (!NumberUtils.isParsable(newText) || Integer.parseInt(newText) < 600) {
                    saveIntervalField.pseudoClassStateChanged(INVALID_INPUT, true);
                    saveIntervalField.setTooltip(new Tooltip(INPUT_GREATER_THAN_EQ + "600"));
                } else {
                    saveIntervalField.pseudoClassStateChanged(INVALID_INPUT, false);
                    saveIntervalField.setTooltip(new Tooltip(""));
                    config.backupInterval.set(Integer.parseInt(newText));
                }
            } catch (NumberFormatException nFE) {
                ui.printConsole(INPUT_TOO_LARGE);
                saveIntervalField.setText("");
            }
        }
    });

    maxSavesField.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldText, String newText) {
            try {
                if (!NumberUtils.isParsable(newText) || Integer.parseInt(newText) < 1) {
                    maxSavesField.pseudoClassStateChanged(INVALID_INPUT, true);
                    maxSavesField.setTooltip(new Tooltip(INPUT_GREATER_THAN_EQ + "1"));
                } else {
                    maxSavesField.pseudoClassStateChanged(INVALID_INPUT, false);
                    maxSavesField.setTooltip(new Tooltip(""));
                    config.maxBackups.set(Integer.parseInt(newText));
                }
            } catch (NumberFormatException nFE) {
                ui.printConsole(INPUT_TOO_LARGE);
                maxSavesField.setText("");
            }
        }
    });
}

From source file:com.esri.geoevent.test.performance.ui.FixtureController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    initPropertiesCache();/*from   www  .  j  a  va2  s .c  om*/

    nameLabel.setText(UIMessages.getMessage("UI_FIXTURE_NAME_LABEL"));
    nameField.setText(fixture != null ? fixture.getName() : "");
    editNameBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_FIXTURE_EDIT_NAME_DESC")));

    //set up the tables
    //producers
    producersLabel.setText(UIMessages.getMessage("UI_PRODUCERS_LABEL"));
    producersNameColumn.setText(UIMessages.getMessage("UI_PRODUCERS_NAME_COL_LABEL"));
    producersNameColumn.prefWidthProperty().bind(producersTable.widthProperty().multiply(0.83));
    producersDeleteColumn.prefWidthProperty().bind(producersTable.widthProperty().multiply(0.16));
    producersDeleteColumn.setCellFactory(callback -> new DeleteableTableCell<ConnectableRemoteHost>());
    producerHostName.setPromptText(UIMessages.getMessage("UI_PRODUCER_HOST_NAME_DESC"));
    producerPort.setPromptText(UIMessages.getMessage("UI_PRODUCER_PORT_DESC"));
    producerAddBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_PRODUCER_ADD_BTN_DESC")));
    producersProtocolLabel.setText(UIMessages.getMessage("UI_PROTOCOL_LABEL"));
    producersProtocolType.setItems(getProducerProtocolList());
    producersProtocolType.setValue(Protocol.TCP);
    producersPropsLabel.setText(UIMessages.getMessage("UI_PROPERTY_LABEL"));
    producersPropNameColumn.setText(UIMessages.getMessage("UI_PROPERTY_NAME_COL_LABEL"));
    producersPropNameColumn.prefWidthProperty().bind(producersPropsTable.widthProperty().multiply(0.48));
    producersPropValueColumn.setText(UIMessages.getMessage("UI_PROPERTY_VALUE_COL_LABEL"));
    producersPropValueColumn.prefWidthProperty().bind(producersPropsTable.widthProperty().multiply(0.5));
    producersPropValueColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    producersPropValueColumn.setOnEditCommit(event -> {
        Property property = (Property) event.getTableView().getItems().get(event.getTablePosition().getRow());
        property.setValue(event.getNewValue());
    });

    //consumers
    consumersLabel.setText(UIMessages.getMessage("UI_CONSUMERS_LABEL"));
    consumersNameColumn.setText(UIMessages.getMessage("UI_CONSUMERS_NAME_COL_LABEL"));
    consumersNameColumn.prefWidthProperty().bind(consumersTable.widthProperty().multiply(0.83));
    consumersDeleteColumn.prefWidthProperty().bind(consumersTable.widthProperty().multiply(0.16));
    consumersDeleteColumn.setCellFactory(callback -> new DeleteableTableCell<ConnectableRemoteHost>());
    consumerHostName.setPromptText(UIMessages.getMessage("UI_CONSUMER_HOST_NAME_DESC"));
    consumerPort.setPromptText(UIMessages.getMessage("UI_CONSUMER_PORT_DESC"));
    consumerAddBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_CONSUMER_ADD_BTN_DESC")));
    consumersProtocolLabel.setText(UIMessages.getMessage("UI_PROTOCOL_LABEL"));
    consumersProtocolType.setItems(getConsumerProtocolList());
    consumersProtocolType.setValue(Protocol.TCP);
    consumersPropsLabel.setText(UIMessages.getMessage("UI_PROPERTY_LABEL"));
    consumersPropNameColumn.setText(UIMessages.getMessage("UI_PROPERTY_NAME_COL_LABEL"));
    consumersPropNameColumn.prefWidthProperty().bind(consumersPropsTable.widthProperty().multiply(0.48));
    consumersPropValueColumn.setText(UIMessages.getMessage("UI_PROPERTY_VALUE_COL_LABEL"));
    consumersPropValueColumn.prefWidthProperty().bind(consumersPropsTable.widthProperty().multiply(0.5));
    consumersPropValueColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    consumersPropValueColumn.setOnEditCommit(event -> {
        Property property = (Property) event.getTableView().getItems().get(event.getTablePosition().getRow());
        property.setValue(event.getNewValue());
    });

    // simulation
    testTypeLabel.setText(UIMessages.getMessage("UI_TEST_TYPE_LABEL"));
    testType.setTooltip(new Tooltip(UIMessages.getMessage("UI_TEST_TYPE_DESC")));
    testType.setItems(getTestTypes());
    testType.setValue(TestType.TIME);
    // time
    eventsPerSecLabel.setText(UIMessages.getMessage("UI_EVENTS_PER_SEC_LABEL"));
    totalTimeInSecLabel.setText(UIMessages.getMessage("UI_TOTAL_TIME_IN_SEC_LABEL"));
    expectedResultCountPerSecLabel.setText(UIMessages.getMessage("UI_EXPECTED_EVENTS_PER_SEC_LABEL"));
    staggeringIntervalLabel.setText(UIMessages.getMessage("UI_STAGGERING_INTERVAL_LABEL"));
    // stress
    numOfEventsLabel.setText(UIMessages.getMessage("UI_NUM_OF_EVENTS_LABEL"));
    iterationsLabel.setText(UIMessages.getMessage("UI_ITERATIONS_LABEL"));
    expectedResultCountLabel.setText(UIMessages.getMessage("UI_EXPECTED_EVENT_COUNT_LABEL"));
    // ramp
    minEventsLabel.setText(UIMessages.getMessage("UI_MIN_EVENTS_LABEL"));
    maxEventsLabel.setText(UIMessages.getMessage("UI_MAX_EVENTS_LABEL"));
    eventsToAddPerTestLabel.setText(UIMessages.getMessage("UI_EVENTS_TO_ADD_LABEL"));
    expectedResultCountPerTestLabel.setText(UIMessages.getMessage("UI_EXPECTED_EVENTS_PER_TEST_LABEL"));

    applySimulationBtn.setText(UIMessages.getMessage("UI_APPLY_SIMULATION_LABEL"));

    //set up state
    toggleEditName(null);
    setEditNameState(isEditingName);
    toggleProducerProtocolType(null);
    toggleConsumerProtocolType(null);
}

From source file:org.pdfsam.ui.dashboard.preference.PreferenceConfig.java

public PreferenceIntTextField thumbnailsSize() {
    PreferenceIntTextField thumbnails = new PreferenceIntTextField(IntUserPreference.THUMBNAILS_SIZE,
            userContext, Validators.newPositiveIntRangeString(THUMB_SIZE_LOWER, THUMB_SIZE_UPPER));
    thumbnails.setText(Integer.toString(userContext.getThumbnailsSize()));
    thumbnails.setErrorMessage(DefaultI18nContext.getInstance().i18n("Size must be between {0}px and {1}px",
            THUMB_SIZE_LOWER.toString(), THUMB_SIZE_UPPER.toString()));
    String helpText = DefaultI18nContext.getInstance().i18n(
            "Pixel size of the thumbnails (between {0}px and {1}px)", THUMB_SIZE_LOWER.toString(),
            THUMB_SIZE_UPPER.toString());
    thumbnails.setPromptText(helpText);//from   w  ww .  j  a v a2s  . c  om
    thumbnails.setTooltip(new Tooltip(helpText));
    thumbnails.setId("thumbnailsSize");
    return thumbnails;
}

From source file:eu.over9000.skadi.ui.MainWindow.java

private void setupToolbar(final Stage stage) {

    this.add = GlyphsDude.createIconButton(FontAwesomeIcons.PLUS);
    this.addName = new TextField();
    this.addName.setOnAction(event -> this.add.fire());

    this.add.setOnAction(event -> {
        final String name = this.addName.getText().trim();

        if (name.isEmpty()) {
            return;
        }/*  w  w w .  j  a va2 s.com*/

        final boolean result = this.channelHandler.addChannel(name, this.sb);

        if (result) {
            this.addName.clear();
        }

    });

    this.imprt = GlyphsDude.createIconButton(FontAwesomeIcons.DOWNLOAD);
    this.imprt.setOnAction(event -> {
        final TextInputDialog dialog = new TextInputDialog();
        dialog.initModality(Modality.APPLICATION_MODAL);
        dialog.initOwner(stage);
        dialog.setTitle("Import followed channels");
        dialog.setHeaderText("Import followed channels from Twitch");
        dialog.setGraphic(null);
        dialog.setContentText("Twitch username:");

        dialog.showAndWait().ifPresent(name -> {
            final ImportFollowedService ifs = new ImportFollowedService(this.channelHandler, name, this.sb);
            ifs.start();
        });
    });

    this.details = GlyphsDude.createIconButton(FontAwesomeIcons.INFO);
    this.details.setDisable(true);
    this.details.setOnAction(event -> {
        this.detailChannel.set(this.table.getSelectionModel().getSelectedItem());
        if (!this.sp.getItems().contains(this.detailPane)) {
            this.sp.getItems().add(this.detailPane);
            this.doDetailSlide(true);
        }
    });
    this.details.setTooltip(new Tooltip("Show channel information"));

    this.remove = GlyphsDude.createIconButton(FontAwesomeIcons.TRASH);
    this.remove.setDisable(true);
    this.remove.setOnAction(event -> {
        final Channel candidate = this.table.getSelectionModel().getSelectedItem();

        final Alert alert = new Alert(AlertType.CONFIRMATION);
        alert.initModality(Modality.APPLICATION_MODAL);
        alert.initOwner(stage);
        alert.setTitle("Delete channel");
        alert.setHeaderText("Delete " + candidate.getName());
        alert.setContentText("Do you really want to delete " + candidate.getName() + "?");

        final Optional<ButtonType> result = alert.showAndWait();
        if (result.get() == ButtonType.OK) {
            this.channelHandler.getChannels().remove(candidate);
            this.sb.setText("Removed channel " + candidate.getName());
        }
    });

    this.refresh = GlyphsDude.createIconButton(FontAwesomeIcons.REFRESH);
    this.refresh.setTooltip(new Tooltip("Refresh all channels"));
    this.refresh.setOnAction(event -> {
        this.refresh.setDisable(true);
        final ForcedChannelUpdateService service = new ForcedChannelUpdateService(this.channelHandler, this.sb,
                this.refresh);
        service.start();
    });

    this.settings = GlyphsDude.createIconButton(FontAwesomeIcons.COG);
    this.settings.setTooltip(new Tooltip("Settings"));
    this.settings.setOnAction(event -> {
        final SettingsDialog dialog = new SettingsDialog();
        dialog.initModality(Modality.APPLICATION_MODAL);
        dialog.initOwner(stage);
        final Optional<StateContainer> result = dialog.showAndWait();
        if (result.isPresent()) {
            this.persistenceHandler.saveState(result.get());
        }
    });

    this.onlineOnly = new ToggleButton("Live", GlyphsDude.createIcon(FontAwesomeIcons.FILTER));
    this.onlineOnly.setSelected(this.currentState.isOnlineFilterActive());

    this.onlineOnly.setOnAction(event -> {
        this.currentState.setOnlineFilterActive(this.onlineOnly.isSelected());
        this.persistenceHandler.saveState(this.currentState);
        this.updateFilterPredicate();
    });
    // TODO re-enable if 8u60 is released
    this.onlineOnly.setDisable(true);

    this.filterText = new TextField();
    this.filterText.textProperty().addListener((obs, oldV, newV) -> this.updateFilterPredicate());
    this.filterText.setTooltip(new Tooltip("Filter channels by name, status and game"));

    // TODO re-enable if 8u60 is released
    this.filterText.setDisable(true);

    this.tb = new ToolBar();
    this.tb.getItems().addAll(this.addName, this.add, this.imprt, new Separator(), this.refresh, this.settings,
            new Separator(), this.onlineOnly, this.filterText, new Separator(), this.details, this.remove);

    this.chatAndStreamButton = new HandlerControlButton(this.chatHandler, this.streamHandler, this.table,
            this.tb, this.sb);

    this.updateFilterPredicate();
}

From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginView.java

@Override
public Region getContent() {
    if (hBox == null) {
        VBox statedInferredToggleGroupVBox = new VBox();
        statedInferredToggleGroupVBox.setSpacing(4.0);

        //Instantiate Everything
        pathComboBox = new ComboBox<>(); //Path
        statedInferredToggleGroup = new ToggleGroup(); //Stated / Inferred
        List<RadioButton> statedInferredOptionButtons = new ArrayList<>();
        datePicker = new DatePicker(); //Date
        timeSelectCombo = new ComboBox<Long>(); //Time

        //Radio buttons
        for (StatedInferredOptions option : StatedInferredOptions.values()) {
            RadioButton optionButton = new RadioButton();
            if (option == StatedInferredOptions.STATED) {
                optionButton.setText("Stated");
            } else if (option == StatedInferredOptions.INFERRED_THEN_STATED) {
                optionButton.setText("Inferred Then Stated");
            } else if (option == StatedInferredOptions.INFERRED) {
                optionButton.setText("Inferred");
            } else {
                throw new RuntimeException("oops");
            }//  w  w  w  .j a  v  a 2s  . co m
            optionButton.setUserData(option);
            optionButton.setTooltip(
                    new Tooltip("Default StatedInferredOption is " + getDefaultStatedInferredOption()));
            statedInferredToggleGroup.getToggles().add(optionButton);
            statedInferredToggleGroupVBox.getChildren().add(optionButton);
            statedInferredOptionButtons.add(optionButton);
        }
        statedInferredToggleGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            @Override
            public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue,
                    Toggle newValue) {
                currentStatedInferredOptionProperty.set((StatedInferredOptions) newValue.getUserData());
            }
        });

        //Path Combo Box
        pathComboBox.setCellFactory(new Callback<ListView<UUID>, ListCell<UUID>>() {
            @Override
            public ListCell<UUID> call(ListView<UUID> param) {
                final ListCell<UUID> cell = new ListCell<UUID>() {
                    @Override
                    protected void updateItem(UUID c, boolean emptyRow) {
                        super.updateItem(c, emptyRow);
                        if (c == null) {
                            setText(null);
                        } else {
                            String desc = OTFUtility.getDescription(c);
                            setText(desc);
                        }
                    }
                };
                return cell;
            }
        });

        pathComboBox.setButtonCell(new ListCell<UUID>() { // Don't know why this should be necessary, but without this the UUID itself is displayed
            @Override
            protected void updateItem(UUID c, boolean emptyRow) {
                super.updateItem(c, emptyRow);
                if (emptyRow) {
                    setText("");
                } else {
                    String desc = OTFUtility.getDescription(c);
                    setText(desc);
                }
            }
        });
        pathComboBox.setOnAction((event) -> {
            if (!pathComboFirstRun) {
                UUID selectedPath = pathComboBox.getSelectionModel().getSelectedItem();
                if (selectedPath != null) {
                    int path = OTFUtility.getConceptVersion(selectedPath).getPathNid();

                    StampBdb stampDb = Bdb.getStampDb();
                    NidSet nidSet = new NidSet();
                    nidSet.add(path);
                    //TODO: Make this multi-threaded and possibly implement setTimeOptions() here also
                    NidSetBI stamps = stampDb.getSpecifiedStamps(nidSet, Long.MIN_VALUE, Long.MAX_VALUE);

                    pathDatesList.clear();
                    //                  disableTimeCombo(true);
                    timeSelectCombo.setValue(Long.MAX_VALUE);

                    for (Integer thisStamp : stamps.getAsSet()) {
                        try {
                            Position stampPosition = stampDb.getPosition(thisStamp);
                            this.stampDate = new Date(stampPosition.getTime());
                            stampDateInstant = stampDate.toInstant().atZone(ZoneId.systemDefault())
                                    .toLocalDate();
                            this.pathDatesList.add(stampDateInstant); //Build DatePicker
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    datePicker.setValue(LocalDate.now());
                }
            } else {
                pathComboFirstRun = false;
            }
        });

        pathComboBox.setTooltip(
                new Tooltip("Default path is \"" + OTFUtility.getDescription(getDefaultPath()) + "\""));

        //Calendar Date Picker
        final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
            @Override
            public DateCell call(final DatePicker datePicker) {
                return new DateCell() {
                    @Override
                    public void updateItem(LocalDate thisDate, boolean empty) {
                        super.updateItem(thisDate, empty);
                        if (pathDatesList != null) {
                            if (pathDatesList.contains(thisDate)) {
                                setDisable(false);
                            } else {
                                setDisable(true);
                            }
                        }
                    }
                };
            }
        };
        datePicker.setDayCellFactory(dayCellFactory);
        datePicker.setOnAction((event) -> {
            if (!datePickerFirstRun) {
                UUID selectedPath = pathComboBox.getSelectionModel().getSelectedItem();

                Instant instant = Instant.from(datePicker.getValue().atStartOfDay(ZoneId.systemDefault()));
                Long dateSelected = Date.from(instant).getTime();

                if (selectedPath != null && dateSelected != 0) {

                    int path = OTFUtility.getConceptVersion(selectedPath).getPathNid();
                    setTimeOptions(path, dateSelected);
                    try {
                        timeSelectCombo.setValue(times.first()); //Default Dropdown Value
                    } catch (Exception e) {
                        // Eat it.. like a sandwich! TODO: Create Read Only Property Conditional for checking if Time Combo is disabled
                        // Right now, Sometimes Time Combo is disabled, so we catch this and eat it
                        // Otherwise make a conditional from the Read Only Boolean Property to check first
                    }
                } else {
                    disableTimeCombo(false);
                    logger.debug("The path isn't set or the date isn't set. Both are needed right now");
                }
            } else {
                datePickerFirstRun = false;
            }
        });

        //Commit-Time ComboBox
        timeSelectCombo.setMinWidth(200);
        timeSelectCombo.setCellFactory(new Callback<ListView<Long>, ListCell<Long>>() {
            @Override
            public ListCell<Long> call(ListView<Long> param) {
                final ListCell<Long> cell = new ListCell<Long>() {
                    @Override
                    protected void updateItem(Long item, boolean emptyRow) {
                        super.updateItem(item, emptyRow);
                        if (item == null) {
                            setText("");
                        } else {
                            if (item == Long.MAX_VALUE) {
                                setText("LATEST TIME");
                            } else {
                                setText(timeFormatter.format(new Date(item)));
                            }
                        }
                    }
                };
                return cell;
            }
        });
        timeSelectCombo.setButtonCell(new ListCell<Long>() {
            @Override
            protected void updateItem(Long item, boolean emptyRow) {
                super.updateItem(item, emptyRow);
                if (item == null) {
                    setText("");
                } else {
                    if (item == Long.MAX_VALUE) {
                        setText("LATEST TIME");
                    } else {
                        setText(timeFormatter.format(new Date(item)));
                    }
                }
            }
        });

        try {
            currentPathProperty.bind(pathComboBox.getSelectionModel().selectedItemProperty()); //Set Path Property
            currentTimeProperty.bind(timeSelectCombo.getSelectionModel().selectedItemProperty());
        } catch (Exception e) {
            e.printStackTrace();
        }

        // DEFAULT VALUES
        UserProfile loggedIn = ExtendedAppContext.getCurrentlyLoggedInUserProfile();
        storedTimePref = loggedIn.getViewCoordinateTime();
        storedPathPref = loggedIn.getViewCoordinatePath();

        if (storedPathPref != null) {
            pathComboBox.getItems().clear(); //Set the path Dates by default
            pathComboBox.getItems().addAll(getPathOptions());
            final UUID storedPath = getStoredPath();
            if (storedPath != null) {
                pathComboBox.getSelectionModel().select(storedPath);
            }

            if (storedTimePref != null) {
                final Long storedTime = loggedIn.getViewCoordinateTime();
                Calendar cal = Calendar.getInstance();
                cal.setTime(new Date(storedTime));
                cal.set(Calendar.MILLISECOND, 0); //Strip milliseconds
                Long storedTruncTime = cal.getTimeInMillis();

                if (!storedTime.equals(Long.MAX_VALUE)) { //***** FIX THIS, not checking default vc time value
                    int path = OTFUtility.getConceptVersion(storedPathPref).getPathNid();
                    setTimeOptions(path, storedTimePref);
                    timeSelectCombo.setValue(storedTruncTime);
                    //                  timeSelectCombo.getItems().addAll(getTimeOptions()); //The correct way, but doesen't work

                    Date storedDate = new Date(storedTime);
                    datePicker.setValue(storedDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
                } else {
                    datePicker.setValue(LocalDate.now());
                    timeSelectCombo.getItems().addAll(Long.MAX_VALUE); //The correct way, but doesen't work
                    timeSelectCombo.setValue(Long.MAX_VALUE);
                    //                  disableTimeCombo(false);
                }
            } else { //Stored Time Pref == null
                logger.error("ERROR: Stored Time Preference = null");
            }
        } else { //Stored Path Pref == null
            logger.error("We could not load a stored path, ISAAC cannot run");
            throw new Error("No stored PATH could be found. ISAAC can't run without a path");
        }

        GridPane gridPane = new GridPane();
        gridPane.setHgap(10);
        gridPane.setVgap(10);

        Label pathLabel = new Label("View Coordinate Path");
        gridPane.add(pathLabel, 0, 0); //Path Label - Row 0
        GridPane.setHalignment(pathLabel, HPos.LEFT);
        gridPane.add(statedInferredToggleGroupVBox, 1, 0, 1, 2); //--Row 0, span 2

        gridPane.add(pathComboBox, 0, 1); //Path Combo box - Row 2
        GridPane.setValignment(pathComboBox, VPos.TOP);

        Label datePickerLabel = new Label("View Coordinate Dates");
        gridPane.add(datePickerLabel, 0, 2); //Row 3
        GridPane.setHalignment(datePickerLabel, HPos.LEFT);
        gridPane.add(datePicker, 0, 3); //Row 4

        Label timeSelectLabel = new Label("View Coordinate Times");
        gridPane.add(timeSelectLabel, 1, 2); //Row 3
        GridPane.setHalignment(timeSelectLabel, HPos.LEFT);
        gridPane.add(timeSelectCombo, 1, 3); //Row 4

        // FOR DEBUGGING CURRENTLY SELECTED PATH, TIME AND POLICY
        /*         
                 UserProfile userProfile = ExtendedAppContext.getCurrentlyLoggedInUserProfile();
                 StatedInferredOptions chosenPolicy = userProfile.getStatedInferredPolicy();
                 UUID chosenPathUuid = userProfile.getViewCoordinatePath();
                 Long chosenTime = userProfile.getViewCoordinateTime();
                         
                 Label printSelectedPathLabel = new Label("Path: " + OTFUtility.getDescription(chosenPathUuid));
                 gridPane.add(printSelectedPathLabel, 0, 4);
                 GridPane.setHalignment(printSelectedPathLabel, HPos.LEFT);
                 Label printSelectedTimeLabel = null;
                 if(chosenTime != getDefaultTime()) {
                    printSelectedTimeLabel = new Label("Time: " + dateFormat.format(new Date(chosenTime)));
                 } else {
                    printSelectedTimeLabel = new Label("Time: LONG MAX VALUE");
                 }
                 gridPane.add(printSelectedTimeLabel, 1, 4);
                 GridPane.setHalignment(printSelectedTimeLabel, HPos.LEFT);
                 Label printSelectedPolicyLabel = new Label("Policy: " + chosenPolicy);
                 gridPane.add(printSelectedPolicyLabel, 2, 4);
                 GridPane.setHalignment(printSelectedPolicyLabel, HPos.LEFT);
                 */
        hBox = new HBox();
        hBox.getChildren().addAll(gridPane);

        allValid_ = new ValidBooleanBinding() {
            {
                bind(currentStatedInferredOptionProperty, currentPathProperty, currentTimeProperty);
                setComputeOnInvalidate(true);
            }

            @Override
            protected boolean computeValue() {
                if (currentStatedInferredOptionProperty.get() == null) {
                    this.setInvalidReason("Null/unset/unselected StatedInferredOption");
                    for (RadioButton button : statedInferredOptionButtons) {
                        TextErrorColorHelper.setTextErrorColor(button);
                    }
                    return false;
                } else {
                    for (RadioButton button : statedInferredOptionButtons) {
                        TextErrorColorHelper.clearTextErrorColor(button);
                    }
                }
                if (currentPathProperty.get() == null) {
                    this.setInvalidReason("Null/unset/unselected path");
                    TextErrorColorHelper.setTextErrorColor(pathComboBox);

                    return false;
                } else {
                    TextErrorColorHelper.clearTextErrorColor(pathComboBox);
                }
                if (OTFUtility.getConceptVersion(currentPathProperty.get()) == null) {
                    this.setInvalidReason("Invalid path");
                    TextErrorColorHelper.setTextErrorColor(pathComboBox);

                    return false;
                } else {
                    TextErrorColorHelper.clearTextErrorColor(pathComboBox);
                }
                //               if(currentTimeProperty.get() == null && currentTimeProperty.get() != Long.MAX_VALUE)
                //               {
                //                  this.setInvalidReason("View Coordinate Time is unselected");
                //                  TextErrorColorHelper.setTextErrorColor(timeSelectCombo);
                //                  return false;
                //               }
                this.clearInvalidReason();
                return true;
            }
        };
    }
    //      createButton.disableProperty().bind(saveButtonValid.not()));

    // Reload persisted values every time
    final StatedInferredOptions storedStatedInferredOption = getStoredStatedInferredOption();
    for (Toggle toggle : statedInferredToggleGroup.getToggles()) {
        if (toggle.getUserData() == storedStatedInferredOption) {
            toggle.setSelected(true);
        }
    }

    //      pathComboBox.setButtonCell(new ListCell<UUID>() {
    //         @Override
    //         protected void updateItem(UUID c, boolean emptyRow) {
    //            super.updateItem(c, emptyRow); 
    //            if (emptyRow) {
    //               setText("");
    //            } else {
    //               String desc = OTFUtility.getDescription(c);
    //               setText(desc);
    //            }
    //         }
    //      });
    //      timeSelectCombo.setButtonCell(new ListCell<Long>() {
    //         @Override
    //         protected void updateItem(Long item, boolean emptyRow) {
    //            super.updateItem(item, emptyRow); 
    //            if (emptyRow) {
    //               setText("");
    //            } else {
    //               setText(timeFormatter.format(new Date(item)));
    //            }
    //         }
    //      });

    //      datePickerFirstRun = false;
    //      pathComboFirstRun = false;

    return hBox;
}

From source file:dsfixgui.view.DSFUnsafeSettingsPane.java

private void initializeEventHandlers() {

    applySettingsButton.setOnAction(e -> {
        ui.applyDSFConfig();/*from  ww  w . ja  v a 2 s. com*/
    });

    restoreDefaultsButton.setOnAction(e -> {
        ContinueDialog cD = new ContinueDialog(300.0, 80.0, DIALOG_TITLE_RESET, DIALOG_MSG_RESTORE_SETTINGS,
                DIALOG_BUTTON_TEXTS[2], DIALOG_BUTTON_TEXTS[1]);

        if (cD.show()) {
            config.restoreDefaultUnsafeOptions();
            ui.refreshUI();
        }
    });

    neitherWindowMode.setOnAction(e -> {
        config.forceFullscreen.set(0);
        config.forceWindowed.set(0);
    });

    forceFullscreen.setOnAction(e -> {
        config.forceFullscreen.set(1);
        config.forceWindowed.set(0);
    });

    forceWindowed.setOnAction(e -> {
        config.forceFullscreen.set(0);
        config.forceWindowed.set(1);
    });

    vsyncPicker.setOnAction(e -> {
        if (vsyncPicker.getValue().equals(DISABLE_ENABLE[0])) {
            config.enableVsync.set(0);
        } else {
            config.enableVsync.set(1);
        }
    });

    refreshRateField.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldText, String newText) {
            try {
                if (!NumberUtils.isParsable(newText) || Integer.parseInt(newText) < 1) {
                    refreshRateField.pseudoClassStateChanged(INVALID_INPUT, true);
                    refreshRateField.setTooltip(new Tooltip(INPUT_GREATER_THAN_EQ + "1"));
                } else {
                    refreshRateField.pseudoClassStateChanged(INVALID_INPUT, false);
                    refreshRateField.setTooltip(new Tooltip(""));
                    config.fullscreenHz.set(Integer.parseInt(newText));
                }
            } catch (NumberFormatException nFE) {
                ui.printConsole(INPUT_TOO_LARGE);
                refreshRateField.setText("");
            }
        }
    });
}

From source file:org.pdfsam.ui.dashboard.preference.PreferenceConfig.java

@Bean(name = "logViewRowsNumber")
public PreferenceIntTextField logViewRowsNumber() {
    PreferenceIntTextField logRowsNumber = new PreferenceIntTextField(IntUserPreference.LOGVIEW_ROWS_NUMBER,
            userContext, Validators.newPositiveIntegerString());
    logRowsNumber.setText(Integer.toString(userContext.getNumberOfLogRows()));
    logRowsNumber.setErrorMessage(/*from   w  ww .  j a v a  2 s  . c  om*/
            DefaultI18nContext.getInstance().i18n("Maximum number of rows mast be a positive number"));
    String helpText = DefaultI18nContext.getInstance()
            .i18n("Maximum number of rows displayed by the Log register");
    logRowsNumber.setPromptText(helpText);
    logRowsNumber.setTooltip(new Tooltip(helpText));
    logRowsNumber.setId("logViewRowsNumber");
    logRowsNumber.validProperty().addListener((o, oldVal, newVal) -> {
        if (newVal == ValidationState.VALID) {
            eventStudio().broadcast(new MaxLogRowsChangedEvent());
        }
    });
    return logRowsNumber;
}

From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java

/**
 * Helper method to toggle the UI running state
 *//*  w w  w .  j  a  va  2  s .  c om*/
private void toggleRunningState(boolean newRunningState) {
    isRunning = newRunningState;
    if (isRunning) {
        // start the executor
        try {
            this.executor = new OrchestratorRunner(fixtures);
            this.executor.start();
            this.executor.setRunningStateListener(this);
        } catch (RunningException error) {
            //TODO: error handling
            error.printStackTrace();
        }

        // toggle the ui
        startBtn.setText(UIMessages.getMessage("UI_STOP_BTN_LABEL"));
        startBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_STOP_BTN_DESC")));
        startBtn.setGraphic(
                new ImageView(new Image(FixtureController.class.getResourceAsStream(STOP_IMAGE_SOURCE))));
    } else {
        // stop execution
        if (this.executor != null) {
            if (this.executor.isRunning()) {
                this.executor.stop();
            } else {
                this.executor = null;
            }
        }

        startBtn.setText(UIMessages.getMessage("UI_START_BTN_LABEL"));
        startBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_START_BTN_DESC")));
        startBtn.setGraphic(
                new ImageView(new Image(FixtureController.class.getResourceAsStream(START_IMAGE_SOURCE))));
    }
}

From source file:com.esri.geoevent.test.performance.ui.ReportOptionsController.java

private void updateSelectedReportFile(String fileName) {
    if (!StringUtils.isEmpty(fileName)) {
        selectedReportFileLocationLabel.setText(fileName);
        selectedReportFileLocationLabel.setTooltip(new Tooltip(fileName));
        report.setReportFile(fileName);//from  w w w  .  j a  v  a2  s . c o m
    }
}

From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java

private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList,
        List<Country> dataProvider) {
    Label label = addLabel(gridPane, ++gridRow, title, 0);
    label.setWrapText(true);/*w  w w. j  a  v a  2  s .c o  m*/
    label.setMaxWidth(180);
    label.setTextAlignment(TextAlignment.RIGHT);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    flowPane.setMinHeight(55);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    dataProvider.stream().forEach(country -> {
        final String countryCode = country.code;
        CheckBox checkBox = new CheckBox(countryCode);
        checkBox.setUserData(countryCode);
        checkBoxList.add(checkBox);
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setMinWidth(45);
        checkBox.setMaxWidth(45);
        checkBox.setTooltip(new Tooltip(country.name));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                sepaAccount.addAcceptedCountry(countryCode);
            else
                sepaAccount.removeAcceptedCountry(countryCode);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });
    updateCountriesSelection(isEditable, checkBoxList);

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}