This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.3.3! |
StatusBarView
StatusBarView is a base implementation providing functionality to draw a status bar. Inherits BoxView.
┌─────────────────────────────┐
│ Item1 | Item2 | Item3 │
└─────────────────────────────┘
You can create a simple status bar with an item:
StatusItem item1 = new StatusBarView.StatusItem("Item1");
StatusBarView statusBar = new StatusBarView(List.of(item1));
Constructor can take array form which allows to lay out simple item definitions in a dsl style.
new StatusBarView(new StatusItem[] {
StatusItem.of("Item1"),
StatusItem.of("Item2")
.setAction(() -> {}),
StatusItem.of("Item3")
.setAction(() -> {})
.setHotKey(Key.f10)
});
Items support runnable actions which generally as executed when item is selected. It can also get attached to a hot key.
StatusItem item1 = StatusBarView.StatusItem.of("Item1");
Runnable action1 = () -> {};
StatusItem item2 = StatusBarView.StatusItem.of("Item2", action1);
Runnable action2 = () -> {};
StatusItem item3 = StatusBarView.StatusItem.of("Item3", action2, KeyEvent.Key.f10);
StatusBarView statusBar = new StatusBarView();
statusBar.setItems(List.of(item1, item2, item3));
Events
Event | Description |
---|---|
StatusBarViewOpenSelectedItemEvent |
StatusItem is selected. |