Search in sources :

Example 46 with Tooltip

use of javafx.scene.control.Tooltip in project org.csstudio.display.builder by kasemir.

the class EditorDemoGUI method createButton.

private Button createButton(final ActionDescription action) {
    final Button button = new Button();
    try {
        button.setGraphic(new ImageView(new Image(ResourceUtil.openPlatformResource(action.getIconResourcePath()))));
    } catch (final Exception ex) {
        logger.log(Level.WARNING, "Cannot load action icon", ex);
    }
    button.setTooltip(new Tooltip(action.getToolTip()));
    button.setOnAction(event -> action.run(editor));
    return button;
}
Also used : Button(javafx.scene.control.Button) Tooltip(javafx.scene.control.Tooltip) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Example 47 with Tooltip

use of javafx.scene.control.Tooltip in project org.csstudio.display.builder by kasemir.

the class Palette method createWidgetEntries.

/**
 * Create entry for each widget type
 * @param palette_groups Map with parent panes for each widget category
 */
private void createWidgetEntries(final Map<WidgetCategory, Pane> palette_groups) {
    final Set<String> deprecated = Preferences.getHiddenWidgets();
    // Sort alphabetically-case-insensitive widgets inside their group
    // based on the widget's name, instead of the original set order or class name.
    WidgetFactory.getInstance().getWidgetDescriptions().stream().filter(desc -> !deprecated.contains(desc.getType())).sorted((d1, d2) -> String.CASE_INSENSITIVE_ORDER.compare(d1.getName(), d2.getName())).forEach(desc -> {
        final ToggleButton button = new ToggleButton(desc.getName());
        final Image icon = WidgetIcons.getIcon(desc.getType());
        if (icon != null)
            button.setGraphic(new ImageView(icon));
        button.setPrefWidth(PREFERRED_WIDTH);
        button.setAlignment(Pos.BASELINE_LEFT);
        button.setTooltip(new Tooltip(desc.getDescription()));
        button.setOnAction(event -> {
            // Remember the widget-to-create via rubberband
            active_widget_type = desc;
            // De-select all _other_ buttons
            deselectButtons(button);
        });
        palette_groups.get(desc.getCategory()).getChildren().add(button);
        WidgetTransfer.addDragSupport(button, editor, this, desc, icon);
    });
}
Also used : Pos(javafx.geometry.Pos) HashMap(java.util.HashMap) VBox(javafx.scene.layout.VBox) ArrayList(java.util.ArrayList) Insets(javafx.geometry.Insets) ScrollPane(javafx.scene.control.ScrollPane) DisplayEditor(org.csstudio.display.builder.editor.DisplayEditor) Map(java.util.Map) ClearingTextField(org.csstudio.javafx.ClearingTextField) Tooltip(javafx.scene.control.Tooltip) WidgetDescriptor(org.csstudio.display.builder.model.WidgetDescriptor) Pane(javafx.scene.layout.Pane) HBox(javafx.scene.layout.HBox) TextField(javafx.scene.control.TextField) TitledPane(javafx.scene.control.TitledPane) Collection(java.util.Collection) Node(javafx.scene.Node) Set(java.util.Set) Messages(org.csstudio.display.builder.editor.Messages) Collectors(java.util.stream.Collectors) Priority(javafx.scene.layout.Priority) List(java.util.List) ToggleButton(javafx.scene.control.ToggleButton) WidgetFactory(org.csstudio.display.builder.model.WidgetFactory) ScrollBarPolicy(javafx.scene.control.ScrollPane.ScrollBarPolicy) TilePane(javafx.scene.layout.TilePane) ImageView(javafx.scene.image.ImageView) WidgetCategory(org.csstudio.display.builder.model.WidgetCategory) BorderPane(javafx.scene.layout.BorderPane) WidgetTransfer(org.csstudio.display.builder.editor.util.WidgetTransfer) Preferences(org.csstudio.display.builder.editor.Preferences) WidgetIcons(org.csstudio.display.builder.editor.util.WidgetIcons) Image(javafx.scene.image.Image) ToggleButton(javafx.scene.control.ToggleButton) Tooltip(javafx.scene.control.Tooltip) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image)

Example 48 with Tooltip

use of javafx.scene.control.Tooltip in project org.csstudio.display.builder by kasemir.

the class ImageToolbarHandler method newItem.

