From 1f820e41bbc308e5b117a4f1b4674d61adadd381 Mon Sep 17 00:00:00 2001 From: mkpaz Date: Sat, 27 May 2023 20:17:30 +0400 Subject: [PATCH] Refactor TabPane examples --- .../sampler/page/components/TabPanePage.java | 71 ++----------------- 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/sampler/src/main/java/atlantafx/sampler/page/components/TabPanePage.java b/sampler/src/main/java/atlantafx/sampler/page/components/TabPanePage.java index b7f8441..7ff0d04 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/TabPanePage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/TabPanePage.java @@ -54,20 +54,19 @@ public final class TabPanePage extends OutlinePage { ); addSection("Usage", usageExample()); addSection("Tab Style", tabStyleExample()); - addSection("Vertical Tabs", verticalTabsExample()); addSection("Dense", denseExample()); addSection("Playground", playground()); } private ExampleBox usageExample() { //snippet_1:start - var tab1 = new Tab("One"); + var tab1 = new Tab("Tab 1"); tab1.setGraphic(new FontIcon(randomIcon())); - var tab2 = new Tab("Two"); + var tab2 = new Tab("Tab 2"); tab2.setGraphic(new FontIcon(randomIcon())); - var tab3 = new Tab("Three"); + var tab3 = new Tab("Tab 3"); tab3.setGraphic(new FontIcon(randomIcon())); var tabs = new TabPane(tab1, tab2, tab3); @@ -90,20 +89,20 @@ public final class TabPanePage extends OutlinePage { private ExampleBox tabStyleExample() { //snippet_2:start var defaultTabs = new TabPane( - new Tab("One"), new Tab("Two"), new Tab("Three") + new Tab("Tab 1"), new Tab("Tab 1"), new Tab("Tab 3") ); defaultTabs.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); defaultTabs.setMinWidth(450); var floatingTabs = new TabPane( - new Tab("One"), new Tab("Two"), new Tab("Three") + new Tab("Tab 1"), new Tab("Tab 2"), new Tab("Tab 3") ); floatingTabs.getStyleClass().add(Styles.TABS_FLOATING); floatingTabs.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); floatingTabs.setMinWidth(450); var classicTabs = new TabPane( - new Tab("One"), new Tab("Two"), new Tab("Three") + new Tab("Tab 1"), new Tab("Tab 2"), new Tab("Tab 3") ); classicTabs.getStyleClass().add(Styles.TABS_CLASSIC); classicTabs.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); @@ -124,64 +123,6 @@ public final class TabPanePage extends OutlinePage { return new ExampleBox(box, new Snippet(getClass(), 2), description); } - private ExampleBox verticalTabsExample() { - //snippet_3:start - var defaultTabsLeft = new TabPane( - new Tab("One"), new Tab("Two") - ); - defaultTabsLeft.setSide(Side.LEFT); - defaultTabsLeft.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); - - var floatingTabsLeft = new TabPane( - new Tab("One"), new Tab("Two") - ); - floatingTabsLeft.setSide(Side.LEFT); - floatingTabsLeft.getStyleClass().add(Styles.TABS_FLOATING); - floatingTabsLeft.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); - - var classicTabsLeft = new TabPane( - new Tab("One"), new Tab("Two") - ); - classicTabsLeft.setSide(Side.LEFT); - classicTabsLeft.getStyleClass().add(Styles.TABS_CLASSIC); - classicTabsLeft.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); - - var defaultTabsRight = new TabPane( - new Tab("One"), new Tab("Two") - ); - defaultTabsRight.setSide(Side.RIGHT); - defaultTabsRight.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); - - var floatingTabsRight = new TabPane( - new Tab("One"), new Tab("Two") - ); - floatingTabsRight.setSide(Side.RIGHT); - floatingTabsRight.getStyleClass().add(Styles.TABS_FLOATING); - floatingTabsRight.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); - - var classicTabsRight = new TabPane( - new Tab("One"), new Tab("Two") - ); - classicTabsRight.setSide(Side.RIGHT); - classicTabsRight.getStyleClass().add(Styles.TABS_CLASSIC); - classicTabsRight.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); - //snippet_3:end - - var box = new HBox( - HGAP_20, - defaultTabsLeft, floatingTabsLeft, classicTabsLeft, - new Spacer(), - classicTabsRight, floatingTabsRight, defaultTabsRight - ); - box.setMinHeight(450); - - var description = BBCodeParser.createFormattedText(""" - Tabs in a tab pane can be positioned at any of the four sides by specifying the side.""" - ); - - return new ExampleBox(box, new Snippet(getClass(), 3), description); - } - private ExampleBox denseExample() { //snippet_4:start var tab1 = new Tab("One");