Package org.apache.pivot.wtk.skin.terra
Class TerraMenuSkin
- java.lang.Object
- 
- org.apache.pivot.wtk.skin.ComponentSkin
- 
- org.apache.pivot.wtk.skin.ContainerSkin
- 
- org.apache.pivot.wtk.skin.terra.TerraMenuSkin
 
 
 
- 
- All Implemented Interfaces:
- ComponentKeyListener,- ComponentListener,- ComponentMouseButtonListener,- ComponentMouseListener,- ComponentMouseWheelListener,- ComponentStateListener,- ComponentTooltipListener,- ConstrainedVisual,- ContainerListener,- ContainerMouseListener,- Menu.SectionListener,- MenuListener,- Skin,- Visual
 
 public class TerraMenuSkin extends ContainerSkin implements MenuListener, Menu.SectionListener Menu skin.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkinContainerSkin.IndexFocusTraversalPolicy
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListenerComponentKeyListener.Adapter, ComponentKeyListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListenerComponentListener.Adapter, ComponentListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListenerComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListenerComponentMouseListener.Adapter, ComponentMouseListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListenerComponentMouseWheelListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListenerComponentStateListener.Adapter, ComponentStateListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListenerComponentTooltipListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListenerContainerListener.Adapter, ContainerListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListenerContainerMouseListener.Adapter, ContainerMouseListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.Menu.SectionListenerMenu.SectionListener.Listeners
 - 
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.MenuListenerMenuListener.Adapter, MenuListener.Listeners
 
- 
 - 
Constructor SummaryConstructors Constructor Description TerraMenuSkin()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactiveItemChanged(Menu menu, Menu.Item previousActiveItem)Called when a menu's active item has changed.java.awt.ColorgetActiveBackgroundColor()java.awt.ColorgetActiveColor()java.awt.ColorgetColor()java.awt.ColorgetDisabledColor()java.awt.FontgetFont()intgetMargin()java.awt.ColorgetMarginColor()intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.intgetSectionSpacing()java.awt.ColorgetSeparatorColor()booleangetShowKeyboardShortcuts()voidinstall(Component component)Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.booleanisFocusable()By default, skins are focusable.voiditemInserted(Menu.Section section, int index)Called when a menu item has been inserted.voiditemsRemoved(Menu.Section section, int index, Sequence<Menu.Item> removed)Called when menu items have been removed.booleankeyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)booleankeyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)SPACE'presses' the active menu item if it does not have a sub-menu.booleankeyTyped(Component component, char character)Select the next enabled menu item where the first character of the rendered text matches the typed key (case insensitive).voidlayout()If the component on which the skin is installed is a container, lays out the container's children.voidnameChanged(Menu.Section section, java.lang.String previousName)Called when a section's name has changed.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidsectionInserted(Menu menu, int index)Called when a menu section has been inserted.voidsectionsRemoved(Menu menu, int index, Sequence<Menu.Section> removed)Called when menu sections have been removed.voidsetActiveBackgroundColor(java.awt.Color activeBackgroundColor)voidsetActiveBackgroundColor(java.lang.String activeBackgroundColor)voidsetActiveColor(java.awt.Color activeColor)voidsetActiveColor(java.lang.String activeColor)voidsetColor(java.awt.Color color)voidsetColor(java.lang.String color)voidsetDisabledColor(java.awt.Color disabledColor)voidsetDisabledColor(java.lang.String disabledColor)voidsetFont(java.awt.Font font)voidsetFont(java.lang.String font)voidsetFont(Dictionary<java.lang.String,?> font)voidsetMargin(int margin)voidsetMarginColor(java.awt.Color marginColor)voidsetSectionSpacing(int sectionSpacing)voidsetSeparatorColor(java.awt.Color separatorColor)voidsetShowKeyboardShortcuts(boolean showKeyboardShortcuts)- 
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkincomponentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
 - 
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkincolorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, fontFromObject, getBaseline, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisualsetSize
 
