2323import dev .ikm .tinkar .common .service .ServiceKeys ;
2424import dev .ikm .tinkar .common .service .ServiceProperties ;
2525import dev .ikm .tinkar .coordinate .Calculators ;
26+ import javafx .geometry .Insets ;
2627import javafx .scene .Scene ;
28+ import javafx .scene .control .ContentDisplay ;
29+ import javafx .scene .control .Label ;
30+ import javafx .scene .control .ListView ;
2731import javafx .scene .control .ScrollPane ;
2832import javafx .scene .control .TextField ;
33+ import javafx .scene .control .TitledPane ;
34+ import javafx .scene .layout .HBox ;
35+ import javafx .scene .layout .Priority ;
2936import javafx .scene .layout .Region ;
3037import javafx .scene .layout .VBox ;
3138import org .junit .jupiter .api .AfterAll ;
@@ -74,18 +81,23 @@ void showBrowser() throws Exception {
7481 FxToolkit .setupStage (stage -> {
7582 ComponentSearchTextField searchTextField = KLComponentControlFactory .createComponentSearchTextField (Calculators .View .Default ());
7683 searchTextField .setPromptText ("Search instances by component" );
77- // A list far taller than the column, as the real browser's is: the search row must not
78- // be squeezed to make room for it.
84+ // Two stand-in cards in the entry FXML's shape (pattern-nav-entry.fxml), one expanded with
85+ // a filter count, to see the browser's card styling — then a list far taller than the
86+ // column, as the real browser's is: the search row must not be squeezed to make room.
87+ VBox cards = new VBox (card ("Description Pattern" , true ), card ("Identifier Pattern" , false ));
88+ cards .getStyleClass ().add ("pattern-navigation-container" );
7989 Region tallList = new Region ();
8090 tallList .setPrefHeight (4000 );
81- ScrollPane patternList = new ScrollPane (tallList );
91+ cards .getChildren ().add (tallList );
92+ ScrollPane patternList = new ScrollPane (cards );
93+ patternList .setFitToWidth (true );
8294 patternList .getStyleClass ().add ("pattern-navigation-scroll-pane" );
8395 VBox patternsPanel = ConceptPatternNavController .createPatternsPanel (searchTextField , patternList );
8496 column = new VBox (patternsPanel );
8597 column .getStyleClass ().addAll ("concept-pattern-container" , "grey-vertical-scroll-area" );
8698 column .getStylesheets ().add (ComponentSearchTextField .class
8799 .getResource ("/dev/ikm/komet/kview/mvvm/view/kview.css" ).toExternalForm ());
88- stage .setScene (new Scene (column , 430 , 300 ));
100+ stage .setScene (new Scene (column , 430 , 420 ));
89101 stage .show ();
90102 });
91103 FxToolkit .setupFixture (() -> column .applyCss ());
@@ -96,6 +108,36 @@ void hideBrowser() throws Exception {
96108 FxToolkit .cleanupStages ();
97109 }
98110
111+ /** A pattern card as pattern-nav-entry.fxml and PatternNavEntryController build one, by style class. */
112+ private static HBox card (String name , boolean expanded ) {
113+ Label title = new Label (name );
114+ HBox titleRow = new HBox (title );
115+ titleRow .getStyleClass ().add ("pattern-title-container" );
116+
117+ ListView <String > instances = new ListView <>();
118+ instances .getStyleClass ().add ("pattern-instances-list-view" );
119+ instances .setPrefHeight (90 );
120+ TitledPane pane = new TitledPane ("SEMANTIC ELEMENTS" , instances );
121+ pane .getStyleClass ().add ("search-entry-title-pane" );
122+ pane .setAnimated (false );
123+ VBox .setMargin (pane , new Insets (0 , 8 , 8 , 8 ));
124+
125+ VBox main = new VBox (titleRow , pane );
126+ if (expanded ) {
127+ main .getStyleClass ().add ("search-entry-title-pane-pattern" );
128+ Label count = new Label ("3" );
129+ count .getStyleClass ().add ("semantic-elements-count" );
130+ pane .setContentDisplay (ContentDisplay .RIGHT );
131+ pane .setGraphic (count );
132+ }
133+ pane .setExpanded (expanded );
134+
135+ HBox card = new HBox (main );
136+ HBox .setHgrow (main , Priority .ALWAYS );
137+ card .getStyleClass ().addAll ("search-entry-hbox" , "pattern-instance-container" );
138+ return card ;
139+ }
140+
99141 @ Test
100142 @ DisplayName ("The search field takes the box styling (30px tall) and renders to target/pattern-browser-search/search.png" )
101143 void searchFieldIsStyled () {
0 commit comments