public class ColorChooserGuiImpl extends FrameGuiImpl implements Container<GuiOutputManager>, IsModal, ActionListener
Usage:
createInstance(int, int)
to obtain an instance of the frame;visible
and enabled
and set focus
;ThinClient.modalEventLoop(com.goldencode.p2j.ui.client.IsModal, int, com.goldencode.p2j.ui.client.widget.Widget, com.goldencode.p2j.ui.client.TopLevelWindow)
) ;getSelectedColor()
method if the dialog was accepted.Modifier and Type | Class and Description |
---|---|
private class |
ColorChooserGuiImpl.ColorChooserLayout
The manager that does the layout of the widgets of this frame.
|
FrameGuiImpl.GuiScrollContainer
Frame.ScrollContainer
Modifier and Type | Field and Description |
---|---|
private ButtonGuiImpl |
accept
The button for accepting the current selection.
|
private boolean |
accepted
Flag that turns to true only if the user closed the dialog by accepting it.
|
private ColorSampleButton |
activeBasic
The active basic color.
|
private ColorSampleButton |
activeCustom
If not
null this stores the last selected custom color button. |
private ButtonGuiImpl |
addCustom
The button for adding a custom color.
|
private static int[][] |
BASIC_COLOR_VALUES
The RGB codes of the basic colors.
|
private ColorSampleButton[][] |
basicColors
Basic color buttons.
|
private SimpleLabel |
basicColorsLabel
A simple label that reads "Basic colors:".
|
private LineEditor |
blueE
Editor for blue RGB component.
|
private SimpleLabel |
blueLabel
Label for blue RGB component editor.
|
private CoordinatesConversion |
cc
Cached coordinates.
|
private SimpleLabel |
colorSolidLabel
A simple label that reads "Color|Solid".
|
private static int[][] |
CUSTOM_COLOR_VALUES
The default RGB codes of the custom colors.
|
private ColorSampleButton[][] |
customColors
Custom color buttons.
|
private SimpleLabel |
customColorsLabel
A simple label that reads "Custom colors:".
|
private ButtonGuiImpl |
defCustom
The button for defining custom colors.
|
private GamutPicker |
gamutPicker
The gamut picker.
|
private GuiDriver |
gd
Cached driver.
|
private LineEditor |
greenE
Editor for green RGB component.
|
private SimpleLabel |
greenLabel
Label for green RGB component editor.
|
private LineEditor |
hueE
Editor for hue HSL component.
|
private SimpleLabel |
hueLabel
Label for hue HSL component editor.
|
private boolean |
inputDone
Flag which tracks user input.
|
(package private) static java.util.logging.Logger |
LOG
Logger for all related classes.
|
private LineEditor |
lumE
Editor for luminosity HSL component.
|
private LuminosityPicker |
luminosityPicker
The gamut picker.
|
private SimpleLabel |
lumLabel
Label for luminosity HSL component editor.
|
private int |
NATIVE_HEIGHT
The native height of the dialog.
|
private int |
NATIVE_WIDTH
The native width of the dialog.
|
private LineEditor |
redE
Editor for red RGB component.
|
private SimpleLabel |
redLabel
Label for red RGB component editor.
|
private ButtonGuiImpl |
reject
The button for rejecting hte dialog.
|
private LineEditor |
satE
Editor for saturation HSL component.
|
private SimpleLabel |
satLabel
Label for saturation HSL component editor.
|
private ColorSampleButton |
solidColor
Preview of the selected color.
|
chooseHandler, configUpdateActive, contentPane, currentStatement, cursor, down, downBody, EXTRA_DLG_PIXELS, frameScroll, headersHeight, headersOutput, lastRow, needPause, nonbody, originalHeightChars, paintable, redirected, savedTabOrder, startRow, touched, trailingSkips, underline, underlinedRow, verticalStepBoxed
location, mousePtr, nativeInsets, physicalLocation
Modifier | Constructor and Description |
---|---|
private |
ColorChooserGuiImpl(WidgetId id,
FrameConfig cfg)
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addWidget(Widget<GuiOutputManager> widget)
Adding new widget to the container.
|
private ButtonGuiImpl |
createButton(java.lang.String text,
java.lang.String action,
int width,
int height,
boolean def)
Creates and initializes a customized button widget.
|
private LineEditor |
createComponentEditor(int x,
int y)
Creates an editor that allows to display and direct key in a component of the currently
selected color in one of the color spaces.
|
static ColorChooserGuiImpl |
createInstance(int rgbColor,
int windowId)
Factory method.
|
private SimpleLabel |
createSimpleLabel(java.lang.String text,
int w,
int h,
boolean rightAlign)
Creates a customized
SimpleLabel to be used on this dialog. |
void |
dismiss()
Let the modal UI element now that it should finish its modal input processing.
|
int |
getSelectedColor()
Gets the currently selected color.
|
protected void |
init(int startupRgb)
Initialize the dialog by performing tasks that was not possible in the constructor because
it was not fully created.
|
boolean |
isAccepted()
Checks whether the user accepted the selection from the dialog.
|
boolean |
isDismissed()
Get status of the input processing.
|
void |
onAction(ActionEvent event)
This method is invoked when action event is generated.
|
private void |
selectColor(int rgbColor)
Sets the currently selected color.
|
private void |
updateTabbingList()
Updates the list that dictates the focusing order using TAB/BACK-TAB keys.
|
private int |
validateComponentVal(LineEditor componentEditor,
boolean rgb)
Validates the a color component.
|
activateDirectManipulation, adjustMinSize, adjustWidth, afterConfigUpdate, calculateHeight, calculateHeightDelta, captionHeight, compareColors, convertToStreamable, createMouseHoverAction, createScrollContainer, deactivateDirectManipulation, defaultFocus, destroy, doLayoutWorker, draw, drawDownFrame, drawUnderline, findMouseSource, frameContentBounds, getCustomMousePointer, getDialogDecorationCharSize, getDynamicLayout, getLabelHeight, getLabelWidth, getMaxFrameSize, getPortableMouseEventCoordinates, getResizeRectangle, getRowDelta, getTitleHeight, hasBox, initialize, isDirectManipulationRequired, isDroppable, location, mouseActions, physicalLocation, processCancelButton, processDefaultButton, processDirectManipulationEvent, realizeFrame, resetColors, setFocus, setOuterSize, setVisible, supportsCustomMousePointer
adjustDown, adjustDown, allFramesVisible, applyConfig, arrangeToInteract, arrangeToStream, attachToWindow, calculateFrameRect, calculateWidthDelta, canSetColumn, canSetHeightChars, canSetRow, canSetWidthChars, clear, clearCurrent, clearWorker, clipping, config, copyState, currentFocus, doLayout, doLayout, draw, enableAllWidgets, enabledWidgetsByList, enterChoose, fixNonBody, forceBox, getBorderBottomChars, getBorderLeftChars, getBorderRightChars, getBorderTopChars, getChooseData, getChooseHelp, getContentPane, getCursor, getDown, getDownConfigs, getField, getField, getFirstEnabledWidget, getFirstFocusableId, getFirstFocusableId, getFixedHeight, getFocusId, getFrameValue, getFrameValue, getInnerSize, getIterationHeight, getIterationIds, getLeadingSkipSize, getMinHeight, getNextEnabledWidget, getNextTabItemList, getOriginalHeightChars, getRootFrame, getSavedDimension, getScopeNesting, getSelectedField, getSelectedWidget, getStreamId, getTrailingSkipSize, getValues, getZOrderClass, hasAnyEnabled, hasDefaultButton, hasEditors, hasEnabled, hasHeaders, hasSavedState, hasTitle, isActive, isAlive, isAllClear, isAttrSpace, isAutoplacing, isCanHide, isCanHideOthers, isCanWipeScreen, isChanged, isChooseActive, isConfigUpdateActive, isCurrentTouched, isDelayedRepaint, isDialog, isDown, isDownCalculated, isDynamic, isExplicitHide, isFixedWidth, isFocusAttractor, isFocusReset, isForcedRefresh, isForcePause, isForceWipeScreen, isHonorNextConditionalDown, isInChoose, isInScope, isInternalGo, isLabels, isLastWidget, isLeftMostWidget, isNeedPause, isNeedReset, isNoHide, isPendingFixedDown, isPendingUnderline, isPlacedForRedirected, isRedirected, isRightMostWidget, isRootFrame, isSideLabels, isStreamed, isThreeD, isTopFrame, isViewed, isVisibilityChanged, isWithHeaders, leaveChoose, markAsStreamed, markChanged, moveAboveWidget, moveBelowWidget, moveCursor, moveToBottom, moveToTop, moveWidgetBeforeTabItem, needClearRow, notifyClose, notifyPageBreak, notifyUnbind, placeAtTop, placed, placeToWindow, placeToWindow, postponePlace, postponeSetVisible, postprocess, postprocessConfig, prepareIteration, preprocess, previousFocus, processFrameMnemonic, processKeyEvent, rearrangeEditors, relayout, relocateComponent, repaint, repaintCurrent, repaintUninitialized, requestFocus, reset, resetAll, resetAutoplacing, resetChanged, resetForcedRefresh, resetNeedPause, resetPlacementQuirk, resetWidget, resolveWidgetId, restore, restoreEditors, restoreInitialTabOrder, scroll, setAlive, setAllClear, setAttrSpace, setBodyVisible, setBox, setCanHide, setCanHideOthers, setCanWipeScreen, setChooseAt, setColumns, setCurrentStatement, setCursor, setDelayedRepaint, setDown, setDynCol, setDynRow, setExplicitHide, setFocusAttractor, setFocusId, setFocusReset, setForcePause, setForceWipeScreen, setFormatCheck, setHeight, setHonorNextConditionalDown, setInnerSize, setInScope, setLabels, setLayout, setNeedPause, setNeedPauseDirect, setNeedReset, setNextTabItemList, setPaintable, setPendingFixedDown, setPendingUnderline, setProtected, setRedirected, setSavedDimension, setScopeNesting, setSensitive, setSize, setState, setValue, setValue, setViewed, setVisibilityChanged, setWidth, shortName, switchLabelsEmptyMode, toString, touchBody, touchRow, unbind, underline, updateInnerSize, view
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipRectangle, currentFocus, cycleFocus, detach, dimension, dumpCurrentWidgets, dumpWidgets, endSizeChange, firstFocus, focus, focusTraversable, focusWorker, formatDump, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChange, remove, removeContainerStateListener, replace, requestFocus, setFocusInt, setIgnoreFocus, setInsets, setSize, setTabItemList, startSizeChange, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, width
_setHidden, _setVisible, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, hasFocus, hidden, hide, highlighted, ignoreAction, isCurrent, isDirectManipulationCapable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isTotallyObscured, isVisible, isVisible, manageSystemActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, prepParentLocation, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, showPopupMenu, sync, topLevelWindow, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, add, add, addContainerStateListener, childrenLocation, clipping, currentFocus, currentFocus, defaultFocus, detach, doLayout, endSizeChange, firstFocus, focus, get, getClipRect, getIgnoreFocus, getLayout, getTabItemList, hasFocusable, insets, lastFocus, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, prevFocus, remove, removeContainerStateListener, replace, setFocus, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setWidth, startSizeChange, widgets, widgetsAsList
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, config, defaultMousePtr, destroy, dimension, displayPhysicalLocation, draw, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, height, hidden, hide, highlighted, isCurrent, isDirectManipulable, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, supportsCustomMousePointer, topLevelWindow, unrealize, width, window
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
convertToStreamable
private final int NATIVE_WIDTH
private final int NATIVE_HEIGHT
private boolean accepted
private boolean inputDone
private GuiDriver gd
private CoordinatesConversion cc
private SimpleLabel basicColorsLabel
private SimpleLabel customColorsLabel
private SimpleLabel colorSolidLabel
private SimpleLabel redLabel
private SimpleLabel greenLabel
private SimpleLabel blueLabel
private SimpleLabel hueLabel
private SimpleLabel satLabel
private SimpleLabel lumLabel
private ButtonGuiImpl defCustom
private ButtonGuiImpl addCustom
private ButtonGuiImpl accept
private ButtonGuiImpl reject
private LineEditor hueE
private LineEditor satE
private LineEditor lumE
private LineEditor redE
private LineEditor greenE
private LineEditor blueE
private GamutPicker gamutPicker
private LuminosityPicker luminosityPicker
private ColorSampleButton[][] basicColors
private ColorSampleButton[][] customColors
private ColorSampleButton solidColor
private ColorSampleButton activeCustom
null
this stores the last selected custom color button. This will be the one
to be customized with the currently selected color when addCustom
button is pressed.private ColorSampleButton activeBasic
static final java.util.logging.Logger LOG
private static final int[][] BASIC_COLOR_VALUES
private static final int[][] CUSTOM_COLOR_VALUES
private ColorChooserGuiImpl(WidgetId id, FrameConfig cfg)
createInstance(int, int)
factory
method.id
- The WidgetId
of the dialog.cfg
- The FrameConfig
of the dialog.public static ColorChooserGuiImpl createInstance(int rgbColor, int windowId)
ColorChooserGuiImpl
dialog.rgbColor
- The color to be selected in the dialog when it is first displayed.windowId
- The parent window of the newly created dialog.ColorChooserGuiImpl
configured as requested.protected void init(int startupRgb)
startupRgb
- The color preselected at startup. Will be used to select the a matching basic
color button.public boolean isAccepted()
true
if the dialog was accepted, and false
if the dialog was not
yet displayed or it was rejected by user.public boolean isDismissed()
isDismissed
in interface IsModal
public void dismiss()
public void onAction(ActionEvent event)
onAction
in interface ActionListener
event
- Event which triggered this call.private int validateComponentVal(LineEditor componentEditor, boolean rgb)
componentEditor
- The component editor.rgb
- true
for RGB color space, false
for HSL color space.public void addWidget(Widget<GuiOutputManager> widget)
widget
.addWidget
in class Frame<GuiOutputManager>
widget
- The new widget to be added to the container.public int getSelectedColor()
private void updateTabbingList()
private void selectColor(int rgbColor)
rgbColor
- The color in RGB encoding.private ButtonGuiImpl createButton(java.lang.String text, java.lang.String action, int width, int height, boolean def)
text
- The text (label) displayed on the button.action
- The action to trigger when button is pressed.width
- The width of the button (native units).height
- The height of the button (native units).def
- true
if this is the default button for the frame.ButtonGuiImpl
instance.private LineEditor createComponentEditor(int x, int y)
x
- Physical location where the editor will be displayed on the frame.y
- Physical location where the editor will be displayed on the frame.private SimpleLabel createSimpleLabel(java.lang.String text, int w, int h, boolean rightAlign)
SimpleLabel
to be used on this dialog.text
- The text to be displayed.w
- The physical width of the label.h
- The physical height of the label.rightAlign
- Whether th text is right aligned.SimpleLabel
.