|
|||||||||
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 wheter 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.
The color picker popup is based on JS script code from
www.dhtmlgoodies.com.
To enable the color popup, reference the $cssImports
and $jsImports in the page template. For example:
<html> <head> $cssImports </head> <body> $form </body> </html> $jsImports
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, readonly, required, tabindex, title, validate, value |
Fields inherited from class org.apache.click.control.AbstractControl |
---|
actionListener, attributes, 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()
|
String |
getHtmlImports()
Return the HTML head import statements for the JavaScript and CSS files click/colorpicker/colorpicker.css click/prototype/prototype.js) and click/colorpicker/colorpicker.js. |
boolean |
getShowTextField()
Wheter 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 model)
Render a Velocity template for the given data model. |
void |
setShowTextField(boolean showTextField)
Wheter 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 wheter 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, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, onInit, onProcess, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setParent, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValue, setValueObject, setWidth |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getContext, getHeadElements, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasStyles, onDeploy, onDestroy, onRender, removeStyleClass, renderTagBegin, 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 fieldpublic ColorPicker(String name, String label)
name
- the name of the fieldlabel
- the label of the fieldpublic ColorPicker(String name, boolean required)
name
- the name of the fieldrequired
- the field required statuspublic 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 String getHtmlImports()
getHtmlImports
in interface Control
getHtmlImports
in class AbstractControl
AbstractControl.getHtmlImports()
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 Field
public int getControlSizeEst()
getControlSizeEst
in class AbstractControl
AbstractControl.getControlSizeEst()
public void render(HtmlStringBuffer buffer)
render
in interface Control
render
in class AbstractControl
buffer
- the specified buffer to render the control's output totoString()
public String toString()
toString
in class AbstractControl
public void validate()
validate
in class Field
TextField.validate()
protected void renderTemplate(HtmlStringBuffer buffer, Map 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 |