> This change fixes missing graphic in the `TabPane` overflow menu, using a > different approach. Instead of providing a graphic override property, it now > uses a "decorator" pattern to allow for wider customization of the overflow > menu (following @Maran23 's suggestion). > > > ### Summary of Changes > > - minor `TabPaneSkin` constructor javadoc clarification > - added the `overflowMenuDecorator` property > - changed popup menu to be created on demand > - avoid adding the popup reference to the `TabHeaderSkin.properties` (I think > it was done for testing purposes, but I could not find any references to it > in the platform code) > > > ### Question for the Reviewers > > 1. do we want to bind the `MenuItem.text` property if decorator is set? > > > > # Overflow Menu Decorator Property in the TabPaneSkin > > Andy Goryachev > > <[email protected]> > > > ## Summary > > Add the `overflowMenuDecorator` property in the `TabPaneSkin` class for the > purpose of eliminating the current > limitation which makes it impossible to customize the menu items' text, as > well as graphic, which is currently > limited to either an `ImageView` or a `Label` with an `ImageView` graphic. > > > > ## Goals > > The goals of this proposal are: > > - to allow the application developers to customize the overflow menu item > graphic > - to enable wider choices for the graphic in the overflow menu > - retain the backward compatibility with the existing application code > - clarify the behavior of the skin when the property is null (i.e. the > current behavior) > > > > ## Non-Goals > > The following are not the goals of this proposal: > > - disable the overflow menu > - configure overflow menu graphic property via CSS > - add this property to the `TabPane` control itself > > > > ## Motivation > > The existing `TabPaneSkin` does not allow the overflow menu to show graphic > other than > an `ImageView` or `Label` with an `ImageView`. > > This limitation makes it impossible for the application developer to use > other graphic Nodes, > such as `Path` or `Canvas`, or in fact any other types. The situation > becomes even more egregious > when the tabs in the `TabPane` have no text. > > Example: > > > public class TabPaneGraphicFactoryExample { > public void example() { > Tab tab1 = new Tab("Tab1"); > tab1.setGraphic(...); > > Tab tab2 = new Tab("Tab2"); > tab2.setGraphic(...); > > TabPane tabPane = new TabPane(); > tabPane.getTabs().addAll(tab1, tab2); > > TabPaneSkin skin = new TabPaneSkin(tabPane); > // set overflow menu factory with the same method as was...
Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 34 commits: - test - cleanup - overflow menu decorator - Merge remote-tracking branch 'origin/master' into 8353599.menu.factory - Merge branch 'master' into 8353599.menu.factory - override - javadoc - Revert "factory" This reverts commit 354a515b364a656f96c52023847c7331befbefd2. - factory - Merge branch 'master' into 8353599.menu.factory - ... and 24 more: https://git.openjdk.org/jfx/compare/279cafb4...b16d5460 ------------- Changes: https://git.openjdk.org/jfx/pull/1773/files Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1773&range=20 Stats: 183 lines in 2 files changed: 137 ins; 28 del; 18 mod Patch: https://git.openjdk.org/jfx/pull/1773.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1773/head:pull/1773 PR: https://git.openjdk.org/jfx/pull/1773
