StatusBarView

StatusBarView is a base implementation providing functionality to draw a status bar. Inherits BoxView.spring-doc.cn

┌─────────────────────────────┐
│ Item1 | Item2 | Item3       │
└─────────────────────────────┘

You can create a simple status bar with an item:spring-doc.cn

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.spring-doc.cn

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.spring-doc.cn

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

Table 1. StatusBarView Events
Event Description

StatusBarViewOpenSelectedItemEventspring-doc.cn

StatusItem is selected.spring-doc.cn