- 
 
- 
- 
- 
Method Detail- 
installpublic void install(Component component) Description copied from class:ComponentSkinMust be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
- installin interface- Skin
- Overrides:
- installin class- ContainerSkin
- Parameters:
- component- The component to which the skin is being attached.
 
 - 
isFocusablepublic boolean isFocusable() Description copied from class:ComponentSkinBy default, skins are focusable.- Specified by:
- isFocusablein interface- Skin
- Overrides:
- isFocusablein class- ContainerSkin
- Returns:
- false; by default, containers are not focusable.
 
 - 
getPreferredWidthpublic int getPreferredWidth(int height) Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
- getPreferredWidthin interface- ConstrainedVisual
- Overrides:
- getPreferredWidthin class- ContainerSkin
- Parameters:
- height- The height by which to constrain the preferred width, or- -1for no constraint.
- Returns:
- The preferred width given the height constraint.
 
 - 
getPreferredHeightpublic int getPreferredHeight(int width) Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
- getPreferredHeightin interface- ConstrainedVisual
- Overrides:
- getPreferredHeightin class- ContainerSkin
- Parameters:
- width- The width by which to constrain the preferred height, or- -1for no constraint.
- Returns:
- The preferred height given the width constraint.
 
 - 
getPreferredSizepublic Dimensions getPreferredSize() Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
- getPreferredSizein interface- ConstrainedVisual
- Overrides:
- getPreferredSizein class- ComponentSkin
- Returns:
- The preferred size (width and height) of this component.
 Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc. The default implementation simply calls ConstrainedVisual.getPreferredWidth(int)andConstrainedVisual.getPreferredHeight(int).
 
 - 
layoutpublic void layout() Description copied from interface:SkinIf the component on which the skin is installed is a container, lays out the container's children.
 - 
paintpublic void paint(java.awt.Graphics2D graphics) Description copied from interface:VisualPaints the visual.- Specified by:
- paintin interface- Visual
- Overrides:
- paintin class- ContainerSkin
- Parameters:
- graphics- The graphics context in which to paint the visual.
 
 - 
getFontpublic java.awt.Font getFont() 
 - 
setFontpublic void setFont(java.awt.Font font) 
 - 
setFontpublic final void setFont(java.lang.String font) 
 - 
setFontpublic final void setFont(Dictionary<java.lang.String,?> font) 
 - 
getColorpublic java.awt.Color getColor() 
 - 
setColorpublic void setColor(java.awt.Color color) 
 - 
setColorpublic final void setColor(java.lang.String color) 
 - 
getDisabledColorpublic java.awt.Color getDisabledColor() 
 - 
setDisabledColorpublic void setDisabledColor(java.awt.Color disabledColor) 
 - 
setDisabledColorpublic final void setDisabledColor(java.lang.String disabledColor) 
 - 
getActiveColorpublic java.awt.Color getActiveColor() 
 - 
setActiveColorpublic void setActiveColor(java.awt.Color activeColor) 
 - 
setActiveColorpublic final void setActiveColor(java.lang.String activeColor) 
 - 
getActiveBackgroundColorpublic java.awt.Color getActiveBackgroundColor() 
 - 
setActiveBackgroundColorpublic void setActiveBackgroundColor(java.awt.Color activeBackgroundColor) 
 - 
setActiveBackgroundColorpublic final void setActiveBackgroundColor(java.lang.String activeBackgroundColor) 
 - 
getMarginColorpublic java.awt.Color getMarginColor() 
 - 
setMarginColorpublic void setMarginColor(java.awt.Color marginColor) 
 - 
getMarginpublic int getMargin() 
 - 
setMarginpublic void setMargin(int margin) 
 - 
getSeparatorColorpublic java.awt.Color getSeparatorColor() 
 - 
setSeparatorColorpublic void setSeparatorColor(java.awt.Color separatorColor) 
 - 
getSectionSpacingpublic int getSectionSpacing() 
 - 
