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
|
private static int |
EXTRA_SPACE
extra horizontal space for every tab item
|
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 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
extra type for tab width
|
private int |
tabItemHeight
Tab height depends on font size
|
private int |
tabItemWidth
The width of every tab item.
|
private int |
toolTipIndex
Keeping track of tooltip text index for tab items that is currently in use.
|
private int |
xTextStart
Starting X position of the text in pixel units.
|
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.
|
private void |
computeTabSize()
Calculate Tabs size.
|
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 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)
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.
|
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 int |
layoutTabs(int selected)
Adjust Tabs position
|
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.
|
private int |
multiLine()
Rearrange Tabs in multiple lines.
|
void |
processKeyEvent(KeyInput event)
Process key event.
|
int |
rearrangeTabs()
Rearrange Tabs.
|
private void |
refreshTabItems()
Update position and size of the TABSET items.
|
void |
setValue(BaseDataType value)
Sets the BaseDataType instance representing the current value.
|
private int |
singleLine()
Layout Tabs in a single line.
|
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, 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, 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, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, 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, 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, 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, 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 EXTRA_SPACE
private static final int TAB_HEIGHT_EXTRA_SPACE
private static final int TAB_WIDTH_EXTRA_SPACE
private WidgetId id
private TabSetConfig config
private GuiDriver gd
private GuiFontResolver gf
protected GuiColorResolver gc
private java.util.ArrayList<TabSetGuiImpl.TabSetItem> items
private int tabItemWidth
private int tabItemHeight
private boolean selecting
private int toolTipIndex
private int xTextStart
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 DataContainer
public void setValue(BaseDataType value)
setValue
in interface DataContainer
value
- 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 DataContainer
public boolean isModified()
isModified
in interface DataContainer
true
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.MouseListener
mousePressed
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 mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public int getTextStart()
public int getTabsAreaHeight()
public int rearrangeTabs()
protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
private final void refreshTabItems()
private int multiLine()
private int layoutTabs(int selected)
selected
- Id of selected tab or -1 if no one selected.private int singleLine()
private void computeTabSize()
private double getTabHeight()
private double getTabWidth(java.lang.String text)
text
- Label text.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.