org.jvnet.flamingo.ribbon.ui
Class JRibbonGallery

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.jvnet.flamingo.ribbon.ui.JRibbonGallery
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JRibbonGallery
extends javax.swing.JComponent

In-ribbon gallery. This class is for internal use only and should not be directly used by the applications.

Author:
Kirill Grouchnikov
See Also:
JRibbonBand.addRibbonGallery(String, List, Map, int, int, RibbonElementPriority), Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static CommandButtonDisplayState BIG_FIXED_LANDSCAPE
          Big size with landscape orientation.
static java.lang.String uiClassID
          The UI class ID string.
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JRibbonGallery()
          Creates new in-ribbon gallery.
 
Method Summary
 void addRibbonGalleryButtons(java.lang.String buttonGroupName, JCommandToggleButton... buttons)
          Adds toggle command buttons to the specified button group in this ribbon gallery.
 JCommandToggleButton getButtonAt(int index)
          Returns the gallery button at specified index.
 int getButtonCount()
          Returns the number of gallery buttons in this in-ribbon gallery.
 java.util.List<JCommandToggleButton> getButtonGroup(java.lang.String buttonGroupName)
          Returns the list of buttons in the specifed button group.
 int getButtonGroupCount()
          Returns the number of button groups in this in-ribbon gallery.
 RibbonElementPriority getDisplayPriority()
          Returns the current display priority for this in-ribbon gallery.
 java.lang.String getExpandKeyTip()
           
 JCommandButtonPanel getPopupButtonPanel()
          Returns the associated popup gallery.
 JRibbonBand.RibbonGalleryPopupCallback getPopupCallback()
           
 int getPreferredPopupMaxButtonColumns()
           
 int getPreferredPopupMaxVisibleButtonRows()
           
 int getPreferredWidth(RibbonElementPriority state, int availableHeight)
          Returns the preferred width of this in-ribbon gallery for the specified display state.
 JCommandToggleButton getSelectedButton()
          Returns the currently selected gallery button.
 RibbonGalleryUI getUI()
          Returns the UI object which implements the L&F for this component.
 java.lang.String getUIClassID()
          Returns the name of the UI class that implements the L&F for this component.
 boolean isShowingPopupPanel()
          Returns indication whether the popup panel is showing.
 void removeRibbonGalleryButtons(JCommandToggleButton... buttons)
          Removes the specified toggle command buttons from this ribbon gallery.
 void setDisplayPriority(RibbonElementPriority displayPriority)
          Sets new display priority for this in-ribbon gallery.
 void setExpandKeyTip(java.lang.String expandKeyTip)
           
 void setGroupMapping(java.util.List<StringValuePair<java.util.List<JCommandToggleButton>>> buttons)
          Sets the button groups for this ribbon gallery.
 void setPopupCallback(JRibbonBand.RibbonGalleryPopupCallback popupCallback)
           
 void setPreferredPopupPanelDimension(int preferredPopupMaxButtonColumns, int preferredPopupMaxVisibleButtonRows)
          Sets the preferred dimension of the popup panel.
 void setPreferredVisibleButtonCount(RibbonElementPriority state, int visibleButtonCount)
          Set preferred width of this in-ribbon gallery for the specified display state.
 void setSelectedButton(JCommandToggleButton selectedButton)
          Sets new value for the currently selected gallery button.
 void setShowingPopupPanel(boolean isShowingPopupPanel)
          Sets indication whether the popup panel is showing.
 void setUI(RibbonGalleryUI ui)
          Sets the new UI delegate.
 void updateUI()
          Resets the UI property to a value from the current look and feel.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uiClassID

public static final java.lang.String uiClassID
The UI class ID string.

See Also:
Constant Field Values

BIG_FIXED_LANDSCAPE

public static final CommandButtonDisplayState BIG_FIXED_LANDSCAPE
Big size with landscape orientation. Used for buttons in in-ribbon galleries.

Constructor Detail

JRibbonGallery

public JRibbonGallery()
Creates new in-ribbon gallery.

Method Detail

setUI

public void setUI(RibbonGalleryUI ui)
Sets the new UI delegate.

Parameters:
ui - New UI delegate.

updateUI

public void updateUI()
Resets the UI property to a value from the current look and feel.

Overrides:
updateUI in class javax.swing.JComponent
See Also:
JComponent.updateUI()

getUI

public RibbonGalleryUI getUI()
Returns the UI object which implements the L&F for this component.

Returns:
a RibbonGalleryUI object
See Also:
setUI(org.jvnet.flamingo.ribbon.ui.RibbonGalleryUI)

getUIClassID

public java.lang.String getUIClassID()
Returns the name of the UI class that implements the L&F for this component.

