org.pushingpixels.flamingo.internal.ui.ribbon
Class BasicRibbonGalleryUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by org.pushingpixels.flamingo.internal.ui.ribbon.RibbonGalleryUI
          extended by org.pushingpixels.flamingo.internal.ui.ribbon.BasicRibbonGalleryUI

public class BasicRibbonGalleryUI
extends RibbonGalleryUI

Basic UI for ribbon gallery JRibbonGallery.


Nested Class Summary
protected static class BasicRibbonGalleryUI.ExpandCommandButton
           
protected static class BasicRibbonGalleryUI.JButtonStripUIResource
          Button strip as a UI resource.
 
Field Summary
protected  JCommandButtonStrip buttonStrip
          Contains the scroll down, scroll up and show popup buttons.
protected  BasicRibbonGalleryUI.ExpandCommandButton expandActionButton
          The button that shows the associated popup gallery.
protected  ActionListener expandListener
          Listener on the gallery expand button.
protected  int firstVisibleButtonIndex
          The index of the first visible button.
protected  Insets margin
          Ribbon gallery margin.
protected  PopupPanelManager.PopupListener popupListener
          Listener on the PopupPanelManager changes to sync the JRibbonGallery.setShowingPopupPanel(boolean) once the popup gallery is dismissed by the user.
protected  PropertyChangeListener propertyChangeListener
          Property change listener.
protected  JRibbonGallery ribbonGallery
          The associated ribbon gallery.
protected  JCommandButton scrollDownButton
          The button that scrolls down the associated ribbonGallery.
protected  ActionListener scrollDownListener
          Listener on the gallery scroll-down button.
protected  JCommandButton scrollUpButton
          The button that scrolls up the associated ribbonGallery.
protected  ActionListener scrollUpListener
          Listener on the gallery scroll-up button.
protected  int visibleButtonRowNumber
           
protected  int visibleButtonsInEachRow
          The count of visible buttons.
 
Constructor Summary
BasicRibbonGalleryUI()
           
 
Method Summary
protected  BasicRibbonGalleryUI.ExpandCommandButton createExpandButton()
          Creates the expand button.
protected  LayoutManager createLayoutManager()
          Invoked by installUI to create a layout manager object to manage the JCommandButtonStrip.
protected  JCommandButton createScrollDownButton()
          Creates the scroll-down button.
protected  JCommandButton createScrollUpButton()
          Creates the scroll-up button.
static ComponentUI createUI(JComponent c)
           
protected  int getLayoutGap()
          Returns the layout gap for the controls in the associated ribbon gallery.
 int getPreferredWidth(int buttonCount, int availableHeight)
          Returns the preferred width of the ribbon gallery for the specified parameters.
protected  void installComponents()
          Installs subcomponents on the associated ribbon gallery.
protected  void installDefaults()
          Installs defaults on the associated ribbon gallery.
protected  void installListeners()
          Installs listeners on the associated ribbon gallery.
 void installUI(JComponent c)
           
 void paint(Graphics g, JComponent c)
           
protected  void paintRibbonGalleryBorder(Graphics graphics)
          Paints ribbon gallery border.
protected  void scrollOneRowDown()
          Scrolls the contents of this ribbon gallery one row down.
protected  void scrollOneRowUp()
          Scrolls the contents of this ribbon gallery one row up.
protected  void scrollToSelected()
          Scrolls the contents of this ribbon gallery to reveal the currently selected button.
protected  void syncExpandKeyTip()
           
protected  void uninstallComponents()
          Uninstalls subcomponents from the associated ribbon gallery.
protected  void uninstallDefaults()
          Uninstalls defaults from the associated ribbon gallery.
protected  void uninstallListeners()
          Uninstalls listeners from the associated ribbon gallery.
 void uninstallUI(JComponent c)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ribbonGallery

protected JRibbonGallery ribbonGallery
The associated ribbon gallery.


firstVisibleButtonIndex

protected int firstVisibleButtonIndex
The index of the first visible button.


visibleButtonsInEachRow

protected int visibleButtonsInEachRow
The count of visible buttons.


visibleButtonRowNumber

protected int visibleButtonRowNumber

scrollDownButton

protected JCommandButton scrollDownButton
The button that scrolls down the associated ribbonGallery.


scrollUpButton

protected JCommandButton scrollUpButton
The button that scrolls up the associated ribbonGallery.


expandActionButton

protected BasicRibbonGalleryUI.ExpandCommandButton expandActionButton
The button that shows the associated popup gallery.


buttonStrip

protected JCommandButtonStrip buttonStrip
Contains the scroll down, scroll up and show popup buttons.

See Also:
scrollDownButton, scrollUpButton, expandActionButton

scrollDownListener

protected ActionListener scrollDownListener
Listener on the gallery scroll-down button.


scrollUpListener

protected ActionListener scrollUpListener
Listener on the gallery scroll-up button.


expandListener

protected ActionListener expandListener
Listener on the gallery expand button.


popupListener

protected PopupPanelManager.PopupListener popupListener
Listener on the PopupPanelManager changes to sync the JRibbonGallery.setShowingPopupPanel(boolean) once the popup gallery is dismissed by the user.


propertyChangeListener

protected PropertyChangeListener propertyChangeListener
Property change listener.


margin

protected Insets margin
Ribbon gallery margin.

Constructor Detail

BasicRibbonGalleryUI

public BasicRibbonGalleryUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent c)

installUI

public void installUI(JComponent c)
Overrides:
installUI in class ComponentUI

installComponents

protected void installComponents()
Installs subcomponents on the associated ribbon gallery.


createScrollDownButton

protected JCommandButton createScrollDownButton()
Creates the scroll-down button.

Returns:
Scroll-down button.

createScrollUpButton

protected JCommandButton createScrollUpButton()
Creates the scroll-up button.

Returns:
Scroll-up button.

createExpandButton

protected BasicRibbonGalleryUI.ExpandCommandButton createExpandButton()
Creates the expand button.

Returns:
Expand button.

uninstallComponents

protected void uninstallComponents()
Uninstalls subcomponents from the associated ribbon gallery.


installDefaults

protected void installDefaults()
Installs defaults on the associated ribbon gallery.


uninstallDefaults

protected void uninstallDefaults()
Uninstalls defaults from the associated ribbon gallery.


installListeners

protected void installListeners()
Installs listeners on the associated ribbon gallery.


uninstallListeners

protected void uninstallListeners()
Uninstalls listeners from the associated ribbon gallery.


uninstallUI

public void uninstallUI(JComponent c)
Overrides:
uninstallUI in class ComponentUI

createLayoutManager

protected LayoutManager createLayoutManager()
Invoked by installUI to create a layout manager object to manage the JCommandButtonStrip.

Returns:
a layout manager object

paint

public void paint(Graphics g,
                  JComponent c)
Overrides:
paint in class ComponentUI

paintRibbonGalleryBorder

protected void paintRibbonGalleryBorder(Graphics graphics)
Paints ribbon gallery border.

Parameters:
graphics - Graphics context.
toFill - Rectangle for the background.

getLayoutGap

protected int getLayoutGap()
Returns the layout gap for the controls in the associated ribbon gallery.

Returns:
The layout gap for the controls in the associated ribbon gallery.

getPreferredWidth

public int getPreferredWidth(int buttonCount,
                             int availableHeight)
Returns the preferred width of the ribbon gallery for the specified parameters.

Parameters:
buttonCount - Button count.
availableHeight - Available height in pixels.
Returns:
The preferred width of the ribbon gallery for the specified parameters.

scrollOneRowDown

protected void scrollOneRowDown()
Scrolls the contents of this ribbon gallery one row down.


scrollOneRowUp

protected void scrollOneRowUp()
Scrolls the contents of this ribbon gallery one row up.


scrollToSelected

protected void scrollToSelected()
Scrolls the contents of this ribbon gallery to reveal the currently selected button.


syncExpandKeyTip

protected void syncExpandKeyTip()