public class SliderGuiImpl extends Slider<GuiOutputManager>
Modifier and Type | Class and Description |
---|---|
static class |
SliderGuiImpl.TicMarks
Working tic-marks mode.
|
Modifier and Type | Field and Description |
---|---|
private CoordinatesConversion |
cc
Coordinate converter.
|
private boolean |
dragInProgress
Mouse drag indicator.
|
private static int |
FIXED_SIZE
The size is used to compute different positions for parts.
|
private GuiColorResolver |
gc
Color resolver.
|
private GuiDriver |
gd
Screen driver.
|
private GuiFontResolver |
gf
Font resolver
|
private boolean |
initCompleted
Flag indicating internals has been completed.
|
private NativeRectangle |
mouseArea
The rectangle where the mouse events must be handled.
|
private boolean |
mouseHover
Flag for mouse hovering the thumb.
|
private GuiOutputManager |
screen
Output manager.
|
private NativeDimension |
thumbDim
Mode dependent thumb dimension of the slider.
|
private int |
thumbX
Thumb X position of the slider.
|
private int |
thumbY
Thumb Y position of the slider.
|
private static int |
TM_BOTH_SIZE
The size of the internal slider area for both tic marks mode defined.
|
private static int |
TM_NONE_SIZE
The size of the internal slider area for none tic marks defined.
|
private static int |
TM_NOT_SET_SIZE
The size of the internal slider area for none tic marks defined.
|
private static int |
TM_SINGLE_SIZE
The size of the internal slider area for single side tic marks mode defined.
|
private SliderGuiImpl.TicMarks |
tmMode
Cached tic marks mode in format.
|
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
SliderGuiImpl(WidgetId id,
Container<GuiOutputManager> owner)
This constructor creates a slider.
|
SliderGuiImpl(WidgetId id,
SliderConfig cfg)
Special constructor used to restore component using given configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
draw()
Draw the slider.
|
private int |
getNewSliderValue(int x,
int y)
Check if the given X,Y coordinates fall into value changed area and calculate the new
suggested one.
|
SliderGuiImpl.TicMarks |
getTicmarkMode()
Obtain the tic marks' mode.
|
int |
indexToCoord(int start,
int length,
boolean horizontal,
int ndx)
Calculate X or Y coordinate for given slider index tha must be in range from slider
min value to slider max value.
|
void |
initialize(WidgetId id,
SliderConfig wcfg)
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.
|
private void |
initInternals()
Initialize internal variables.
|
boolean |
isDroppable()
Checks if the given widget is able to be the target of the drop operation.
|
boolean |
isMouseHover()
Test whether the mouse hovers the thumb.
|
private boolean |
isOverThumb(int x,
int y)
Check if the given X,Y coordinates fall into slider pointer rectangle.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseDragged(java.awt.event.MouseEvent e)
Notification of a mouse dragged event occurred for this widget.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Interprets the mouse enter events.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Interprets the mouse exit events.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Interprets the mouse hover events.
|
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)
Interprets the mouse wheel events.
|
private void |
repaintThumb()
Fires a repaint event only for the area of the thumb.
|
private void |
setupMouseEventsArea(int xbase,
int ybase,
int lbase,
boolean horiz)
Defines the area the mouse events should be handled.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
afterConfigUpdate, changeScreenValue, config, dimension, focusTraversable, getColon, getColumnLabelText, getColumnMnemonic, getLabelInstance, getLabelText, getMnemonic, getRange, getScreenValueAsInt, getScreenValueAsString, getText, getTo, getValue, height, isForceLabel, isModified, isNoLabels, isRightAligned, minimumSize, processKeyEvent, setColumnMnemonic, setLabelInstance, setMnemonic, setNoLabels, setValue, setWasVisible, wasVisible, width
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, insets, isCurrent, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseClicked, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, 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, sync, topLevelWindow, toString, translate, unrealize, updateSizeWorker, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, destroy, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, insets, isCurrent, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, topLevelWindow, unrealize, window
createMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonic
private static final int FIXED_SIZE
private static final int TM_NONE_SIZE
private static final int TM_NOT_SET_SIZE
private static final int TM_BOTH_SIZE
private static final int TM_SINGLE_SIZE
private SliderGuiImpl.TicMarks tmMode
private GuiDriver gd
private GuiOutputManager screen
private CoordinatesConversion cc
private GuiColorResolver gc
private GuiFontResolver gf
private NativeDimension thumbDim
private int thumbX
private int thumbY
private NativeRectangle mouseArea
private boolean dragInProgress
private boolean mouseHover
private boolean initCompleted
SliderGuiImpl(WidgetId id, Container<GuiOutputManager> owner)
id
- The widget's ID.owner
- The parent container, frame which will include this slider.public SliderGuiImpl(WidgetId id, SliderConfig cfg)
id
- The widget's ID.cfg
- Configuration data.public void initialize(WidgetId id, SliderConfig wcfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<SliderConfig>
initialize
in class Slider<GuiOutputManager>
id
- The widget's ID.wcfg
- The config used to initialize this widget.public boolean isMouseHover()
true
if mouse hovers the thumb.public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class Slider<GuiOutputManager>
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 mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
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 wheel event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse move event.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class AbstractWidget<GuiOutputManager>
e
- The mouse enter event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class AbstractWidget<GuiOutputManager>
e
- The mouse exit event.public boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<GuiOutputManager>
supportsCustomMousePointer
in class AbstractWidget<GuiOutputManager>
true
if the widget supports LOAD-MOUSE-POINTER() methodpublic boolean isDroppable()
true
if this widget can be droppable at this time, false
otherwise.public SliderGuiImpl.TicMarks getTicmarkMode()
public int indexToCoord(int start, int length, boolean horizontal, int ndx)
start
- The X or Y coordinate to use as the base.length
- The length in pixels of the slider ruler.horizontal
- The flag indicating if the orientation is horizontal or not.ndx
- The value for the slider internal position to transform to coord.protected int[] mouseActions()
mouseActions
in class AbstractWidget<GuiOutputManager>
private int getNewSliderValue(int x, int y)
x
- The X coordinate to check.y
- The Y coordinate to check.private void setupMouseEventsArea(int xbase, int ybase, int lbase, boolean horiz)
xbase
- The X coordinate of the main ruler.ybase
- The Y coordinate of the main ruler.lbase
- The length of the main ruler.horiz
- The flag indicating if the orientation is horizontal or not.private void repaintThumb()
private boolean isOverThumb(int x, int y)
x
- The X coordinate to check.y
- The Y coordinate to check.true
if X,Y is over pointer, false
otherwise.private void initInternals()