public class SliderGuiImpl extends Slider<GuiOutputManager>
Modifier and Type | Class and Description |
---|---|
private static class |
SliderGuiImpl.TicMarks
Working tic-marks mode.
|
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private CoordinatesConversion |
cc
Coordinate converter.
|
private ColorRgb |
darkShadow
Dark shadow box color.
|
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 ImageWrapper<?> |
img
The image object for poiner draw.
|
private boolean |
initCompleted
Flag indicating internals has been completed.
|
private ColorRgb |
lightShadow
Light shadow box color.
|
private NativeRectangle |
mouseArea
The rectangle where the mouse events must be handled.
|
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 ticmarks mode defined.
|
private static int |
TM_NONE_SIZE
The size of the internal slider area for none ticmarks defined.
|
private static int |
TM_SINGLE_SIZE
The size of the internal slider area for single side ticmarks mode defined.
|
private SliderGuiImpl.TicMarks |
tmMode
Cached tic marks mode in format.
|
private ColorRgb |
veryDarkShadow
Dark shadow box color.
|
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 void |
drawBase(NativePoint orig,
NativeDimension dim,
boolean horiz)
Draws the slider trackbar and pointer.
|
private void |
drawCurrentValue(NativePoint orig,
NativeDimension dim,
boolean horiz)
Draws the current widget screen value.
|
private void |
drawFrame(NativePoint orig,
NativeDimension dim,
boolean horiz)
Draws the dotted frame border.
|
private void |
drawThumb(int xst,
int yst,
int length,
boolean horiz)
Draws the slider thumb.
|
private void |
drawTicMarks(int xst,
int yst,
int length)
Draws the slider tic marks.
|
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.
|
Widget.ZOrderClass |
getZOrderClass()
Get the Z-Order class
|
private int |
indexToCoord(int start,
int length,
boolean horizontal,
int ndx)
Calculate X or Y coordinate for given slider index tha must be in ramge 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.
|
private void |
initThumbImage(SliderGuiImpl.TicMarks ticMarksMode,
boolean horiz)
Loads scalable graphic image to draw the slider thumb shape.
|
private boolean |
isOverThumb(int x,
int y,
boolean horiz)
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 |
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.
|
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, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, hasFocus, hidden, hide, highlighted, ignoreAction, insets, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, manageSystemActions, mouseClicked, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, 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, hasFocus, hidden, hide, highlighted, insets, 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, repaint, requestFocus, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, topLevelWindow, unrealize, window
mouseClicked, mouseEntered, mouseExited
createMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, isMnemonicSupported, updateMnemonic
private static final int FIXED_SIZE
private static final int TM_NONE_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 ColorRgb lightShadow
private ColorRgb darkShadow
private ColorRgb veryDarkShadow
private NativeDimension thumbDim
private int thumbX
private int thumbY
private NativeRectangle mouseArea
private boolean dragInProgress
private boolean initCompleted
private ImageWrapper<?> img
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 void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class Slider<GuiOutputManager>
public Widget.ZOrderClass getZOrderClass()
getZOrderClass
in interface Widget<GuiOutputManager>
getZOrderClass
in class AbstractWidget<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 boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<GuiOutputManager>
supportsCustomMousePointer
in class AbstractWidget<GuiOutputManager>
true
if the widget supports
LOAD-MOUSE-POINTER() methodprotected 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 boolean isOverThumb(int x, int y, boolean horiz)
x
- The X coordinate to check.y
- The Y coordinate to check.horiz
- The flag indicating if the orientation is horizontal or not.TRUE
if X,Y is over pointer, FALSE
otherwise.private void drawBase(NativePoint orig, NativeDimension dim, boolean horiz)
orig
- The widget's starting point.dim
- The widget's size point.horiz
- The flag indicating if the orientation is horizontal or not.private void drawThumb(int xst, int yst, int length, boolean horiz)
xst
- The X start coordinate of the trackbar.yst
- The Y start coordinate of the trackbar.length
- The trackbar length.horiz
- The flag indicating if the orientation is horizontal or not.private void drawTicMarks(int xst, int yst, int length)
xst
- The X start coordinate of the trackbar.yst
- The Y start coordinate of the trackbar.length
- The trackbar length.private void drawFrame(NativePoint orig, NativeDimension dim, boolean horiz)
orig
- The widget's starting point.dim
- The widget's size point.horiz
- The flag indicating if the orientation is horizontal or not.private void drawCurrentValue(NativePoint orig, NativeDimension dim, boolean horiz)
orig
- The widget's starting point.dim
- The widget's size point.horiz
- The flag indicating if the orientation is horizontal or not.private void initThumbImage(SliderGuiImpl.TicMarks ticMarksMode, boolean horiz)
ticMarksMode
- The tic marks mode value.horiz
- The flag indicating if the orientation is horizontal or not.private 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 intenal position to transform to coord.private void initInternals()