Add focused color and style for BoxView title

- May define focused color and style for title
  which overrides normal color and style if set.
- Use these in a catalog app.
- Relates #804
This commit is contained in:
Janne Valkealahti
2023-07-21 09:26:31 +01:00
parent 748f41103d
commit c074af314b
2 changed files with 39 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ import org.springframework.shell.component.view.geom.Rectangle;
import org.springframework.shell.component.view.message.ShellMessageBuilder;
import org.springframework.shell.component.view.screen.Screen;
import org.springframework.shell.component.view.screen.Screen.Writer;
import org.springframework.shell.component.view.screen.ScreenItem;
import org.springframework.shell.samples.catalog.scenario.Scenario;
import org.springframework.shell.samples.catalog.scenario.ScenarioComponent;
import org.springframework.util.ObjectUtils;
@@ -196,6 +197,7 @@ public class Catalog {
List<String> items = List.copyOf(categoryMap.keySet());
categories.setItems(items);
categories.setTitle("Categories");
categories.setFocusedTitleStyle(ScreenItem.STYLE_BOLD);
categories.setShowBorder(true);
return categories;
}
@@ -215,6 +217,7 @@ public class Catalog {
ListView<ScenarioData> scenarios = new ListView<>();
scenarios.setEventLoop(eventLoop);
scenarios.setTitle("Scenarios");
scenarios.setFocusedTitleStyle(ScreenItem.STYLE_BOLD);
scenarios.setShowBorder(true);
scenarios.setCellFactory(list -> new ScenarioListCell());
return scenarios;