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 int |
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 int |
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_IMAGE_MARGIN
The standard left and right margins for the image of item
|
private static int |
ITEM_LEFT_MARGIN
The standard margin between item border and its content
|
private static int |
ITEM_PADDING
The standard up and bottom padding of an item
|
private GuiColorResolver |
itemsColorResolver
Items color resolver for button list header
|
private BaseConfig |
itemsConfig
Items config
|
private GuiFontResolver |
itemsFontResolver
Items font resolver
|
private static CentralLogger |
LOG
The button-list widget logger
|
private static int |
ROWS_NUMBER
The default number of visible rows used for items view
|
private GuiOutputManager |
screen
Output manager
|
borderlisteners, 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.
|
private boolean |
updateItemsColors(ButtonListGroupConfig[] listOfGroupConfigs)
Updates the bgColorRgb and fgColorRgb of each item in each group.
|
void |
updateSize()
Update widget's size.
|
double |
width()
Returns the width of this widget.
|
draw, drawPanel, getId, is3DBorder, isRMBEntrySupported, set3DBorder, setColorResolver, setCustomDraw, setId, setOptionalDrawborder, insets, isTransparent, setBorder, setTransparentadd, 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, reflectLocationChanged, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setPhysicalDimensionInt, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, 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, hasTooltip, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, 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, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, triggerLocationChanged, unregisterWidgetListener, updateSystemParent, widgetRealized, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitwidgetsAsListacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, completeTrigger, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, 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, registerWidgetListener, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, show, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetListener, validateDisplayValue, windowprivate static final CentralLogger LOG
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_IMAGE_MARGIN
private static final int ITEM_PADDING
private static final int ITEM_LEFT_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 int bgItemColor
private int fgItemColor
private boolean init
private double availableSpaceInChars
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 boolean updateItemsColors(ButtonListGroupConfig[] listOfGroupConfigs)
listOfGroupConfigs - The updated list of groups configuration.true if every item configuration bgColorRgb and fgColorRgb was updated.private 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 FocusListenerevent - The focus eventpublic void onFocusLost(FocusEvent event)
onFocusLost in interface FocusListenerevent - 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.MouseMotionListenermouseDragged in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenermouseClicked in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenermouseMoved in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseEntered(java.awt.event.MouseEvent e)
AbstractWidgetmouseEntered in interface java.awt.event.MouseListenermouseEntered in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
AbstractWidgetmouseExited in interface java.awt.event.MouseListenermouseExited in class AbstractWidget<GuiOutputManager>e - The mouse event.