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

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

public class BasicRibbonUI
extends RibbonUI

Basic UI for ribbon JRibbon.


Nested Class Summary
protected static class BasicRibbonUI.BandHostPanel
           
protected static class BasicRibbonUI.BandHostPopupPanel
           
protected  class BasicRibbonUI.RibbonLayout
          Layout for the ribbon.
protected  class BasicRibbonUI.TaskToggleButtonsHostPanel
           
 
Field Summary
protected  JRibbonApplicationMenuButton applicationMenuButton
           
protected  JScrollablePanel<BasicRibbonUI.BandHostPanel> bandScrollablePanel
           
protected  JCommandButton helpButton
           
static java.lang.String IS_USING_TITLE_PANE
          Client property marking the ribbon component to indicate whether the task bar and contextual task group headers should be shown on the title pane of the window.
protected  java.beans.PropertyChangeListener propertyChangeListener
          Property change listener.
protected  JRibbon ribbon
          The associated ribbon.
protected  javax.swing.event.ChangeListener ribbonChangeListener
          Change listener.
protected  java.awt.event.ComponentListener ribbonComponentListener
           
protected  java.awt.event.ContainerListener ribbonContainerListener
           
protected  javax.swing.JPanel taskBarPanel
          Taskbar panel.
protected  CommandToggleButtonGroup taskToggleButtonGroup
          Button group for task toggle buttons.
protected  java.util.Map<RibbonTask,JRibbonTaskToggleButton> taskToggleButtons
          Map of toggle buttons of all tasks.
protected  JScrollablePanel<BasicRibbonUI.TaskToggleButtonsHostPanel> taskToggleButtonsScrollablePanel
           
 
Constructor Summary
BasicRibbonUI()
          Creates a new basic ribbon UI delegate.
 
Method Summary
protected  BasicRibbonUI.BandHostPanel createBandHostPanel()
           
protected  java.awt.LayoutManager createBandHostPanelLayoutManager()
           
protected  java.awt.LayoutManager createLayoutManager()
          Invoked by installUI to create a layout manager object to manage the JRibbon.
protected  java.awt.LayoutManager createTaskbarLayoutManager()
          Invoked by installUI to create a layout manager object to manage the JRibbon taskbar.
protected  BasicRibbonUI.TaskToggleButtonsHostPanel createTaskToggleButtonsHostPanel()
           
protected  java.awt.LayoutManager createTaskToggleButtonsHostPanelLayoutManager()
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
protected  int getBandGap()
          Returns the layout gap for the bands in the associated ribbon.
 java.awt.Rectangle getContextualTaskGroupBounds(RibbonContextualTaskGroup group)
          Returns the bounds of the specified contextual task group.
protected  java.util.List<RibbonTask> getCurrentlyShownRibbonTasks()
          Returns the list of currently shown ribbon tasks.
protected  int getTabButtonGap()
          Returns the layout gap for the tab buttons in the associated ribbon.
 int getTaskbarHeight()
          Returns the height of the taskbar area.
 int getTaskToggleButtonHeight()
          Returns the height of the task toggle button area.
 java.util.Map<RibbonTask,JRibbonTaskToggleButton> getTaskToggleButtons()
           
 void handleMouseWheelEvent(java.awt.event.MouseWheelEvent e)
           
protected  void installComponents()
          Installs subcomponents on the associated ribbon.
protected  void installDefaults()
          Installs defaults on the associated ribbon.
protected  void installListeners()
          Installs listeners on the associated ribbon.
 void installUI(javax.swing.JComponent c)
           
 boolean isShowingScrollsForBands()
           
 boolean isShowingScrollsForTaskToggleButtons()
           
protected  boolean isUsingTitlePane()
           
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
protected  void paintBackground(java.awt.Graphics g)
          Paints the ribbon background.
protected  void paintMinimizedRibbonSeparator(java.awt.Graphics g)
           
protected  void paintTaskArea(java.awt.Graphics g, int x, int y, int width, int height)
          Paints the task border.
protected  void scrollAndRevealTaskToggleButton(JRibbonTaskToggleButton taskToggleButton)
           
protected  void syncApplicationMenuTips()
           
protected  void syncRibbonState()
           
protected  void uninstallComponents()
          Uninstalls subcomponents from the associated ribbon.
protected  void uninstallDefaults()
          Uninstalls defaults from the associated ribbon.
