public class ScrollBarGuiImpl extends ScrollBar<GuiOutputManager> implements ScrollListener
ScrollBar.Bars, ScrollBar.Orientation, ScrollBar.Position, ScrollBar.ScrollStep
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private GuiColorResolver |
gc
Color resolver
|
private GuiDriver |
gd
Screen driver
|
(package private) double |
hOff
Height correction (bottom part)
|
private ScrollBarGuiButton |
lButt
Left button
|
private java.util.concurrent.ExecutorService |
mouseInputExecutor
Executor for handling mouse input.
|
(package private) boolean |
pressed
Mouse pressed indicator.
|
private ScrollBarGuiButton |
rButt
Right button
|
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
|
(package private) double |
wOff
Width correction (right part)
|
config, controller, 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.
|
void |
destroy()
Destroy this widget.
|
void |
doLayout()
Layout container.
|
void |
draw()
Widget drawing method.
|
(package private) int |
getButtonSize()
Get size of the button.
|
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 |
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.
|
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 void |
refresh()
Invoke repaint for this widget.
|
void |
repaint()
Request widget repainting.
|
(package private) ScrollBar.Position |
scrollDirection(java.awt.event.MouseEvent e) |
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, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, currentFocus, cycleFocus, defaultFocus, detach, dimension, endSizeChange, findMouseSource, firstFocus, focus, focusTraversable, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, hasFocusable, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, processKeyEvent, remove, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setWidth, startSizeChange, unrealize, updateSizeWorker, widgets
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isTabStop, isThreeD, isTotallyObscured, isVisible, location, manageSystemActions, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
handleScrollEvent
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isTabStop, isThreeD, isTotallyObscured, isVisible, location, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, repaint, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, topLevelWindow, window
private java.util.concurrent.ExecutorService mouseInputExecutor
private GuiDriver gd
private GuiColorResolver gc
private Viewport<GuiOutputManager> viewport
private ScrollBarGuiButton lButt
private ScrollBarGuiButton rButt
private NativePoint thumbPos
private NativeDimension thumbDim
double wOff
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 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()
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.public int position(java.awt.event.MouseEvent e)
e
- Mouse event.public int position(NativePoint mousePos)
mousePos
- The point where mouse is clicked.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.