|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.ui.AbstractComponent
com.vaadin.ui.Embedded
eu.livotov.tpt.gui.widgets.TPTCaptcha
public class TPTCaptcha
This component represents a captcha image that can be displayed for some form validations. You can provide your own text for captcha image or let the component to automatically generat it to you.
Nested Class Summary | |
---|---|
static interface |
TPTCaptcha.CaptchaImageProvider
API for connecting custom image generators. |
private class |
TPTCaptcha.DefaultCaptchaImageGenerator
|
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
---|
com.vaadin.ui.AbstractComponent.ComponentErrorEvent, com.vaadin.ui.AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.ErrorListener, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable |
---|
com.vaadin.terminal.Paintable.RepaintRequestEvent, com.vaadin.terminal.Paintable.RepaintRequestListener |
Field Summary | |
---|---|
private java.lang.String |
captchaCode
Current captcha code |
private TPTCaptcha.CaptchaImageProvider |
imageProvider
Image provider for captcha |
Fields inherited from class com.vaadin.ui.Embedded |
---|
TYPE_BROWSER, TYPE_IMAGE, TYPE_OBJECT |
Fields inherited from interface com.vaadin.terminal.Sizeable |
---|
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
TPTCaptcha()
Creates a captcha component with random 5-letter code generated |
|
TPTCaptcha(java.lang.String code)
Creates a captcha component with the specified text to be used as captcha code |
Method Summary | |
---|---|
java.lang.String |
generateCaptchaCode(int charactersCount)
Generates and sets a random captcha code with the specified characters length. |
java.lang.String |
getCaptchaCode()
Provides the current captcha code that is displayed in the component |
java.io.InputStream |
getStream()
|
private void |
refreshCaptchaImageSource(com.vaadin.Application app)
|
void |
setCaptchaCode(java.lang.String code)
Sets the new captcha code. |
void |
setCaptchaCode(java.lang.String code,
com.vaadin.Application app)
Sets the new captcha code. |
void |
setCaptchaImageProvider(TPTCaptcha.CaptchaImageProvider provider)
Sets the new image provider, that is responsible for creating captcha images. |
void |
setCaptchaImageProvider(TPTCaptcha.CaptchaImageProvider provider,
com.vaadin.Application app)
Sets the new image provider, that is responsible for creating captcha images. |
boolean |
verifyCaptchaCode(java.lang.String sample)
Verifies the given code agains current captcha code. |
Methods inherited from class com.vaadin.ui.Embedded |
---|
addListener, changeVariables, getArchive, getClassId, getCodebase, getCodetype, getMimeType, getParameter, getParameterNames, getSource, getStandby, getType, paintContent, removeListener, removeParameter, setArchive, setClassId, setCodebase, setCodetype, setMimeType, setParameter, setSource, setStandby, setType |
Methods inherited from class com.vaadin.ui.AbstractComponent |
---|
addListener, addListener, addListener, addListener, addListener, addStyleName, attach, childRequestedRepaint, detach, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getLocale, getParent, getStyle, getStyleName, getTag, getWidth, getWidthUnits, getWindow, handleError, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, setWidth, setWidthUnits |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private TPTCaptcha.CaptchaImageProvider imageProvider
private java.lang.String captchaCode
Constructor Detail |
---|
public TPTCaptcha()
public TPTCaptcha(java.lang.String code)
code
- captcha codeMethod Detail |
---|
public void setCaptchaCode(java.lang.String code)
code
- new captcha codepublic void setCaptchaCode(java.lang.String code, com.vaadin.Application app)
code
- new code to generateapp
- Vaadin application instance. Required to generate a new StreamSourcepublic java.lang.String getCaptchaCode()
public boolean verifyCaptchaCode(java.lang.String sample)
sample
- sample text to compare with the current captcha component
true
if provided code matches the captcha (uses case-insensitive
comparison)public java.lang.String generateCaptchaCode(int charactersCount)
charactersCount
- number of characters in the new code
public void setCaptchaImageProvider(TPTCaptcha.CaptchaImageProvider provider)
provider
- new image provider to use. Captcha code will be regenerated using this new
image provider immideately.public void setCaptchaImageProvider(TPTCaptcha.CaptchaImageProvider provider, com.vaadin.Application app)
provider
- new image provider to use. Captcha code will be regenerated using this new
image provider immideately.public java.io.InputStream getStream()
getStream
in interface com.vaadin.terminal.StreamResource.StreamSource
private void refreshCaptchaImageSource(com.vaadin.Application app)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |