public class MenuBarSkin extends BehaviorSkinBase<MenuBar,BehaviorBase<MenuBar>> implements TraverseListener
Modifier and Type | Class and Description |
---|---|
(package private) static class |
MenuBarSkin.MenuBarButton |
IS_TOUCH_SUPPORTED
Constructor and Description |
---|
MenuBarSkin(MenuBar control)
*
Constructors *
*
|
Modifier and Type | Method and Description |
---|---|
private void |
cleanUpSystemMenu() |
private void |
clearMenuButtonHover() |
protected double |
computeMaxHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Computes the maximum allowable height of the Skin, based on the provided
width.
|
protected double |
computeMinHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Computes the minimum allowable height of the Skin, based on the provided
width.
|
protected double |
computeMinWidth(double height,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Computes the minimum allowable width of the Skin, based on the provided
height.
|
protected double |
computePrefHeight(double width,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Calculates the preferred height of this
SkinBase . |
protected double |
computePrefWidth(double height,
double topInset,
double rightInset,
double bottomInset,
double leftInset)
Calculates the preferred width of this
SkinBase . |
ObjectProperty<Pos> |
containerAlignmentProperty() |
void |
dispose()
Called by a Skinnable when the Skin is replaced on the Skinnable.
|
private Menu |
findNextSibling() |
private Menu |
findPreviousSibling() |
static java.util.List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
Pos |
getContainerAlignment() |
java.util.List<CssMetaData<? extends Styleable,?>> |
getCssMetaData()
This method should delegate to
Node.getClassCssMetaData() so that
a Node's CssMetaData can be accessed without the need for reflection. |
(package private) int |
getFocusedMenuIndex() |
(package private) EventHandler<KeyEvent> |
getKeyEventHandler() |
private int |
getMenuBarButtonIndex(MenuBarSkin.MenuBarButton m) |
private static MenuBarSkin |
getMenuBarSkin(Stage stage) |
(package private) MenuButton |
getNodeForMenu(int i) |
double |
getSpacing() |
private static void |
initSystemMenuBar() |
private boolean |
isMenuEmpty(Menu menu) |
protected void |
layoutChildren(double x,
double y,
double w,
double h)
Layout the menu bar.
|
private boolean |
menuContainsCustomMenuItem(Menu menu) |
private void |
menuModeEnd() |
private void |
menuModeStart(int newIndex) |
private boolean |
menusContainCustomMenuItem() |
void |
onTraverse(Node node,
Bounds bounds) |
protected java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters)
*
Accessibility handling *
*
|
private void |
rebuildUI() |
private void |
resetOpenMenu() |
private void |
selectNextMenu() |
private void |
selectPrevMenu() |
void |
setContainerAlignment(Pos value) |
static void |
setDefaultSystemMenuBar(MenuBar menuBar) |
void |
setSpacing(double value) |
private static void |
setSystemMenu(Stage stage) |
private void |
showNextMenu() |
private void |
showPrevMenu() |
protected double |
snappedBottomInset()
Utility method to get the bottom inset which includes padding and border
inset.
|
protected double |
snappedLeftInset()
Utility method to get the left inset which includes padding and border
inset.
|
protected double |
snappedRightInset()
Utility method to get the right inset which includes padding and border
inset.
|
protected double |
snappedTopInset()
*
Layout *
*
|
DoubleProperty |
spacingProperty() |
private void |
unSelectMenus() |
private void |
updateActionListeners(Menu m,
boolean add) |
private void |
updateFocusedIndex() |
getBehavior, handleControlPropertyChanged, registerChangeListener, unregisterChangeListener
computeBaselineOffset, computeMaxWidth, consumeMouseEvents, executeAccessibleAction, getChildren, getNode, getSkinnable, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, snapPosition, snapSize, snapSpace
private final HBox container
private Menu openMenu
private MenuBarSkin.MenuBarButton openMenuButton
private int focusedMenuIndex
private static java.util.WeakHashMap<Stage,java.lang.ref.Reference<MenuBarSkin>> systemMenuMap
private static java.util.List<MenuBase> wrappedDefaultMenus
private static Stage currentMenuBarStage
private java.util.List<MenuBase> wrappedMenus
private WeakEventHandler<KeyEvent> weakSceneKeyEventHandler
private WeakEventHandler<MouseEvent> weakSceneMouseEventHandler
private WeakChangeListener<java.lang.Boolean> weakWindowFocusListener
private WeakChangeListener<Window> weakWindowSceneListener
private EventHandler<KeyEvent> keyEventHandler
private EventHandler<MouseEvent> mouseEventHandler
private ChangeListener<java.lang.Boolean> menuBarFocusedPropertyListener
private ChangeListener<Scene> sceneChangeListener
java.lang.Runnable firstMenuRunnable
private boolean pendingDismiss
private EventHandler<ActionEvent> menuActionEventHandler
private ListChangeListener<MenuItem> menuItemListener
private DoubleProperty spacing
private ObjectProperty<Pos> containerAlignment
private static final CssMetaData<MenuBar,java.lang.Number> SPACING
private static final CssMetaData<MenuBar,Pos> ALIGNMENT
private static final java.util.List<CssMetaData<? extends Styleable,?>> STYLEABLES
public MenuBarSkin(MenuBar control)
public static void setDefaultSystemMenuBar(MenuBar menuBar)
private static MenuBarSkin getMenuBarSkin(Stage stage)
private static void setSystemMenu(Stage stage)
private static void initSystemMenuBar()
EventHandler<KeyEvent> getKeyEventHandler()
MenuButton getNodeForMenu(int i)
int getFocusedMenuIndex()
private boolean menusContainCustomMenuItem()
private boolean menuContainsCustomMenuItem(Menu menu)
private int getMenuBarButtonIndex(MenuBarSkin.MenuBarButton m)
private void updateActionListeners(Menu m, boolean add)
private void rebuildUI()
public final void setSpacing(double value)
public final double getSpacing()
public final DoubleProperty spacingProperty()
public final void setContainerAlignment(Pos value)
public final Pos getContainerAlignment()
public final ObjectProperty<Pos> containerAlignmentProperty()
public void dispose()
BehaviorSkinBase
Skin.getSkinnable()
and Skin.getNode()
should return null following a call to dispose. Calling dispose twice
has no effect.dispose
in interface Skin<MenuBar>
dispose
in class BehaviorSkinBase<MenuBar,BehaviorBase<MenuBar>>
private void cleanUpSystemMenu()
private boolean isMenuEmpty(Menu menu)
private void resetOpenMenu()
private void unSelectMenus()
private void menuModeStart(int newIndex)
private void menuModeEnd()
private void selectNextMenu()
private void selectPrevMenu()
private void showNextMenu()
private void showPrevMenu()
private Menu findPreviousSibling()
private Menu findNextSibling()
private void updateFocusedIndex()
private void clearMenuButtonHover()
public void onTraverse(Node node, Bounds bounds)
onTraverse
in interface TraverseListener
protected double snappedTopInset()
snappedTopInset
in class SkinBase<MenuBar>
protected double snappedBottomInset()
SkinBase
snappedBottomInset
in class SkinBase<MenuBar>
protected double snappedLeftInset()
SkinBase
snappedLeftInset
in class SkinBase<MenuBar>
protected double snappedRightInset()
SkinBase
snappedRightInset
in class SkinBase<MenuBar>
protected void layoutChildren(double x, double y, double w, double h)
layoutChildren
in class SkinBase<MenuBar>
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
computeMinWidth
in class SkinBase<MenuBar>
height
- The height of the Skin, in case this value might dictate
the minimum width.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
SkinBase
. The default
implementation calculates this width as the width of the area occupied
by its managed children when they are positioned at their
current positions at their preferred widths.computePrefWidth
in class SkinBase<MenuBar>
height
- the height that should be used if preferred width depends on ittopInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
computeMinHeight
in class SkinBase<MenuBar>
width
- The width of the Skin, in case this value might dictate
the minimum height.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
SkinBase
. The default
implementation calculates this height as the height of the area occupied
by its managed children when they are positioned at their current
positions at their preferred heights.computePrefHeight
in class SkinBase<MenuBar>
width
- the width that should be used if preferred height depends on ittopInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetprotected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)
SkinBase
computeMaxHeight
in class SkinBase<MenuBar>
width
- The width of the Skin, in case this value might dictate
the maximum height.topInset
- the pixel snapped top insetrightInset
- the pixel snapped right insetbottomInset
- the pixel snapped bottom insetleftInset
- the pixel snapped left insetpublic static java.util.List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public java.util.List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Node.getClassCssMetaData()
so that
a Node's CssMetaData can be accessed without the need for reflection.getCssMetaData
in class SkinBase<MenuBar>
protected java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
queryAccessibleAttribute
in class SkinBase<MenuBar>
Node.queryAccessibleAttribute(javafx.scene.AccessibleAttribute, java.lang.Object...)