public abstract class ScrollBar<O extends OutputManager<?>> extends AbstractContainer<O> implements WidgetWithConfig<BaseConfig>, ScrollPublisher, ScrollListener
Modifier and Type | Class and Description |
---|---|
static class |
ScrollBar.Bars
Container bars.
|
static class |
ScrollBar.Orientation
Scroll bar orientation enumeration.
|
static class |
ScrollBar.Position
Scroll bar buttons position.
|
static class |
ScrollBar.ScrollStep
Type of scroll step.
|
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
protected BaseConfig |
config
Widget configuration
|
protected ScrollBarController |
controller
Custom scroll bar controller.
|
protected int |
longStep
Long scroll step; this is used when the space between scroll buttons
and scroll thumb is clicked or for mouse wheel.
|
protected int |
max
Scroll maximum value
|
protected ScrollBar.Orientation |
orientation
Scroll bar orientation
|
protected int |
position
Current position
|
protected java.util.ArrayList<ScrollListener> |
scrollListeners
Storage for listeners.
|
protected int |
shortStep
Short scroll step; this is used when scroll buttons are clicked.
|
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
ScrollBar(WidgetId id)
Default constructor.
|
ScrollBar(WidgetId id,
ScrollBar.Orientation orientation)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addScrollListener(ScrollListener listener)
Add scroll listener.
|
void |
adjustControlledScrollbar()
Adjust the following values:
visibility
enable state
position
max
step
according to the values returned by controller assigned to this scroll bar.
|
void |
afterConfigUpdate(BaseConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
void |
clear()
Initialize scroll bar parameters.
|
void |
clearScrollListeners()
Clear the set of scroll listeners.
|
BaseConfig |
config()
Get the widget config.
|
protected ScrollEvent |
createScrollEvent(int newPosition)
Create UI specific scroll event.
|
abstract void |
draw()
Widget drawing method.
|
int |
getBaseStep()
Get the base step of this scroll-bar.
|
int |
getMax()
Return maximum value.
|
int |
getPosition()
Get current position.
|
void |
handleScrollEvent(ScrollEvent event)
This method is invoked when scroll pane is scrolled.
|
void |
initialize(WidgetId id,
BaseConfig 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 |
isControlled()
Returns
true if this scrollbar has custom controller assigned. |
void |
notifyScrollListeners(int newPosition)
Notify scroll listeners about event.
|
void |
onButtonClick(ScrollBar.Position button,
ScrollBar.ScrollStep scrollStep,
MouseEvt e)
Notification on scroll bar button click.
|
void |
onDrag(int pos)
Notification on scroll bar drag
|
ScrollBar.Orientation |
orientation()
Get scroll bar orientation.
|
void |
positionUpdated(int position,
ScrollBar.ScrollStep scrollStep,
boolean drag)
Notify controller that position has been updated.
|
double |
range()
Return scroll bar range.
|
void |
setController(ScrollBarController controller)
Set custom scroll bar controller.
|
void |
setMax(int max)
Set maximum value.
|
void |
setPosition(int position)
Set current position.
|
void |
setStep(int step)
Set the step for this scroll-bar.
|
add, add, add, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, currentFocus, cycleFocus, defaultFocus, destroy, detach, dimension, doLayout, endSizeChange, findMouseSource, firstFocus, focus, focusTraversable, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, processKeyEvent, remove, repaint, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setWidth, startSizeChange, unrealize, updateSizeWorker, widgets, width
_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, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, manageSystemActions, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, 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
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, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, topLevelWindow, window
protected ScrollBar.Orientation orientation
protected int max
protected int position
protected int shortStep
protected int longStep
protected java.util.ArrayList<ScrollListener> scrollListeners
protected BaseConfig config
protected ScrollBarController controller
public ScrollBar(WidgetId id)
public ScrollBar(WidgetId id, ScrollBar.Orientation orientation)
orientation
- Scroll bar orientation.public void initialize(WidgetId id, BaseConfig cfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<BaseConfig>
id
- The widget's ID.cfg
- The config used to initialize this widget.public void clear()
public double range()
public void addScrollListener(ScrollListener listener)
addScrollListener
in interface ScrollPublisher
listener
- Listener to add.public void clearScrollListeners()
public BaseConfig config()
config
in interface Widget<O extends OutputManager<?>>
config
in interface ConfigOwner<BaseConfig>
config
in class AbstractWidget<O extends OutputManager<?>>
public void afterConfigUpdate(BaseConfig beforeUpdate)
afterConfigUpdate
in interface ConfigOwner<BaseConfig>
beforeUpdate
- public int getMax()
public void setMax(int max)
max
- New maximum value.public int getPosition()
public void setPosition(int position)
position
- New position.public ScrollBar.Orientation orientation()
public void handleScrollEvent(ScrollEvent event)
handleScrollEvent
in interface ScrollListener
event
- Event which triggered this call.public void onButtonClick(ScrollBar.Position button, ScrollBar.ScrollStep scrollStep, MouseEvt e)
button
- Clicked button.scrollStep
- Scroll step type.e
- The mouse event. null
means KeyEventpublic void onDrag(int pos)
pos
- Drag scroll position.public abstract void draw()
draw
in interface Widget<O extends OutputManager<?>>
draw
in class AbstractContainer<O extends OutputManager<?>>
public void setStep(int step)
step
- The step.public int getBaseStep()
public void setController(ScrollBarController controller)
controller
- Custom scroll bar controller.public boolean isControlled()
true
if this scrollbar has custom controller assigned.public void positionUpdated(int position, ScrollBar.ScrollStep scrollStep, boolean drag)
position
- New position of the scroll bar.scrollStep
- drag
- true
if position was changed because of thumb dragging.
false
if position was changed because a scroll button was pressed.public void adjustControlledScrollbar()
public void notifyScrollListeners(int newPosition)
newPosition
- New scroll bar position.protected ScrollEvent createScrollEvent(int newPosition)
newPosition
- New scroll position.