private ButtonBase newItem(final boolean toggle, final ToolIcons icon, final String tool_tip) {
    final ButtonBase item = toggle ? new ToggleButton() : new Button();
    try {
        item.setGraphic(new ImageView(Activator.getIcon(icon.name().toLowerCase())));
    } catch (Exception ex) {
        logger.log(Level.WARNING, "Cannot get icon" + icon, ex);
        item.setText(icon.toString());
    }
    item.setTooltip(new Tooltip(tool_tip));
    toolbar.getItems().add(item);
    return item;
}
Also used : ToggleButton(javafx.scene.control.ToggleButton) Button(javafx.scene.control.Button) ToggleButton(javafx.scene.control.ToggleButton) Tooltip(javafx.scene.control.Tooltip) ButtonBase(javafx.scene.control.ButtonBase) ImageView(javafx.scene.image.ImageView)

Example 49 with Tooltip

use of javafx.scene.control.Tooltip in project org.csstudio.display.builder by kasemir.

the class ImageToolbarHandler method addUndo.

private void addUndo(final boolean active) {
    final Button undo = newButton(ToolIcons.UNDO, Messages.Undo_TT);
    final Button redo = newButton(ToolIcons.REDO, Messages.Redo_TT);
    final UndoableActionManager undo_mgr = plot.getUndoableActionManager();
    undo.setDisable(!undo_mgr.canUndo());
    redo.setDisable(!undo_mgr.canRedo());
    if (active) {
        undo.setOnAction(event -> plot.getUndoableActionManager().undoLast());
        redo.setOnAction(event -> plot.getUndoableActionManager().redoLast());
        undo_mgr.addListener((to_undo, to_redo) -> {
            Platform.runLater(() -> {
                if (to_undo == null) {
                    undo.setDisable(true);
                    undo.setTooltip(new Tooltip(Messages.Undo_TT));
                } else {
                    undo.setDisable(false);
                    undo.setTooltip(new Tooltip(NLS.bind(Messages.Undo_Fmt_TT, to_undo)));
                }
                if (to_redo == null) {
                    redo.setDisable(true);
                    redo.setTooltip(new Tooltip(Messages.Redo_TT));
                } else {
                    redo.setDisable(false);
                    redo.setTooltip(new Tooltip(NLS.bind(Messages.Redo_Fmt_TT, to_redo)));
                }
            });
        });
    }
}
Also used : Button(javafx.scene.control.Button) ToggleButton(javafx.scene.control.ToggleButton) UndoableActionManager(org.csstudio.display.builder.util.undo.UndoableActionManager) Tooltip(javafx.scene.control.Tooltip)

Example 50 with Tooltip

use of javafx.scene.control.Tooltip in project org.csstudio.display.builder by kasemir.

the class RTPlot method showAxisLimitsField.

private void showAxisLimitsField(final NumericAxis axis, final boolean isHigh, final Rectangle area) {
    axisLimitsField.setOnKeyPressed((KeyEvent event) -> {
        if (event.getCode().equals(KeyCode.ENTER)) {
            hideAxisLimitsField();
            if (axisLimitsField.getText().isEmpty())
                return;
            try {
                Double value = Double.parseDouble(axisLimitsField.getText());
                changeAxisLimit(axis, isHigh, value);
            } catch (NumberFormatException e) {
            }
        } else if (event.getCode().equals(KeyCode.ESCAPE)) {
            hideAxisLimitsField();
        }
    });
    String tip = isHigh ? axis.getValueRange().getHigh().toString() : axis.getValueRange().getLow().toString();
    axisLimitsField.setText(tip);
    axisLimitsField.setTooltip(new Tooltip("Original value: " + tip));
    axisLimitsField.setVisible(true);
    axisLimitsField.relocate(area.getX(), area.getY());
    axisLimitsField.resize(area.getWidth(), area.getHeight());
    axisLimitsField.requestFocus();
    // force text to appear in field
    axisLimitsField.layout();
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) Tooltip(javafx.scene.control.Tooltip)

Aggregations

Tooltip (javafx.scene.control.Tooltip)173 Button (javafx.scene.control.Button)61 Label (javafx.scene.control.Label)51 Insets (javafx.geometry.Insets)38 ImageView (javafx.scene.image.ImageView)34 VBox (javafx.scene.layout.VBox)32 List (java.util.List)31 TableColumn (javafx.scene.control.TableColumn)29 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)28 FXML (javafx.fxml.FXML)27 TableCell (javafx.scene.control.TableCell)27 ObservableList (javafx.collections.ObservableList)26 Node (javafx.scene.Node)26 TableView (javafx.scene.control.TableView)26 ArrayList (java.util.ArrayList)25 Inject (javax.inject.Inject)25 Res (bisq.core.locale.Res)24 FxmlView (bisq.desktop.common.view.FxmlView)23 HyperlinkWithIcon (bisq.desktop.components.HyperlinkWithIcon)23 Collectors (java.util.stream.Collectors)23