org.zkoss.zul.api
Interface Captcha

All Superinterfaces:
java.lang.Cloneable, Component, HtmlBasedComponent, Image, Scope, java.io.Serializable, XulElement
All Known Implementing Classes:
Captcha

public interface Captcha
extends Image

The generic captcha component.

Since:
3.5.2
Author:
henrichen

Field Summary
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Method Summary
 void addFont(java.awt.Font font)
          Add fonts into fonts list.
 java.lang.String getBgColor()
          Get the background color of the captcha box (in string as #RRGGBB). null means default.
 int getBgRGB()
          Get the background color in int array (0: red, 1: green, 2:blue). null means default.
 CaptchaEngine getCaptchaEngine()
          Get the captcha engine.
 java.awt.Font[] getDefaultFonts()
          Gets the default font list.
 java.lang.String getExclude()
          Get exclude characters.
 java.awt.Font getFont(int j)
          Get nth Font.
 java.lang.String getFontColor()
          Gets font color.
 int getFontRGB()
          Get the font color in int array (0: red, 1: green, 2:blue).
 java.util.List getFonts()
          Gets fonts list, default provide two fonts.
 int getIntHeight()
          Get the captcha int height in pixel; to be used by the derived subclass.
 int getIntWidth()
          Get the captcha int width in pixel; to be used by the derived subclass.
 int getLength()
          Get length of the autogenerated text value; default to 5.
 java.lang.String getValue()
          Get the text value of this captcha.
 boolean isNoise()
          Whether generate noise; default to true.
 java.lang.String randomValue()
          Regenerates new captcha text value and redraw.
 void setBgColor(java.lang.String color)
          Set the background color of the chart.
 void setEngine(CaptchaEngine engine)
          Set the captcha engine.
 void setEngine(java.lang.String clsnm)
          Sets the captcha engine by use of a class name.
 void setExclude(java.lang.String exclude)
          Set exclude characters that will not be generated.
 void setFontColor(java.lang.String color)
          Set font color.
 void setLength(int len)
          Set length of the autogenerated text value; default to 5.
 void setNoise(boolean b)
          Wheather generate noise; default to true.
 void setValue(java.lang.String text)
          Set the text value to be shown as the distortion captcha.
 
Methods inherited from interface org.zkoss.zul.api.Image
getAlign, getBorder, getContent, getHover, getHspace, getSrc, getVspace, setAlign, setBorder, setContent, setContent, setHover, setHoverContent, setHoverContent, setHspace, setSrc, setVspace
 
Methods inherited from interface org.zkoss.zul.impl.api.XulElement
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, clone, containsVariable, detach, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getChildren, getDefinition, getDesktop, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setAuService, setId, setMold, setPage, setPageBefore, setParent, setVariable, setVisible, setWidgetListener, setWidgetOverride, unsetVariable
 
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
 

Method Detail

getFonts

java.util.List getFonts()
Gets fonts list, default provide two fonts.


getDefaultFonts

java.awt.Font[] getDefaultFonts()
Gets the default font list.


getFont

java.awt.Font getFont(int j)
Get nth Font.


addFont

void addFont(java.awt.Font font)
Add fonts into fonts list. If you did not add fonts, the default implementation would use the default fonts; i.e. bold Arial 35, and bold courier 35.


setFontColor

void setFontColor(java.lang.String color)
Set font color.


getFontColor

java.lang.String getFontColor()
Gets font color.


getFontRGB

int getFontRGB()
Get the font color in int array (0: red, 1: green, 2:blue).


setBgColor

void setBgColor(java.lang.String color)
Set the background color of the chart.

Parameters:
color - in #RRGGBB format (hexdecimal).

getBgColor

java.lang.String getBgColor()
Get the background color of the captcha box (in string as #RRGGBB). null means default.


getBgRGB

int getBgRGB()
Get the background color in int array (0: red, 1: green, 2:blue). null means default.


getIntWidth

int getIntWidth()
Get the captcha int width in pixel; to be used by the derived subclass.


getIntHeight

int getIntHeight()
Get the captcha int height in pixel; to be used by the derived subclass.


getValue

java.lang.String getValue()
Get the text value of this captcha.


setValue

void setValue(java.lang.String text)
              throws WrongValueException
Set the text value to be shown as the distortion captcha.

Parameters:
text - the captcha text value
Throws:
WrongValueException

setLength

void setLength(int len)
Set length of the autogenerated text value; default to 5.


getLength

int getLength()
Get length of the autogenerated text value; default to 5.


setExclude

void setExclude(java.lang.String exclude)
Set exclude characters that will not be generated. Note that only digit and character is used in generating text value. If you leave exclude null, the default exclude list will be applied; i.e., 0123456789IilOo (only character (no digits) are used except I, i, l, O(big O), o(small o))


getExclude

java.lang.String getExclude()
Get exclude characters.


setNoise

void setNoise(boolean b)
Wheather generate noise; default to true.


isNoise

boolean isNoise()
Whether generate noise; default to true.


randomValue

java.lang.String randomValue()
Regenerates new captcha text value and redraw.


setEngine

void setEngine(java.lang.String clsnm)
               throws java.lang.ClassNotFoundException,
                      java.lang.NoSuchMethodException,
                      java.lang.IllegalAccessException,
                      java.lang.InstantiationException,
                      java.lang.reflect.InvocationTargetException
Sets the captcha engine by use of a class name. It creates an instance automatically.

Throws:
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException

setEngine

void setEngine(CaptchaEngine engine)
Set the captcha engine.


getCaptchaEngine

CaptchaEngine getCaptchaEngine()
                               throws UiException
Get the captcha engine.

Throws:
UiException - if failed to load the engine.


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo