public class ButtonListGuiImpl extends BorderedPanelGuiImpl implements WidgetWithConfig<ButtonListConfig>, FocusListener
Modifier and Type | Class and Description |
---|---|
class |
ButtonListGuiImpl.GroupButton
Represents the button with items
|
class |
ButtonListGuiImpl.Item
Defines the item panel with its icon and its label.
|
class |
ButtonListGuiImpl.Items
Represents a scrollable items list.
|
class |
ButtonListGuiImpl.ItemsControl
Defines the items control.
|
Modifier and Type | Field and Description |
---|---|
private double |
availableSpaceInChars
The available vertical space to extend the number of visible items
|
private ColorRgb |
bgItemColor
The background color used by Item
|
private static int |
BUTTON_MARGIN
The standard margins around a given button
|
private static int |
BUTTON_SIZE
The standard button's size
|
private static int |
BUTTON_WIDTH
The group button's width
|
private GuiFontResolver |
buttonFontResolver
Button font resolver
|
private CoordinatesConversion |
cc
Coordinate converter
|
private ButtonListConfig |
config
Holds its settings
|
private ColorRgb |
fgItemColor
The foreround color used by Item
|
private GuiDriver |
gd
Screen driver
|
private GuiColorResolver |
groupColorResolver
Group button color resolver
|
private static int |
ICON_SIZE
The standard image icon size
|
private boolean |
init
This flag has been set once, required for this widget initialization
|
private static int |
ITEM_MARGIN
The standard margins around an item label
|
private GuiColorResolver |
itemsColorResolver
Items color resolver for button list header
|
private BaseConfig |
itemsConfig
Items config
|
private GuiFontResolver |
itemsFontResolver
Items font resolver
|
private static int |
ROWS_NUMBER
The default number of visible rows used for items view
|
private GuiOutputManager |
screen
Output manager
|
private int |
selectedItemIndex
The curently selected item index
|
private static int |
VERTICAL_ROW_MARGIN
The standard margin between rows
|
border
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
ButtonListGuiImpl(WidgetId id,
ButtonListConfig cfg)
Creates the button list widget.
|
Modifier and Type | Method and Description |
---|---|
void |
afterConfigUpdate(ButtonListConfig beforeUpdate)
Notifies this widget that its settings are changed.
|
void |
colapseAllItems()
Hides all items.
|
ButtonListConfig |
config()
Returns the widget's configuration.
|
ButtonGuiImpl |
createButton(WidgetId wid,
java.lang.String name,
int width,
int height,
java.util.function.Consumer<ButtonGuiImpl> imageSetter)
Defines a factory method to create a button.
|
Widget<GuiOutputManager> |
currentFocus()
Returns this widget itself.
|
Widget<GuiOutputManager> |
defaultFocus()
Returns this widget itself.
|
Dimension |
dimension()
Calculates the size of this widget in character units.
|
void |
fireValueChanged()
Fire a new value changed event.
|
void |
firstFocus()
Sets the current focus to this widget itself.
|
boolean |
focusTraversable()
Returns true.
|
boolean |
hasFocusable(Widget<GuiOutputManager> exclude)
Tests if there is a focusable widget in this container except the given widget.
|
double |
height()
Returns the height of this widget.
|
void |
initialize(WidgetId id,
ButtonListConfig cfg)
Initializes the button list widget.
|
Dimension |
minimumSize()
Returns the minimum size of this widget.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Notification of a mouse dragged event occurred for this widget.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Notification of a mouse entered event occurred for this widget.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Notification of a mouse exited event occurred for this widget.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Notification of a mouse moved event occurred for this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Notification of a mouse released event occurred for this widget.
|
void |
onFocusGained(FocusEvent event)
Handles the focus gained event.
|
void |
onFocusLost(FocusEvent event)
Handles the focus lost event.
|
void |
processKeyEvent(KeyInput keyEvent)
Process key events that have been generated by this component.
|
private void |
updateFont()
Updates the current font.
|
private void |
updateGroups()
Updates the current list of buttons.
|
void |
updateSize()
Update widget's size.
|
double |
width()
Returns the width of this widget.
|
draw, drawPanel, getId, is3DBorder, isRMBEntrySupported, set3DBorder, setColorResolver, setCustomDraw, setId, setOptionalDraw
border, insets, isTransparent, setBorder, setTransparent
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, deregisterSelectedWidget, destroy, detach, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, focus, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, lastFocus, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChange, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setTabItemList, setWidth, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unregisterWidgetStateListener, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
widgetsAsList
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isDirectManipulable, isDirectManipulationActive, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isRealized, isRepaintDisabled, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetStateListener, validateDisplayValue, window
private static final int BUTTON_SIZE
private static final int BUTTON_WIDTH
private static final int ICON_SIZE
private static final int BUTTON_MARGIN
private static final int ITEM_MARGIN
private static final int VERTICAL_ROW_MARGIN
private static final int ROWS_NUMBER
private ButtonListConfig config
private GuiDriver gd
private GuiOutputManager screen
private CoordinatesConversion cc
private GuiColorResolver groupColorResolver
private GuiColorResolver itemsColorResolver
private GuiFontResolver buttonFontResolver
private GuiFontResolver itemsFontResolver
private BaseConfig itemsConfig
private ColorRgb bgItemColor
private ColorRgb fgItemColor
private boolean init
private double availableSpaceInChars
private int selectedItemIndex
public ButtonListGuiImpl(WidgetId id, ButtonListConfig cfg)
id
- The given widget's id.cfg
- The widget's configurationpublic ButtonGuiImpl createButton(WidgetId wid, java.lang.String name, int width, int height, java.util.function.Consumer<ButtonGuiImpl> imageSetter)
wid
- The widget idname
- The given namewidth
- The given widget's widthheight
- The given widget's heightimageSetter
- Sets the target images for a new created button.public Dimension dimension()
dimension
in interface Widget<GuiOutputManager>
dimension
in class AbstractContainer<GuiOutputManager>
public double height()
height
in interface Widget<GuiOutputManager>
height
in class AbstractContainer<GuiOutputManager>
public Dimension minimumSize()
minimumSize
in interface Widget<GuiOutputManager>
minimumSize
in class AbstractContainer<GuiOutputManager>
public double width()
width
in interface Widget<GuiOutputManager>
width
in class AbstractContainer<GuiOutputManager>
public ButtonListConfig config()
config
in interface Widget<GuiOutputManager>
config
in interface ConfigOwner<ButtonListConfig>
config
in class AbstractWidget<GuiOutputManager>
public void colapseAllItems()
public void afterConfigUpdate(ButtonListConfig beforeUpdate)
afterConfigUpdate
in interface ConfigOwner<ButtonListConfig>
beforeUpdate
- The old configurationprivate void updateFont()
private void updateGroups()
public void initialize(WidgetId id, ButtonListConfig cfg)
initialize
in interface WidgetWithConfig<ButtonListConfig>
id
- This widget idcfg
- This widget configurationpublic void onFocusGained(FocusEvent event)
onFocusGained
in interface FocusListener
event
- The focus eventpublic void onFocusLost(FocusEvent event)
onFocusLost
in interface FocusListener
event
- The focus eventpublic void firstFocus()
firstFocus
in interface Container<GuiOutputManager>
firstFocus
in class AbstractContainer<GuiOutputManager>
public boolean focusTraversable()
focusTraversable
in interface Widget<GuiOutputManager>
focusTraversable
in class AbstractContainer<GuiOutputManager>
public Widget<GuiOutputManager> currentFocus()
currentFocus
in interface Container<GuiOutputManager>
currentFocus
in class AbstractContainer<GuiOutputManager>
public Widget<GuiOutputManager> defaultFocus()
defaultFocus
in interface Container<GuiOutputManager>
defaultFocus
in class AbstractContainer<GuiOutputManager>
public boolean hasFocusable(Widget<GuiOutputManager> exclude)
hasFocusable
in interface Container<GuiOutputManager>
hasFocusable
in class AbstractContainer<GuiOutputManager>
exclude
- The given widgetpublic void fireValueChanged()
public void updateSize()
public void processKeyEvent(KeyInput keyEvent)
processKeyEvent
in interface Widget<GuiOutputManager>
processKeyEvent
in class AbstractContainer<GuiOutputManager>
keyEvent
- The key event to be handled.protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseEntered(java.awt.event.MouseEvent e)
AbstractWidget
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
AbstractWidget
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.