|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnextapp.echo.AbstractComponent
nextapp.echo.Container
echopoint.EchoPointComponent
echopoint.ColorChooser
public class ColorChooser
The ColorChooser class can be used to allow the user to select colors from a series of sample color cells.
The class uses the ColorSelectionModel interface to keep
track of the currently selected color. If no color is provided on the
the constructor, then Color.WHITE is used.
The class provides a default Color Preview Pane. A new Component can be
used. It should implement the ChangeListener interface in order
to be notified when the ColorSelectionModel has changed.
| Nested Class Summary | |
|---|---|
static class |
ColorChooser.NestedStyleInfo
Nested public static StyleInfo class. |
| Field Summary | |
|---|---|
static java.lang.String |
BORDER_COLOR_CHANGED_PROPERTY
|
static java.lang.String |
BORDER_SIZE_CHANGED_PROPERTY
|
protected Color |
borderColor
|
protected int |
borderSize
|
static java.lang.String |
CELL_HEIGHT_CHANGED_PROPERTY
|
static java.lang.String |
CELL_SPACING_CHANGED_PROPERTY
|
static java.lang.String |
CELL_SPACING_COLOR_CHANGED_PROPERTY
|
static java.lang.String |
CELL_WIDTH_CHANGED_PROPERTY
|
protected int |
cellHeight
|
static java.lang.String |
CELLS_PER_ROW_CHANGED_PROPERTY
|
protected int |
cellSpacing
|
protected Color |
cellSpacingColor
|
protected int |
cellsPerRow
|
protected int |
cellWidth
|
static java.lang.String |
COLOR_ARRAY_CHANGED_PROPERTY
|
protected Color[] |
colorArray
|
static int |
defaultCellHeight
Default cell height is 17 |
static int |
defaultCellSpacing
Default cell spacing is 2 |
static Color |
defaultCellSpacingColor
Default cell spacing color is Color.WHITE |
static int |
defaultCellsPerRow
Default number of cells per row is 8 |
static int |
defaultCellWidth
Default cell width is 17 |
static Color[] |
defaultColorArray
the default color array used by ColorChooser |
static Insets |
defaultInsets
Default Insets are 0 wide |
static int |
defaultWebSafeCellsPerRow
Default number of cells per row for the web safe color array is 18 |
protected Insets |
insets
|
static java.lang.String |
INSETS_CHANGED_PROPERTY
|
static java.lang.String |
PREVIEW_PANEL_CHANGED_PROPERTY
|
protected Component |
previewPanel
|
static java.lang.String |
SELECTION_MODEL_CHANGED_PROPERTY
|
protected ColorSelectionModel |
selectionModel
|
static java.lang.String |
STYLE_BORDER_COLOR
A style constant for the Border Color property. |
static java.lang.String |
STYLE_BORDER_SIZE
A style constant for the Border Size property. |
static java.lang.String |
STYLE_CELL_HEIGHT
A style constant for the Cell Height property. |
static java.lang.String |
STYLE_CELL_SPACING
A style constant for the Cell Spacing property. |
static java.lang.String |
STYLE_CELL_SPACING_COLOR
A style constant for the Cell Spacing Color property. |
static java.lang.String |
STYLE_CELL_WIDTH
A style constant for the Cell Width property. |
static java.lang.String |
STYLE_CELLS_PER_ROW
A style constant for the Cells Per Row property. |
static java.lang.String |
STYLE_INSETS
A style constant for the Insets property. |
static java.lang.String |
STYLE_SELECTED_COLOR
A style constant for the Selected Color property. |
static java.lang.String |
TITLE_CHANGED_PROPERTY
|
protected TitleBar |
titleBar
|
static Color[] |
web216ColorArray
This Color array consists of the web safe 216 colors in a table 18 cells by 13 rows. |
| Fields inherited from class echopoint.EchoPointComponent |
|---|
STYLE_TOOL_TIP_TEXT, TOOL_TIP_TEXT_CHANGED_PROPERTY, toolTipPopUp |
| Fields inherited from interface echopoint.positionable.MouseCursorable |
|---|
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI |
| Constructor Summary | |
|---|---|
ColorChooser()
Constructs a ColorChooser with Color.WHITE selected |
|
ColorChooser(Color newSelectedColor)
Constructs a ColorChooser with newSelectedColor selected
using the ColorChooser.defaultColorArray color array. |
|
ColorChooser(Color newSelectedColor,
Color[] newColorArray)
Constructs a ColorChooser with newSelectedColor selected
and uses newColorArray to display sample color cells. |
|
| Method Summary | |
|---|---|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener to the color chooser. |
void |
applyStyle(Style style)
Applies the provided style to the component. |
protected ChangeListener |
createChangeListener()
Subclasses that want to handle ChangeEvents differently can override this to return a subclass of ModelListener or another ChangeListener implementation. |
Color |
getBorderColor()
|
int |
getBorderSize()
|
int |
getCellHeight()
|
int |
getCellSpacing()
|
Color |
getCellSpacingColor()
|
int |
getCellsPerRow()
|
int |
getCellWidth()
|
Color[] |
getColorArray()
|
Insets |
getInsets()
|
Component |
getPreviewPanel()
|
Color |
getSelectedColor()
|
ColorSelectionModel |
getSelectionModel()
|
TitleBar |
getTitle()
|
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from this component. |
protected void |
reRegisterComponents(Component oldValue,
Component newValue)
|
java.lang.Object |
set(java.lang.reflect.Field field,
java.lang.Object newValue)
Called to save the old value of a field, set in a new value and return the old value of a field. |
void |
setBorderColor(Color newBorderColor)
Sets the border Color of the ColorChooser. |
void |
setBorderSize(int newBorderSize)
Sets the border size of the ColorChooser. |
void |
setCellHeight(int newHeight)
Sets the height of the ColorChooser sample color cells. |
void |
setCellSpacing(int newSpacing)
Sets the spacing between the ColorChooser sample color cells. |
void |
setCellSpacingColor(Color newCellSpacingColor)
Sets the Color of the ColorChooser sample color cells. |
void |
setCellsPerRow(int newCellsPerRow)
Sets the number of cells per row of the ColorChooser sample color cells. |
void |
setCellWidth(int newWidth)
Sets the width of the ColorChooser sample color cells. |
void |
setColorArray(Color[] newColorArray)
Sets the Color[] array used by the ColorChooser to
display sample color cells. |
void |
setInsets(Insets newValue)
Sets the Insets used by the ColorChooser
This methods fires a PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.INSETS_CHANGED_PROPERTY |
void |
setPreviewPane(Component newPreviewPanel)
Sets the Component used by the ColorChooser as a preview panel. |
void |
setSelectedColor(Color newSelectedColor)
Sets the currently selected Color of the ColorChooser
This methods causes the underlying ColorSelectionModel to
change. |
void |
setSelectedColor(int red,
int green,
int blue)
Sets the currently selected Color of the ColorChooser in RGB format. |
void |
setSelectionModel(ColorSelectionModel newModel)
Sets the ColorSelectionModel model used by the ColorChooser. |
void |
setTitle(java.lang.String newTitleText)
Sets the text of the title TitleBar used by the ColorChooser. |
void |
setTitle(TitleBar newTitle)
Sets the title used by the ColorChooser. |
void |
useDefaultColorArray()
Resets the Color array used by then ColorChooser to
ColorChooser.defaultColorArray and also changes the cells
per row settings to the default values. |
void |
useWebSafeDefaultColorArray()
Resets the Color array used by then ColorChooser to
ColorChooser.web216ColorArray and also changes the cells
per row settings to an appropriate value |
| Methods inherited from class echopoint.EchoPointComponent |
|---|
getMouseCursor, getMouseCursorURI, getToolTipPopUp, getToolTipText, set, set, set, set, set, set, set, set, set, setEnabledAllChildren, setMouseCursor, setMouseCursorURI, setToolTipText, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String STYLE_BORDER_COLOR
nextapp.echo.Color.
public static final java.lang.String STYLE_BORDER_SIZE
Integer.
public static final java.lang.String STYLE_INSETS
nextapp.echo.Insets.
public static final java.lang.String STYLE_CELL_HEIGHT
Integer.
public static final java.lang.String STYLE_CELL_WIDTH
Integer.
public static final java.lang.String STYLE_CELL_SPACING
Integer.
public static final java.lang.String STYLE_CELL_SPACING_COLOR
nextapp.echo.Color.
public static final java.lang.String STYLE_CELLS_PER_ROW
Integer.
public static final java.lang.String STYLE_SELECTED_COLOR
nextapp.echo.Color.
public static final java.lang.String SELECTION_MODEL_CHANGED_PROPERTY
public static final java.lang.String PREVIEW_PANEL_CHANGED_PROPERTY
public static final java.lang.String COLOR_ARRAY_CHANGED_PROPERTY
public static final java.lang.String TITLE_CHANGED_PROPERTY
public static final java.lang.String BORDER_COLOR_CHANGED_PROPERTY
public static final java.lang.String BORDER_SIZE_CHANGED_PROPERTY
public static final java.lang.String INSETS_CHANGED_PROPERTY
public static final java.lang.String CELL_SPACING_COLOR_CHANGED_PROPERTY
public static final java.lang.String CELL_WIDTH_CHANGED_PROPERTY
public static final java.lang.String CELL_HEIGHT_CHANGED_PROPERTY
public static final java.lang.String CELL_SPACING_CHANGED_PROPERTY
public static final java.lang.String CELLS_PER_ROW_CHANGED_PROPERTY
public static final int defaultCellsPerRow
public static final int defaultWebSafeCellsPerRow
public static final int defaultCellWidth
public static final int defaultCellHeight
public static final int defaultCellSpacing
public static final Color defaultCellSpacingColor
public static final Insets defaultInsets
protected Color borderColor
protected int borderSize
protected Insets insets
protected int cellsPerRow
protected int cellWidth
protected int cellHeight
protected int cellSpacing
protected Color cellSpacingColor
protected Component previewPanel
protected Color[] colorArray
protected ColorSelectionModel selectionModel
public static final Color[] defaultColorArray
public static final Color[] web216ColorArray
The the last row is 9 white fillers followed by 9 white through grey to black colors.
protected TitleBar titleBar
| Constructor Detail |
|---|
public ColorChooser()
ColorChooser with Color.WHITE selected
public ColorChooser(Color newSelectedColor)
ColorChooser with newSelectedColor selected
using the ColorChooser.defaultColorArray color array.
public ColorChooser(Color newSelectedColor,
Color[] newColorArray)
ColorChooser with newSelectedColor selected
and uses newColorArray to display sample color cells.
| Method Detail |
|---|
public void addChangeListener(ChangeListener l)
ChangeListener to the color chooser.
l - The ChangeListener to be added.public void applyStyle(Style style)
nextapp.echo.Component
style names can be used as well.
applyStyle in interface MouseCursorableapplyStyle in interface ComponentapplyStyle in class EchoPointComponentstyle - The style object from which to retrieve properties for this
Component.Component.applyStyle(nextapp.echo.Style)protected ChangeListener createChangeListener()
public Color getBorderColor()
Color of the ColorChooser's border.public int getBorderSize()
ColorChooser's border.public int getCellHeight()
ColorChooser's sample color cells.public int getCellSpacing()
ColorChooser's sample color cells.public Color getCellSpacingColor()
Color of the ColorChooser's sample color cells.public int getCellsPerRow()
ColorChooser's sample color cells.public int getCellWidth()
ColorChooser's sample color cells.public Color[] getColorArray()
Color[] array used to display the ColorChooser's sample color cells.public Insets getInsets()
Insets (margins) of the ColorChooser.public Component getPreviewPanel()
Component currently used by the ColorChooser.public Color getSelectedColor()
Color of the ColorChooser.public ColorSelectionModel getSelectionModel()
ColorSelectionModel model of the ColorChooser.public TitleBar getTitle()
ColorChooser.public void removeChangeListener(ChangeListener l)
l - the ChangeListener to remove
protected void reRegisterComponents(Component oldValue,
Component newValue)
public void setBorderColor(Color newBorderColor)
Color of the ColorChooser.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.BORDER_COLOR_CHANGED_PROPERTY
public void setBorderSize(int newBorderSize)
ColorChooser.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.BORDER_SIZE_CHANGED_PROPERTY
public void setCellHeight(int newHeight)
ColorChooser sample color cells.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.CELL_HEIGHT_CHANGED_PROPERTY
public void setCellSpacing(int newSpacing)
ColorChooser sample color cells.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.CELL_SPACING_CHANGED_PROPERTY
public void setCellSpacingColor(Color newCellSpacingColor)
Color of the ColorChooser sample color cells.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.CELL_SPACING_COLOR_CHANGED_PROPERTY
public void setCellsPerRow(int newCellsPerRow)
ColorChooser sample color cells.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.CELLS_PER_ROW_CHANGED_PROPERTY
public void setCellWidth(int newWidth)
ColorChooser sample color cells.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.CELL_WIDTH_CHANGED_PROPERTY
public void setColorArray(Color[] newColorArray)
Color[] array used by the ColorChooser to
display sample color cells.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.COLOR_ARRAY_CHANGED_PROPERTY
public void setInsets(Insets newValue)
Insets used by the ColorChooser
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.INSETS_CHANGED_PROPERTY
public void setPreviewPane(Component newPreviewPanel)
Component used by the ColorChooser as a preview panel.
Component should implement ChangeEventListener and
then call addChangeListener to ensure it is notified of changes to the
underlying ColorSelectionModel model.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.PREVIEW_PANEL_CHANGED_PROPERTY
public void setSelectedColor(int red,
int green,
int blue)
Color of the ColorChooser in RGB format.
ColorSelectionModel to
change.
public void setSelectedColor(Color newSelectedColor)
Color of the ColorChooser
ColorSelectionModel to
change.
public void setSelectionModel(ColorSelectionModel newModel)
ColorSelectionModel model used by the ColorChooser.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.SELECTION_MODEL_CHANGED_PROPERTY
public void setTitle(TitleBar newTitle)
ColorChooser.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.TITLE_CHANGED_PROPERTY
public void setTitle(java.lang.String newTitleText)
ColorChooser.
PropertyChangeEvent with a
getPropertyName() value of
ColorChooser.TITLE_CHANGED_PROPERTY
public void useDefaultColorArray()
ColorChooser to
ColorChooser.defaultColorArray and also changes the cells
per row settings to the default values.
public void useWebSafeDefaultColorArray()
ColorChooser to
ColorChooser.web216ColorArray and also changes the cells
per row settings to an appropriate value
public java.lang.Object set(java.lang.reflect.Field field,
java.lang.Object newValue)
throws java.lang.Exception
ReflectionSetter
public Object set(Field f, Object newValue) throws Exception {
Object oldValue = f.get(this);
f.set(this,newValue);
return oldValue;
}
field - - the field to be setnewValue - - the new value to be set
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.NullPointerException
java.lang.ExceptionReflectionSetter.set(Field, Object)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||