protected  void uninstallListeners()
          Uninstalls listeners from the associated ribbon.
 void uninstallUI(javax.swing.JComponent c)
           
 void update(java.awt.Graphics g, javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_USING_TITLE_PANE

public static final java.lang.String IS_USING_TITLE_PANE
Client property marking the ribbon component to indicate whether the task bar and contextual task group headers should be shown on the title pane of the window. This is only relevant for the JRibbonFrame.

See Also:
Constant Field Values

ribbon

protected JRibbon ribbon
The associated ribbon.


taskBarPanel

protected javax.swing.JPanel taskBarPanel
Taskbar panel.


bandScrollablePanel

protected JScrollablePanel<BasicRibbonUI.BandHostPanel> bandScrollablePanel

taskToggleButtonsScrollablePanel

protected JScrollablePanel<BasicRibbonUI.TaskToggleButtonsHostPanel> taskToggleButtonsScrollablePanel

applicationMenuButton

protected JRibbonApplicationMenuButton applicationMenuButton

helpButton

protected JCommandButton helpButton

taskToggleButtons

protected java.util.Map<RibbonTask,JRibbonTaskToggleButton> taskToggleButtons
Map of toggle buttons of all tasks.


taskToggleButtonGroup

protected CommandToggleButtonGroup taskToggleButtonGroup
Button group for task toggle buttons.


ribbonChangeListener

protected javax.swing.event.ChangeListener ribbonChangeListener
Change listener.


propertyChangeListener

protected java.beans.PropertyChangeListener propertyChangeListener
Property change listener.


ribbonContainerListener

protected java.awt.event.ContainerListener ribbonContainerListener

ribbonComponentListener

protected java.awt.event.ComponentListener ribbonComponentListener
Constructor Detail

BasicRibbonUI

public BasicRibbonUI()
Creates a new basic ribbon UI delegate.

Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

installUI

public void installUI(javax.swing.JComponent c)
Overrides:
installUI in class javax.swing.plaf.ComponentUI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Overrides:
uninstallUI in class javax.swing.plaf.ComponentUI

installListeners

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


uninstallListeners

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


installDefaults

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


uninstallDefaults

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


installComponents

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


createTaskToggleButtonsHostPanelLayoutManager

protected java.awt.LayoutManager createTaskToggleButtonsHostPanelLayoutManager()

createTaskToggleButtonsHostPanel

protected BasicRibbonUI.TaskToggleButtonsHostPanel createTaskToggleButtonsHostPanel()

createBandHostPanel

protected BasicRibbonUI.BandHostPanel createBandHostPanel()

createBandHostPanelLayoutManager

protected java.awt.LayoutManager createBandHostPanelLayoutManager()

uninstallComponents

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


update

public void update(java.awt.Graphics g,
                   javax.swing.JComponent c)
Overrides:
update in class javax.swing.plaf.ComponentUI

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Overrides:
paint in class javax.swing.plaf.ComponentUI

paintMinimizedRibbonSeparator

protected void paintMinimizedRibbonSeparator(java.awt.Graphics g)

paintBackground

protected void paintBackground(java.awt.Graphics g)
Paints the ribbon background.

Parameters:
g - Graphics context.

paintTaskArea

protected void paintTaskArea(java.awt.Graphics g,
                             int x,
                             int y,
                             int width,
                             int height)
Paints the task border.

Parameters:
g - Graphics context.
x - Left X of the tasks band bounds.
y - Top Y of the tasks band bounds.
width - Width of the tasks band bounds.
height - Height of the tasks band bounds.

getContextualTaskGroupBounds

public java.awt.Rectangle getContextualTaskGroupBounds(RibbonContextualTaskGroup group)
Description copied from class: RibbonUI
Returns the bounds of the specified contextual task group.

Specified by:
getContextualTaskGroupBounds in class RibbonUI
Parameters:
group - Contextual task group.
Returns:
The bounds of the specified contextual task group.

getBandGap

protected int getBandGap()
Returns the layout gap for the bands in the associated ribbon.

Returns:
The layout gap for the bands in the associated ribbon.

getTabButtonGap

protected int getTabButtonGap()
Returns the layout gap for the tab buttons in the associated ribbon.

Returns:
The layout gap for the tab buttons in the associated ribbon.

createLayoutManager

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

Returns:
a layout manager object

createTaskbarLayoutManager

protected java.awt.LayoutManager createTaskbarLayoutManager()
Invoked by installUI to create a layout manager object to manage the JRibbon taskbar.

Returns:
a layout manager object

getTaskbarHeight

public int getTaskbarHeight()
Returns the height of the taskbar area.

Returns:
The height of the taskbar area.

getTaskToggleButtonHeight

public int getTaskToggleButtonHeight()
Returns the height of the task toggle button area.

Returns:
The height of the task toggle button area.

syncRibbonState

protected void syncRibbonState()

getCurrentlyShownRibbonTasks

protected java.util.List<RibbonTask> getCurrentlyShownRibbonTasks()
Returns the list of currently shown ribbon tasks. This method is for internal use only.

Returns:
The list of currently shown ribbon tasks.

isUsingTitlePane

protected boolean isUsingTitlePane()

syncApplicationMenuTips

protected void syncApplicationMenuTips()

isShowingScrollsForTaskToggleButtons

public boolean isShowingScrollsForTaskToggleButtons()
Specified by:
isShowingScrollsForTaskToggleButtons in class RibbonUI

isShowingScrollsForBands

public boolean isShowingScrollsForBands()
Specified by:
isShowingScrollsForBands in class RibbonUI

getTaskToggleButtons

public java.util.Map<RibbonTask,JRibbonTaskToggleButton> getTaskToggleButtons()

handleMouseWheelEvent

public void handleMouseWheelEvent(java.awt.event.MouseWheelEvent e)
Specified by:
handleMouseWheelEvent in class RibbonUI

scrollAndRevealTaskToggleButton

protected void scrollAndRevealTaskToggleButton(JRibbonTaskToggleButton taskToggleButton)