Class BasicCommandButtonPanelUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.PanelUI
-
- org.pushingpixels.radiance.component.internal.ui.common.CommandButtonPanelUI
-
- org.pushingpixels.radiance.component.internal.ui.common.BasicCommandButtonPanelUI
-
- Direct Known Subclasses:
RadianceCommandButtonPanelUI
public abstract class BasicCommandButtonPanelUI extends CommandButtonPanelUI
Basic UI for command button panelJCommandButtonPanel
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
BasicCommandButtonPanelUI.ColumnFillLayout
Column-fill layout for the button panel.private static class
BasicCommandButtonPanelUI.CommandButtonPanelLayout
private static class
BasicCommandButtonPanelUI.FocusMoveDirection
protected class
BasicCommandButtonPanelUI.RowFillLayout
Row-fill layout for the button panel.
-
Field Summary
Fields Modifier and Type Field Description private CommandToggleGroupModel
buttonGroup
The button group for the single selection mode.protected JCommandButtonPanel
buttonPanel
The associated command button panel.private java.util.List<java.util.List<JCommandButton>>
buttons
List of all button groups.private javax.swing.event.ChangeListener
contentModelChangeListener
protected javax.swing.JLabel[]
groupLabels
Labels of the button panel groups.private java.awt.Rectangle[]
groupRects
Bounds of button panel groups.private java.util.List<java.lang.String>
groupTitles
List of titles for all button groups.private BasicCommandButtonPanelUI.CommandButtonPanelLayout
layoutManager
private javax.swing.event.ChangeListener
presentationModelChangeListener
static java.lang.String
SKIP_BACKGROUND_FILL
Client property to mark the command button panel to not draw the background fill
-
Constructor Summary
Constructors Constructor Description BasicCommandButtonPanelUI()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private void
addButtonToGroup(java.lang.String buttonGroupName, int indexInGroup, Command command, JCommandButton commandButton)
private void
addButtonToLastGroup(Command command, JCommandButton commandButton)
private CommandButtonPresentationModel
createBaseCommandPresentation()
private JCommandButton
findFirstFocusableDown(int row, int column)
private JCommandButton
findFirstFocusableRight(int row, int column)
private JCommandButton
findLastFocusableLeft(int row, int column)
private JCommandButton
findLastFocusableUp(int row, int column)
boolean
focusDown()
boolean
focusFirst()
boolean
focusLast()
boolean
focusLeft()
private boolean
focusMove(BasicCommandButtonPanelUI.FocusMoveDirection focusMoveDirection)
boolean
focusRight()
boolean
focusUp()
protected abstract int
getGroupTitleHeight(int groupIndex)
Returns the height of the group title strip.int
getPreferredHeight(int buttonVisibleRows, int titleVisibleRows)
Returns the preferred size of the associated button panel for the specified parameters.boolean
hasFocus()
protected void
installComponents()
Installs sub-components on the associated button panel.protected void
installDefaults()
Installs defaults on the associated button panel.protected void
installListeners()
Installs listeners on the associated button panel.void
installUI(javax.swing.JComponent c)
void
paint(java.awt.Graphics g, javax.swing.JComponent c)
protected abstract void
paintGroupBackground(java.awt.Graphics g, int groupIndex, int x, int y, int width, int height)
Paints the background of the specified button panel group.protected abstract void
paintGroupTitleBackground(java.awt.Graphics g, int groupIndex, int x, int y, int width, int height)
Paints the background of the title of specified button panel group.void
scrollToSelectedCommand()
private void
syncContent()
protected void
uninstallComponents()
Uninstalls sub-components from the associated button panel.protected void
uninstallDefaults()
Uninstalls defaults from the associated button panel.protected void
uninstallListeners()
Uninstalls listeners from the associated button panel.void
uninstallUI(javax.swing.JComponent c)
private void
updateLayoutManager()
Updates the layout manager for the associated button panel.
-
-
-
Field Detail
-
SKIP_BACKGROUND_FILL
public static final java.lang.String SKIP_BACKGROUND_FILL
Client property to mark the command button panel to not draw the background fill- See Also:
- Constant Field Values
-
buttonPanel
protected JCommandButtonPanel buttonPanel
The associated command button panel.
-
groupTitles
private java.util.List<java.lang.String> groupTitles
List of titles for all button groups.
-
buttons
private java.util.List<java.util.List<JCommandButton>> buttons
List of all button groups.
-
groupLabels
protected javax.swing.JLabel[] groupLabels
Labels of the button panel groups.
-
buttonGroup
private CommandToggleGroupModel buttonGroup
The button group for the single selection mode.
-
groupRects
private java.awt.Rectangle[] groupRects
Bounds of button panel groups.
-
contentModelChangeListener
private javax.swing.event.ChangeListener contentModelChangeListener
-
presentationModelChangeListener
private javax.swing.event.ChangeListener presentationModelChangeListener
-
layoutManager
private BasicCommandButtonPanelUI.CommandButtonPanelLayout layoutManager
-
-
Method Detail
-
installUI
public void installUI(javax.swing.JComponent c)
- Overrides:
installUI
in classjavax.swing.plaf.ComponentUI
-
installDefaults
protected void installDefaults()
Installs defaults on the associated button panel.
-
installComponents
protected void installComponents()
Installs sub-components on the associated button panel.
-
installListeners
protected void installListeners()
Installs listeners on the associated button panel.
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUI
in classjavax.swing.plaf.ComponentUI
-
uninstallDefaults
protected void uninstallDefaults()
Uninstalls defaults from the associated button panel.
-
uninstallComponents
protected void uninstallComponents()
Uninstalls sub-components from the associated button panel.
-
uninstallListeners
protected void uninstallListeners()
Uninstalls listeners from the associated button panel.
-
updateLayoutManager
private void updateLayoutManager()
Updates the layout manager for the associated button panel.
-
paint
public void paint(java.awt.Graphics g, javax.swing.JComponent c)
- Overrides:
paint
in classjavax.swing.plaf.ComponentUI
-
paintGroupBackground
protected abstract void paintGroupBackground(java.awt.Graphics g, int groupIndex, int x, int y, int width, int height)
Paints the background of the specified button panel group.- Parameters:
g
- Graphics context.groupIndex
- Group index.x
- X coordinate of the button group bounds.y
- Y coordinate of the button group bounds.width
- Width of the button group bounds.height
- Height of the button group bounds.
-
paintGroupTitleBackground
protected abstract void paintGroupTitleBackground(java.awt.Graphics g, int groupIndex, int x, int y, int width, int height)
Paints the background of the title of specified button panel group.- Parameters:
g
- Graphics context.groupIndex
- Group index.x
- X coordinate of the button group title bounds.y
- Y coordinate of the button group title bounds.width
- Width of the button group title bounds.height
- Height of the button group title bounds.
-
getGroupTitleHeight
protected abstract int getGroupTitleHeight(int groupIndex)
Returns the height of the group title strip.- Parameters:
groupIndex
- Group index.- Returns:
- The height of the title strip of the specified group.
-
createBaseCommandPresentation
private CommandButtonPresentationModel createBaseCommandPresentation()
-
syncContent
private void syncContent()
-
addButtonToLastGroup
private void addButtonToLastGroup(Command command, JCommandButton commandButton)
-
addButtonToGroup
private void addButtonToGroup(java.lang.String buttonGroupName, int indexInGroup, Command command, JCommandButton commandButton)
-
scrollToSelectedCommand
public void scrollToSelectedCommand()
- Specified by:
scrollToSelectedCommand
in classCommandButtonPanelUI
-
getPreferredHeight
public int getPreferredHeight(int buttonVisibleRows, int titleVisibleRows)
Returns the preferred size of the associated button panel for the specified parameters.- Parameters:
buttonVisibleRows
- Target number of visible button rows.titleVisibleRows
- Target number of visible group title rows.- Returns:
- The preferred size of the associated button panel for the specified parameters.
-
findFirstFocusableRight
private JCommandButton findFirstFocusableRight(int row, int column)
-
findLastFocusableLeft
private JCommandButton findLastFocusableLeft(int row, int column)
-
findLastFocusableUp
private JCommandButton findLastFocusableUp(int row, int column)
-
findFirstFocusableDown
private JCommandButton findFirstFocusableDown(int row, int column)
-
focusFirst
public boolean focusFirst()
- Specified by:
focusFirst
in classCommandButtonPanelUI
-
focusLast
public boolean focusLast()
- Specified by:
focusLast
in classCommandButtonPanelUI
-
hasFocus
public boolean hasFocus()
- Specified by:
hasFocus
in classCommandButtonPanelUI
-
focusMove
private boolean focusMove(BasicCommandButtonPanelUI.FocusMoveDirection focusMoveDirection)
-
focusUp
public boolean focusUp()
- Specified by:
focusUp
in classCommandButtonPanelUI
-
focusDown
public boolean focusDown()
- Specified by:
focusDown
in classCommandButtonPanelUI
-
focusRight
public boolean focusRight()
- Specified by:
focusRight
in classCommandButtonPanelUI
-
focusLeft
public boolean focusLeft()
- Specified by:
focusLeft
in classCommandButtonPanelUI
-
-