|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.click.control.AbstractControl net.sf.click.control.Field net.sf.click.extras.control.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 #eeeee).
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 liferay.com which in turn is based on code
from http://typetester.maratz.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 net.sf.click.control.Field |
disabled, error, focus, form, help, label, readonly, required, tabindex, title, validate, value |
Fields inherited from class net.sf.click.control.AbstractControl |
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles |
Fields inherited from interface net.sf.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 files click/prototype.js) and click/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 |
onDeploy(ServletContext servletContext)
Deploy the static resource files in the colorpicker package. |
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 net.sf.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 net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasStyles, onDestroy, onRender, registerActionEvent, 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()
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()
public void onDeploy(ServletContext servletContext)
servletContext
- the ServletContextAbstractControl.onDeploy(javax.servlet.ServletContext)
public int getControlSizeEst()
AbstractControl.getControlSizeEst()
public void render(HtmlStringBuffer buffer)
buffer
- the specified buffer to render the control's output totoString()
public String toString()
public void validate()
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 |