Files
chart-app/src/main/java/com/example/components/Fa.java
T
Pit Friedrich 8545b06f41
CI / build-and-test (pull_request) Successful in 2m25s
fix: add a per-widget action menu (#27)
A GridStackItem now carries an overflow menu next to the grip and the
close button: refresh, maximize, duplicate, remove. Maximize and remove
are handled by the item itself; refresh and duplicate are only reported,
since what they mean depends on the widget.

Maximizing only sets a class — the item's gs-* attributes and its
gridstack node are untouched, so restoring is by definition the position
it had.

The menu sits outside the drag-handle selector, like the close button, so
opening it never starts a drag; a Playwright test drags it to prove it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0124BiJikbhbiEsNfJxdWM69
2026-07-28 21:26:05 +02:00

47 lines
1.5 KiB
Java

package com.example.components;
import com.vaadin.flow.component.icon.FontIcon;
/**
* Font Awesome Free icon references, mirroring the ergonomics of
* {@code VaadinIcon.create()}. Backed by the {@code fa-*} CSS classes
* shipped in the bundled {@code @fortawesome/fontawesome-free} package.
*
* <p>Font Awesome paints glyphs via {@code content: var(--fa)} on
* {@code ::before}; the glyph-specific class (e.g. {@code fa-sun}) is what
* defines that {@code --fa} custom property, so both the family class
* ({@code fa-solid}) and the glyph class must be present.
*/
public enum Fa {
MOON("fa-solid", "fa-moon"),
SUN("fa-solid", "fa-sun"),
DASHBOARD("fa-solid", "fa-gauge-high"),
FORM("fa-solid", "fa-rectangle-list"),
TABLE("fa-solid", "fa-table"),
GLOBE("fa-solid", "fa-globe"),
SEARCH("fa-solid", "fa-magnifying-glass"),
GRID("fa-solid", "fa-table-cells-large"),
ADD("fa-solid", "fa-plus"),
REMOVE("fa-solid", "fa-trash"),
RESET("fa-solid", "fa-arrow-rotate-left"),
DRAG("fa-solid", "fa-grip-vertical"),
CLOSE("fa-solid", "fa-xmark"),
MENU("fa-solid", "fa-ellipsis-vertical"),
REFRESH("fa-solid", "fa-arrows-rotate"),
MAXIMIZE("fa-solid", "fa-expand"),
DUPLICATE("fa-solid", "fa-clone"),
TREND_UP("fa-solid", "fa-arrow-trend-up"),
TREND_DOWN("fa-solid", "fa-arrow-trend-down");
private final String[] classes;
Fa(String... classes) {
this.classes = classes;
}
public FontIcon create() {
return new FontIcon(classes);
}
}