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;
}
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);
});
}
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;
}
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)));
}
});
});
}
}
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();
}
Aggregations