Overrides:
getUIClassID in class javax.swing.JComponent
Returns:
the string "RibbonGalleryUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

setPreferredVisibleButtonCount

public void setPreferredVisibleButtonCount(RibbonElementPriority state,
                                           int visibleButtonCount)
Set preferred width of this in-ribbon gallery for the specified display state.

Parameters:
state - Display state.
visibleButtonCount - Preferred width for the specified state.

getPreferredWidth

public int getPreferredWidth(RibbonElementPriority state,
                             int availableHeight)
Returns the preferred width of this in-ribbon gallery for the specified display state.

Parameters:
state - Display state.
availableHeight - Available height in pixels.
Returns:
The preferred width of this in-ribbon gallery for the specified display state.

setDisplayPriority

public void setDisplayPriority(RibbonElementPriority displayPriority)
Sets new display priority for this in-ribbon gallery.

Parameters:
displayPriority - New display priority for this in-ribbon gallery.

getDisplayPriority

public RibbonElementPriority getDisplayPriority()
Returns the current display priority for this in-ribbon gallery.

Returns:
The current display priority for this in-ribbon gallery.

getButtonGroupCount

public int getButtonGroupCount()
Returns the number of button groups in this in-ribbon gallery.

Returns:
The number of button groups in this in-ribbon gallery.

getButtonGroup

public java.util.List<JCommandToggleButton> getButtonGroup(java.lang.String buttonGroupName)
Returns the list of buttons in the specifed button group.

Parameters:
buttonGroupName - Button group name.
Returns:
The list of buttons in the specifed button group.

getButtonCount

public int getButtonCount()
Returns the number of gallery buttons in this in-ribbon gallery.

Returns:
The number of gallery buttons in this in-ribbon gallery.

getButtonAt

public JCommandToggleButton getButtonAt(int index)
Returns the gallery button at specified index.

Parameters:
index - Gallery button index.
Returns:
Gallery button at specified index.

getSelectedButton

public JCommandToggleButton getSelectedButton()
Returns the currently selected gallery button.

Returns:
The currently selected gallery button.

setSelectedButton

public void setSelectedButton(JCommandToggleButton selectedButton)
Sets new value for the currently selected gallery button.

Parameters:
selectedButton - New value for the currently selected gallery button.

getPopupButtonPanel

public JCommandButtonPanel getPopupButtonPanel()
Returns the associated popup gallery.

Returns:
The associated popup gallery.

setShowingPopupPanel

public void setShowingPopupPanel(boolean isShowingPopupPanel)
Sets indication whether the popup panel is showing.

Parameters:
isShowingPopupPanel - Indication whether the popup panel is showing.

isShowingPopupPanel

public boolean isShowingPopupPanel()
Returns indication whether the popup panel is showing.

Returns:
true if the popup panel is showing, false otherwise.

setGroupMapping

public void setGroupMapping(java.util.List<StringValuePair<java.util.List<JCommandToggleButton>>> buttons)
Sets the button groups for this ribbon gallery.

Parameters:
buttons - Button groups.

addRibbonGalleryButtons

public void addRibbonGalleryButtons(java.lang.String buttonGroupName,
                                    JCommandToggleButton... buttons)
Adds toggle command buttons to the specified button group in this ribbon gallery.

Parameters:
buttonGroupName - Button group name.
buttons - Toggle command buttons to add to the specified button group.

removeRibbonGalleryButtons

public void removeRibbonGalleryButtons(JCommandToggleButton... buttons)
Removes the specified toggle command buttons from this ribbon gallery.

Parameters:
buttons - Toggle command buttons to remove from this gallery.

setPreferredPopupPanelDimension

public void setPreferredPopupPanelDimension(int preferredPopupMaxButtonColumns,
                                            int preferredPopupMaxVisibleButtonRows)
Sets the preferred dimension of the popup panel.

Parameters:
preferredPopupMaxButtonColumns - Preferred maximum number of button columns for the popup panel.
preferredPopupMaxVisibleButtonRows - Preferred maximum number of visible button rows for the popup panel.

setPopupCallback

public void setPopupCallback(JRibbonBand.RibbonGalleryPopupCallback popupCallback)

getPopupCallback

public JRibbonBand.RibbonGalleryPopupCallback getPopupCallback()

getPreferredPopupMaxButtonColumns

public int getPreferredPopupMaxButtonColumns()

getPreferredPopupMaxVisibleButtonRows

public int getPreferredPopupMaxVisibleButtonRows()

setExpandKeyTip

public void setExpandKeyTip(java.lang.String expandKeyTip)

getExpandKeyTip

public java.lang.String getExpandKeyTip()