public class ScrollBarGuiImpl extends ScrollBar<GuiOutputManager>
ScrollBar.Bars, ScrollBar.Orientation, ScrollBar.Position, ScrollBar.ScrollStep
Modifier and Type | Field and Description |
---|---|
private boolean |
dragStarted
The flag indicating the drag operation has been started for scroll bar thumb.
|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
private double |
hOff
Height correction (bottom part)
|
private ScrollBarGuiButton |
lButt
Left button
|
(package private) boolean |
pressed
Mouse pressed indicator.
|
private ScrollBarGuiButton |
rButt
Right button
|
private ScrollbarExecutor |
scrollbarExecutor
Executor for handling mouse input.
|
private NativeDimension |
thumbDim
Thumb button size
|
private boolean |
thumbHover
Mouse hovers the thumb.
|
private int |
thumbOffset
The offset of mouse-press event relative to thumb x-location.
|
private NativePoint |
thumbPos
Thumb button position
|
private boolean |
thumbPressed
Mouse pressed indicator for thumb.
|
private Viewport<GuiOutputManager> |
viewport
The related viewport
|
private double |
wOff
Width correction (right part)
|
config, controller, customStep, longStep, max, orientation, position, scrollListeners, shortStep
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
ScrollBarGuiImpl(WidgetId id,
ScrollBar.Orientation orientation,
Viewport<GuiOutputManager> viewport)
Constructor.
|
ScrollBarGuiImpl(WidgetId id,
Viewport<GuiOutputManager> viewport)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
ScrollEvent |
createAutoScrollEvent(ScrollBar.Position btn)
Create GUI specific auto-scroll event if the changed position is valid, otherwise it returns
null indicating that it is not required to send scroll events due to the current scroller's
position reaches its bounds.
|
protected ScrollEvent |
createScrollEvent(int newPosition)
Create UI specific scroll event.
|
private ScrollBar.Position |
currentMouseOverArea(NativePoint mousePos)
Determines if the mouse pointer is over an area between the thumb and a scroll arrow.
|
void |
destroy()
Destroy this widget.
|
void |
doLayout()
Layout container.
|
void |
draw()
Widget drawing method.
|
(package private) int |
getButtonSize()
Get size of the button.
|
double |
getHeightCorrection()
Get height correction (bottom part)
|
Widget<GuiOutputManager> |
getOwningWidget()
Gets the widget, that owns this scrollbar.
|
NativeDimension |
getThumbDim()
Get thumb size for the scroll bar.
|
(package private) int |
getThumbOffset()
Get thumb offset (mouse click point relative to thumb position).
|
(package private) int |
getTravelSize()
Get size of the travel area available for thumb scrolling.
|
double |
getWidthCorrection()
Get width correction (right part).
|
double |
height()
Get widget height.
|
private void |
init()
Scroll bar initialization.
|
private boolean |
isOverThumbButton(java.awt.event.MouseEvent event)
Check if mouse is over thumb button.
|
boolean |
isRMBEntrySupported()
Check if this widget gains ENTRY event when right/middle mouse button is clicked.
|
boolean |
maySwitchFocus()
Some widgets (like scroll bars) react on user input (like mouse click), but don't steal focus from
currently focused widget.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
// TODO: this triggers repaint on each mouse move over it...
|
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 |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Notification of a mouse wheel moved event occurred for this widget.
|
void |
onButtonClick(ScrollBar.Position button,
ScrollBar.ScrollStep scrollStep,
MouseEvt e)
Notification on scroll bar button click.
|
int |
position(java.awt.event.MouseEvent e)
Determine the equivalent scroll bar position which correspond to actual mouse position.
|
int |
position(NativePoint mousePos)
Determine the equivalent scroll bar position which correspond to actual mouse position.
|
boolean |
raiseLegacyMouseEvents()
Check if the widget implementation can raise legacy, 4GL-style, mouse events.
|
private static boolean |
rectContains(int x,
int y,
int width,
int height,
NativePoint mousePos)
Determines if the rectangle specified by its coordinates contains the mouse pointer.
|
private void |
refresh()
Invoke repaint for this widget.
|
void |
repaint()
Request widget repainting.
|
int |
resolvePopupMenuId()
Returns the popup menu effective for this widget.
|
(package private) ScrollBar.Position |
scrollDirection(java.awt.event.MouseEvent e) |
void |
setHeightCorrection(double newValue)
Set height correction (bottom part)
|
void |
setWidthCorrection(double wOff)
Set width correction (right part).
|
private void |
showPopup(java.awt.event.MouseEvent e)
Shows the scroll bar popup menu.
|
double |
width()
Get widget width.
|
addScrollListener, adjustControlledScrollbar, afterConfigUpdate, clear, clearScrollListeners, config, getBaseStep, getMax, getPosition, handleScrollEvent, initialize, isControlled, notifyScrollListeners, onDrag, orientation, positionUpdated, range, setController, setMax, setPosition, setStep
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, currentFocus, cycleFocus, defaultFocus, deregisterSelectedWidget, detach, dimension, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, focusTraversable, focusWorker, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, processKeyEvent, reflectAncestorChange, reflectLocationChange, registerSelectedWidget, remove, removeContainerStateListener, 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, getId, 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, 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, refresh, registerWidgetStateListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, 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, getId, 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, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, refreshWidget, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unregisterWidgetStateListener, validateDisplayValue, window
private ScrollbarExecutor scrollbarExecutor
private GuiDriver gd
private GuiColorResolver gc
private Viewport<GuiOutputManager> viewport
private ScrollBarGuiButton lButt
private ScrollBarGuiButton rButt
private NativePoint thumbPos
private NativeDimension thumbDim
private double wOff
private double hOff
volatile boolean pressed
private boolean thumbPressed
true
then the mouse clicked the thumb and
probably is dragging it.private boolean thumbHover
true
then the mouse if located over the thumb. Some
Theme
s draw the thumb different in this case.private boolean dragStarted
private int thumbOffset
public ScrollBarGuiImpl(WidgetId id, Viewport<GuiOutputManager> viewport)
id
- The widget's ID.viewport
- The related viewport.ScrollBarGuiImpl(WidgetId id, ScrollBar.Orientation orientation, Viewport<GuiOutputManager> viewport)
id
- The widget's ID.orientation
- Scroll bar orientation.viewport
- The related viewport.public double width()
width
in interface Widget<GuiOutputManager>
width
in class AbstractContainer<GuiOutputManager>
public double height()
height
in interface Widget<GuiOutputManager>
height
in class AbstractContainer<GuiOutputManager>
public void doLayout()
doLayout
in interface Container<GuiOutputManager>
doLayout
in class AbstractContainer<GuiOutputManager>
public void repaint()
repaint
in interface Widget<GuiOutputManager>
repaint
in class AbstractContainer<GuiOutputManager>
public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class ScrollBar<GuiOutputManager>
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 mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
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)
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
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 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
mouseWheelMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public boolean raiseLegacyMouseEvents()
raiseLegacyMouseEvents
in interface Widget<GuiOutputManager>
raiseLegacyMouseEvents
in class AbstractWidget<GuiOutputManager>
false
.public void destroy()
destroy
in interface Widget<GuiOutputManager>
destroy
in class AbstractContainer<GuiOutputManager>
public boolean isRMBEntrySupported()
isRMBEntrySupported
in interface Widget<GuiOutputManager>
isRMBEntrySupported
in class AbstractWidget<GuiOutputManager>
true
if this widget gains ENTRY event
when right/middle mouse button is clicked.public Widget<GuiOutputManager> getOwningWidget()
public ScrollEvent createAutoScrollEvent(ScrollBar.Position btn)
btn
- The source button that caused the event.public void onButtonClick(ScrollBar.Position button, ScrollBar.ScrollStep scrollStep, MouseEvt e)
onButtonClick
in class ScrollBar<GuiOutputManager>
button
- Clicked button.scrollStep
- The indicator of the desired scroll step. How far
we scroll depends on the location of the mouse-click.
For example, scroll bar buttons generate a short scroll
versus the location between the scroll button and scroll
thumb generates a long scroll.e
- The mouse event. null
means KeyEventpublic NativeDimension getThumbDim()
public boolean maySwitchFocus()
Scroll bar is sensitive to user input, but never switches focus.
true
if the widget may steal focus from currently focused widget,
false
otherwise.protected ScrollEvent createScrollEvent(int newPosition)
createScrollEvent
in class ScrollBar<GuiOutputManager>
newPosition
- New scroll position.private void init()
private boolean isOverThumbButton(java.awt.event.MouseEvent event)
event
- Mouse event.true
if mouse under the thumb button false
otherwise.private ScrollBar.Position currentMouseOverArea(NativePoint mousePos)
mousePos
- The mouse position to inspect.ScrollBar.Position.LEFT
if the mouse
pointer is over an area between the thumb and the left scroll arrow.ScrollBar.Position.RIGHT
if the mouse
pointer is over an area between the thumb and the right scroll arrow.null
otherwise.private static boolean rectContains(int x, int y, int width, int height, NativePoint mousePos)
x
- X coordinate of the top-left corner of the rectangley
- Y coordinate of the top-left corner of the rectanglewidth
- Rectangle width.height
- Rectangle heigth.mousePos
- Position of the mouse pointer.true
if the rectangle contains the mouse pointer.public int position(java.awt.event.MouseEvent e)
e
- Mouse event.public int position(NativePoint mousePos)
mousePos
- The point where mouse is clicked.public int resolvePopupMenuId()
resolvePopupMenuId
in interface Widget<GuiOutputManager>
resolvePopupMenuId
in class AbstractWidget<GuiOutputManager>
protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
int getTravelSize()
int getButtonSize()
int getThumbOffset()
ScrollBar.Position scrollDirection(java.awt.event.MouseEvent e)
e
- Mouse event.private void refresh()
private void showPopup(java.awt.event.MouseEvent e)
e
- The mouse event caused the menu to be shown.public double getWidthCorrection()
public void setWidthCorrection(double wOff)
wOff
- the new width correction valuepublic double getHeightCorrection()
public void setHeightCorrection(double newValue)
newValue
- the new height correction value