setSectionSpacingpublic void setSectionSpacing(int sectionSpacing) 
 - 
getShowKeyboardShortcutspublic boolean getShowKeyboardShortcuts() 
 - 
setShowKeyboardShortcutspublic void setShowKeyboardShortcuts(boolean showKeyboardShortcuts) 
 - 
keyPressedpublic boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) UPSelect the previous enabled menu item.
 DOWNSelect the next enabled menu item.
 LEFTClose the current sub-menu.
 RIGHTOpen the sub-menu of the current menu item.
 ENTER'presses' the active menu item if it does not have a sub-menu.- Specified by:
- keyPressedin interface- ComponentKeyListener
- Overrides:
- keyPressedin class- ComponentSkin
- Parameters:
- component- Component that has the focus.
- keyCode- The key code for the key that was pressed.
- keyLocation- Location value for the key (left or right for shift keys, etc.).
- Returns:
- trueto consume the event;- falseto allow it to propagate.
 
 - 
keyReleasedpublic boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation) SPACE'presses' the active menu item if it does not have a sub-menu.- Specified by:
- keyReleasedin interface- ComponentKeyListener
- Overrides:
- keyReleasedin class- ComponentSkin
- Parameters:
- component- Component that has the focus, that is receiving this key event.
- keyCode- Code for the key that was released.
- keyLocation- Location of the key.
- Returns:
- trueto consume the event;- falseto allow it to propagate.
 
 - 
keyTypedpublic boolean keyTyped(Component component, char character) Select the next enabled menu item where the first character of the rendered text matches the typed key (case insensitive).- Specified by:
- keyTypedin interface- ComponentKeyListener
- Overrides:
- keyTypedin class- ComponentSkin
- Parameters:
- component- Component that has the focus, that is receiving this key.
- character- The decoded character that was typed.
- Returns:
- trueto consume the event;- falseto allow it to propagate.
 
 - 
sectionInsertedpublic void sectionInserted(Menu menu, int index) Description copied from interface:MenuListenerCalled when a menu section has been inserted.- Specified by:
- sectionInsertedin interface- MenuListener
- Parameters:
- menu- The source of the event.
- index- Where the menu section was inserted.
 
 - 
sectionsRemovedpublic void sectionsRemoved(Menu menu, int index, Sequence<Menu.Section> removed) Description copied from interface:MenuListenerCalled when menu sections have been removed.- Specified by:
- sectionsRemovedin interface- MenuListener
- Parameters:
- menu- The menu that changed.
- index- The starting index of the removal.
- removed- The actual menu sections that were removed from the menu.
 
 - 
itemInsertedpublic void itemInserted(Menu.Section section, int index) Description copied from interface:Menu.SectionListenerCalled when a menu item has been inserted.- Specified by:
- itemInsertedin interface- Menu.SectionListener
- Parameters:
- section- The section that is changing.
- index- The index where the item was inserted.
 
 - 
itemsRemovedpublic void itemsRemoved(Menu.Section section, int index, Sequence<Menu.Item> removed) Description copied from interface:Menu.SectionListenerCalled when menu items have been removed.- Specified by:
- itemsRemovedin interface- Menu.SectionListener
- Parameters:
- section- The section that has changed.
- index- The starting index of the removed items.
- removed- The sequence of the items that were removed.
 
 - 
nameChangedpublic void nameChanged(Menu.Section section, java.lang.String previousName) Description copied from interface:Menu.SectionListenerCalled when a section's name has changed.- Specified by:
- nameChangedin interface- Menu.SectionListener
- Parameters:
- section- The section that changed.
- previousName- The previous name for this section.
 
 - 
activeItemChangedpublic void activeItemChanged(Menu menu, Menu.Item previousActiveItem) Description copied from interface:MenuListenerCalled when a menu's active item has changed.- Specified by:
- activeItemChangedin interface- MenuListener
- Parameters:
- menu- The menu that changed.
- previousActiveItem- What the previously active menu item was.
 
 
- 
 
-