|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.click.control.AbstractControl
org.apache.click.control.Field
org.apache.click.extras.control.ColorPicker
public class ColorPicker
Provides a ColorPicker control: <input type='text'><img>.
| Color Field |
|
setShowTextField(boolean) to false
(default is true).
The ColorPicker control will validate whether the entered color is present (if required) and that it
is a valid hex color either in 3-digit presentation (ie #EEE) or 6-digit presentation (ie #EEEEEE).
If the color is not required the color-picker popup will show a button for 'no-color' on the top-left.
<html> <head> $headElements </head> <body> $form $jsElements </body> </html>
| Field Summary | |
|---|---|
protected boolean |
showTextField
The show text field option for entering a color hex value. |
protected int |
size
The text field size attribute. |
| Fields inherited from class org.apache.click.control.Field |
|---|
disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value |
| Fields inherited from class org.apache.click.control.AbstractControl |
|---|
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles |
| Fields inherited from interface org.apache.click.Control |
|---|
CONTROL_MESSAGES |
| Constructor Summary | |
|---|---|
ColorPicker()
Create a ColorPicker with no name defined. |
|
ColorPicker(String name)
Construct a ColorPicker with the given name. |
|
ColorPicker(String name,
boolean required)
Construct a ColorPicker with the given name and required status. |
|
ColorPicker(String name,
boolean required,
boolean showTextField)
Constructs a ColorPicker with the given name, required status and display text field option. |
|
ColorPicker(String name,
String label)
Construct the ColorPicker with the given name and label. |
|
| Method Summary | |
|---|---|
int |
getControlSizeEst()
|
List<Element> |
getHeadElements()
Return the ColorPicker HTML HEAD elements for the following resources: click/colorpicker/colorpicker.css click/prototype/prototype.js click/colorpicker/colorpicker.js |
boolean |
getShowTextField()
Whether the TextField to enter the color hex number should be shown or not. |
int |
getSize()
Return the field size. |
String |
getValidationJavaScript()
Return the field JavaScript client side validation function. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the ColorPicker. |
protected void |
renderTemplate(HtmlStringBuffer buffer,
Map<String,?> model)
Render a Velocity template for the given data model. |
void |
setShowTextField(boolean showTextField)
Whether the TextField to enter the color hex number should be shown or not. |
void |
setSize(int size)
Set the field size. |
String |
toString()
Returns the HTML for the color-picker. |
void |
validate()
Validates the input to check whether is required or not and that the input contains a valid color hex value. |
| Methods inherited from class org.apache.click.control.Field |
|---|
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, onProcess, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth |
| Methods inherited from class org.apache.click.control.AbstractControl |
|---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean showTextField
protected int size
| Constructor Detail |
|---|
public ColorPicker(String name)
name - the name of the field
public ColorPicker(String name,
String label)
name - the name of the fieldlabel - the label of the field
public ColorPicker(String name,
boolean required)
name - the name of the fieldrequired - the field required status
public ColorPicker(String name,
boolean required,
boolean showTextField)
name - the name of fieldrequired - the field required statusshowTextField - flag to show the text input fieldpublic ColorPicker()
| Method Detail |
|---|
public List<Element> getHeadElements()
getHeadElements in interface ControlgetHeadElements in class AbstractControlControl.getHeadElements()public boolean getShowTextField()
public void setShowTextField(boolean showTextField)
showTextField - the showTextField to setpublic int getSize()
getShowTextField() true.
public void setSize(int size)
size - the field sizepublic String getValidationJavaScript()
getValidationJavaScript in class Fieldpublic int getControlSizeEst()
getControlSizeEst in class AbstractControlAbstractControl.getControlSizeEst()public void render(HtmlStringBuffer buffer)
render in interface Controlrender in class AbstractControlbuffer - the specified buffer to render the control's output totoString()public String toString()
toString in class AbstractControlpublic void validate()
validate in class FieldTextField.validate()
protected void renderTemplate(HtmlStringBuffer buffer,
Map<String,?> model)
buffer - the specified buffer to render the template output tomodel - the model data to merge with the template
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||