public class TabSetGuiImpl extends AbstractContainer<GuiOutputManager> implements WidgetWithConfig<TabSetConfig>, DataContainer
| Modifier and Type | Class and Description |
|---|---|
class |
TabSetGuiImpl.TabSetItem
Class describing functionality of each single item in TABSET widget.
|
| Modifier and Type | Field and Description |
|---|---|
private TabSetConfig |
config
Associated config instance
|
protected GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
private WidgetId |
id
Widget id
|
private java.util.ArrayList<TabSetGuiImpl.TabSetItem> |
items
The set of the ordered 1-based horizontal tab items.
|
private int |
lines
Keeping track of number of lines.
|
private static int |
MIN_TEXT_WIDTH
minimum text size used for tab width
|
private boolean |
selecting
Selection in progress flag.
|
private static int |
TAB_HEIGHT_EXTRA_SPACE
extra space for tab height
|
private static int |
TAB_WIDTH_EXTRA_SPACE_PAGE
extra space for tab width - tab page
|
private static int |
TAB_WIDTH_EXTRA_SPACE_TAB
extra space for tab width - tab bar
|
private int |
toolTipIndex
Keeping track of tooltip text index for tab items that is currently in use.
|
listeners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
TabSetGuiImpl(WidgetId id,
TabSetConfig cfg)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterConfigUpdate(TabSetConfig beforeUpdate)
The method is called after the configuration associated with the
owner changes.
|
TabSetConfig |
config()
Get externalizable widget config which can be used to restore widget
state after via network.
|
Widget<GuiOutputManager> |
currentFocus()
Get widget which is in focus.
|
Widget<GuiOutputManager> |
defaultFocus()
Get default focusable widget.
|
void |
draw()
Draw the widget.
|
private TabSetGuiImpl.TabSetItem |
findTab(int tabIdx)
Find Tab by index.
|
WidgetId |
getId()
Widget ID.
|
private java.util.List<TabSetConfig.TabItem> |
getLineItems(int startingIndex,
int itemsAmount,
java.util.List<TabSetConfig.TabItem> configItems,
FontDetails<?> font,
double tsTotalWidth)
Find how many tabs fit in a line.
|
private double |
getTabHeight()
Get Tab height.
|
int |
getTabsAreaHeight()
Calculate Tabs area height according to the number of lines.
|
private int |
getTabSetItemIndex(java.awt.event.MouseEvent mEvt)
Locates the TABSET item index for the given mouse event coordinates inside TABSET.
|
private double |
getTabWidth(java.lang.String text,
FontDetails<?> font)
Get Tab width.
|
java.lang.String |
getText()
Get text representation of the selected value.
|
int |
getTextStart()
Gets the starting point from left edge of the item to draw the text.
|
private java.lang.String |
getTooltip(int tabIdx)
Get Tab tooltip string.
|
private double |
getTotalWidthItems(java.util.List<TabSetConfig.TabItem> configItems,
FontDetails<?> font)
Calculate total width of tabs.
|
BaseDataType |
getValue()
Returns the BaseDataType instance representing the current value.
|
boolean |
hasFocusable(Widget<GuiOutputManager> exclude)
Reports if there is at least 1 focusable widget that is not the given
widget.
|
private boolean |
ignoreMouseEvent(java.awt.event.MouseEvent e)
Checks if we need to ignore this mouse event.
|
private boolean |
ignoreMouseMoveEvent(java.awt.event.MouseEvent e)
Checks if we need to ignore this mouse move class event.
|
void |
initialize(WidgetId id,
TabSetConfig cfg)
Replacement API for the logic which should exist in the widget's c'tor, but the logic
can't be executed as it depends on the widget being registered into the official registry.
|
boolean |
isModified()
Getting the modification state of the widget.
|
private boolean |
isTabBar()
Check if the widget behaves like a tab bar (single page).
|
private void |
layoutTabs()
Adjust Tabs position, only for multi-line if a tab from a different line was selected
|
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 |
mouseExited(java.awt.event.MouseEvent e)
Notification of a mouse moved 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 |
processKeyEvent(KeyInput event)
Process key event.
|
private void |
refreshTabItems()
Update position and size of the TABSET items.
|
void |
setValue(BaseDataType value)
Sets the BaseDataType instance representing the current value.
|
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, deregisterSelectedWidget, destroy, detach, dimension, doLayout, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusTraversable, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, height, insets, lastFocus, minimumSize, 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, width_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, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseDragged, mouseEntered, mouseReleased, 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, waitgetChangedValuewidgetsAsListacceptsEscAsAnyKey, 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, isRMBEntrySupported, 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 int TAB_HEIGHT_EXTRA_SPACE
private static final int TAB_WIDTH_EXTRA_SPACE_PAGE
private static final int TAB_WIDTH_EXTRA_SPACE_TAB
private static final int MIN_TEXT_WIDTH
private WidgetId id
private TabSetConfig config
private GuiDriver gd
private GuiFontResolver gf
protected GuiColorResolver gc
private java.util.ArrayList<TabSetGuiImpl.TabSetItem> items
private boolean selecting
private int toolTipIndex
private int lines
public TabSetGuiImpl(WidgetId id, TabSetConfig cfg)
id - Widget id.cfg - Config instance.public void initialize(WidgetId id, TabSetConfig cfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<TabSetConfig>id - The widget's ID.cfg - Config instance.public WidgetId getId()
getId in interface Widget<GuiOutputManager>getId in class AbstractWidget<GuiOutputManager>public TabSetConfig config()
Note that only very limited set of widgets actually have config. By default widget has no config.
config in interface Widget<GuiOutputManager>config in interface ConfigOwner<TabSetConfig>config in class AbstractWidget<GuiOutputManager>public void afterConfigUpdate(TabSetConfig beforeUpdate)
The implemented logic must be idempotent - the method must produce the same results if executed once or multiple times not relying on any particular call sequence or related state. This is necessary so that the method can be repeated or retried as often as necessary without causing unintended effects
afterConfigUpdate in interface ConfigOwner<TabSetConfig>beforeUpdate - Config reference capturing the config state before the owner's config was modified.public void draw()
draw in interface Widget<GuiOutputManager>draw in class AbstractContainer<GuiOutputManager>public BaseDataType getValue()
getValue in interface DataContainerpublic void setValue(BaseDataType value)
setValue in interface DataContainervalue - The value representing the current widget value.public java.lang.String getText()
FillIn, for example) or label (for the
RadioButton, for example).getText in interface DataContainerpublic boolean isModified()
isModified in interface DataContainertrue if the widget value was modified, false otherwise.public void processKeyEvent(KeyInput event)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class AbstractContainer<GuiOutputManager>event - Key event to process.public Widget<GuiOutputManager> defaultFocus()
defaultFocus in interface Container<GuiOutputManager>defaultFocus in class AbstractContainer<GuiOutputManager>public Widget<GuiOutputManager> currentFocus()
currentFocus in interface Container<GuiOutputManager>currentFocus in class AbstractContainer<GuiOutputManager>public boolean hasFocusable(Widget<GuiOutputManager> exclude)
hasFocusable in interface Container<GuiOutputManager>hasFocusable in class AbstractContainer<GuiOutputManager>exclude - A widget to ignore or null if any focusable widget will do.true if there is at least one other widget that can be focused.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 mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenermouseClicked 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 mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenermouseExited in class AbstractWidget<GuiOutputManager>e - The mouse event.public int getTextStart()
public int getTabsAreaHeight()
protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>private final void refreshTabItems()
private java.util.List<TabSetConfig.TabItem> getLineItems(int startingIndex, int itemsAmount, java.util.List<TabSetConfig.TabItem> configItems, FontDetails<?> font, double tsTotalWidth)
startingIndex - Index where we start in list.itemsAmount - Number of tabs in the list.configItems - List of items.font - Font of the text in tabs.tsTotalWidth - Width of the line.private double getTotalWidthItems(java.util.List<TabSetConfig.TabItem> configItems, FontDetails<?> font)
configItems - List of items.font - Font of the text in tabs.private void layoutTabs()
private double getTabHeight()
private double getTabWidth(java.lang.String text,
FontDetails<?> font)
text - Label text.font - private boolean ignoreMouseEvent(java.awt.event.MouseEvent e)
e - The mouse event.TRUE if event should be ignored, FALSE otherwise.private boolean ignoreMouseMoveEvent(java.awt.event.MouseEvent e)
e - The mouse event.TRUE if event should be ignored, FALSE otherwise.private int getTabSetItemIndex(java.awt.event.MouseEvent mEvt)
mEvt - The mouse event to be checked.0
if none.private java.lang.String getTooltip(int tabIdx)
tabIdx - Tab index.private TabSetGuiImpl.TabSetItem findTab(int tabIdx)
tabIdx - Tab index.null if not found.private boolean isTabBar()