|
Extension SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.AbstractButton | +--javax.swing.JButton | +--oracle.bali.ewt.chooser.color.ColorChoice | +--oracle.ide.controls.CustomColorChoice
The CustomColorChoice
is an extension of the Bali
ColorChoice
with default options set to show a custom
palette with editable colors. This class takes care of persisting
the custom colors through the Ide's DTCache
instance.
It also uses a shared custom palette, so that when the user edits
a custom color, it is automatically seen by other
CustomColorChoice
instances.
If the custom palette is empty, it will pre-fill any null colors with light gray. This is because there doesn't seem to be a way to disallow null colors from being seleted in the control.
Inner classes inherited from class javax.swing.JButton |
javax.swing.JButton.AccessibleJButton |
Inner classes inherited from class javax.swing.AbstractButton |
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected static oracle.bali.ewt.model.TwoDModel |
CUSTOM_PALETTE
Our single, shared custom palette. |
static oracle.bali.ewt.model.TwoDModel |
DEFAULT_SWATCH_MODEL
The 2D model instance that can be used with Bali's color choosers, based on our default color swatch. |
Fields inherited from class oracle.bali.ewt.chooser.color.ColorChoice |
PROPERTY_AUTOMATIC_SELECTED, PROPERTY_COLOR_PALETTE, PROPERTY_DEFAULT_SELECTED, PROPERTY_SELECTED_COLOR |
Fields inherited from class javax.swing.AbstractButton |
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
CustomColorChoice()
Construct a new CustomColorChoice . |
Method Summary | |
protected static oracle.bali.ewt.model.TwoDModel |
getCustomPalette()
Fetch the custom palette of user-specified colors that can be used for the color choice. |
protected static boolean |
isColorInPalette(java.awt.Color color,
oracle.bali.ewt.model.TwoDModel palette)
Utility routine to check if a given color is contained within the given palette. |
protected static void |
loadPalette(oracle.bali.ewt.model.TwoDModel palette)
Utility routine to load the colors for the custom palette from the DTCache area. |
protected static void |
savePalette(oracle.bali.ewt.model.TwoDModel palette)
Utility routine to save the colors from the specified palette back to the DTCache area. |
void |
setClosestSelectedColor(java.awt.Color color)
Selects the specified color, whether it is in the main or custom palette, or the closest color if it is not available in either. |
Methods inherited from class oracle.bali.ewt.chooser.color.ColorChoice |
addNotify, firePropertyChange, getAccessibleContext, getClosestColor, getClosestColor, getColorPalette, getColorPalettePane, getColorToChange, getCustomColorPalette, getDefaultColor, getImage, getSelectedColor, isAutomaticAllowed, isAutomaticSelected, isColorInPalette, isCustomColorSelected, isDefaultAllowed, isDefaultSelected, isEditAllowed, isTransparentAllowed, removeNotify, setAutomaticAllowed, setAutomaticSelected, setColorPalette, setCustomColorPalette, setDefaultAllowed, setDefaultColor, setDefaultSelected, setDisabledIcon, setEditAllowed, setIcon, setImage, setLocale, setSelectedColor, setSelectedColor, setTransparentAllowed, updateUI |
Methods inherited from class javax.swing.JButton |
configurePropertiesFromAction, getUIClassID, isDefaultButton, isDefaultCapable, paramString, setDefaultCapable |
Methods inherited from class javax.swing.AbstractButton |
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getLabel, getMargin, getMnemonic, getModel, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isFocusTraversable, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledSelectedIcon, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static oracle.bali.ewt.model.TwoDModel CUSTOM_PALETTE
public static final oracle.bali.ewt.model.TwoDModel DEFAULT_SWATCH_MODEL
Constructor Detail |
public CustomColorChoice()
CustomColorChoice
. This will use the
default web-safe color model along with a shared custom palette.Method Detail |
public void setClosestSelectedColor(java.awt.Color color)
color
- the color to selectprotected static boolean isColorInPalette(java.awt.Color color, oracle.bali.ewt.model.TwoDModel palette)
color
- the color to checkpalette
- the palette to checkprotected static oracle.bali.ewt.model.TwoDModel getCustomPalette()
protected static void loadPalette(oracle.bali.ewt.model.TwoDModel palette)
palette
- the palette to load the colors intoprotected static void savePalette(oracle.bali.ewt.model.TwoDModel palette)
palette
- the palette to the save the colors of
|
Extension SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |