Java Doc for InputElement.java in  » Ajax » zk » org » zkoss » zul » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » zk » org.zkoss.zul.impl 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.zkoss.zul.impl.XulElement
   org.zkoss.zul.impl.InputElement

All known Subclasses:   org.zkoss.zul.Timebox,  org.zkoss.zul.Textbox,  org.zkoss.zul.impl.FormatInputElement,
InputElement
abstract public class InputElement extends XulElement implements Constrainted(Code)
A skeletal implementation of an input box.

Events: onChange, onChanging, onFocus, onBlur, onSelection, and onOK

Default InputElement.getSclass : text.
author:
   tomyeh
since:
   3.0.1 supports onOK event.


Inner Class :protected class ExtraCtrl extends XulElement.ExtraCtrl implements InputableX,Errorable


Constructor Summary
public  InputElement()
    

Method Summary
protected  voidcheckUserError()
     Checks whether user entered a wrong value (and not correct it yet).
public  voidclearErrorMessage(boolean revalidateRequired)
     Clears the error message.

The error message is cleared automatically, so you rarely need to call this method. However, if a constraint depends on multiple input fields and the error can be corrected by changing one of these fields, then you may have to clear the error message manullay by invoking this method.

For example, assume you have two org.zkoss.zul.Intbox and want the value of the first one to be smaller than that of the second one.

public  voidclearErrorMessage()
     Clears the error message. It is the same as clearErrorMessage(false).
abstract protected  ObjectcoerceFromString(String value)
     Coerces the value passed to InputElement.setText .

Deriving note:
If you want to store the value in other type, say BigDecimal, you have to override InputElement.coerceToString and InputElement.coerceFromString to convert between a string and your targeting type.

Moreover, when org.zkoss.zul.Textbox is called, it calls this method with value = null.

abstract protected  StringcoerceToString(Object value)
     Coerces the value passed to InputElement.setText .
public  StringgetAreaText()
     Returns the text for HTML AREA (Internal Use Only).

Used only for component generation.

public  intgetCols()
     Returns the cols.
final public  ConstraintgetConstraint()
    
public  StringgetErrorMessage()
     Returns the error message that is caused when user entered invalid value, or null if no error at all.
public  StringgetInnerAttrs()
    
public  intgetMaxlength()
     Returns the maxlength.
public  StringgetName()
     Returns the name of this component.

Default: null.

Don't use this method if your application is purely based on ZK's event-driven model.

The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers.

public  StringgetOuterAttrs()
    
public  StringgetRawText()
     Returns the text directly without checking whether any error message not yet fixed.
public  ObjectgetRawValue()
     Returns the raw value directly with checking whether any error message not yet fixed.
public  intgetTabindex()
     Returns the tab order of this component.
protected  ObjectgetTargetValue()
     Returns the value in the targeting type.
public  StringgetText()
     Returns the value in the String format.
public  StringgetType()
     Returns the type.
protected  booleanisAsapRequired(String evtnm)
     Returns whether to send back the request of the specified event immediately -- non-deferable.
public  booleanisChildable()
     Not childable.
public  booleanisDisabled()
     Returns whether it is disabled.
public  booleanisMultiline()
     Returns whether it is multiline.
public  booleanisReadonly()
     Returns whether it is readonly.
public  booleanisValid()
     Returns the current content of this input is correct.
protected  ObjectnewExtraCtrl()
    
public  WrongValueExceptiononWrongValue(WrongValueException ex)
    
public  voidselect()
     Selects the whole text in this input.
public  voidsetCols(int cols)
     Sets the cols.
public  voidsetConstraint(String constr)
    
public  voidsetConstraint(Constraint constr)
    
public  voidsetDisabled(boolean disabled)
     Sets whether it is disabled.
public  voidsetMaxlength(int maxlength)
     Sets the maxlength.
public  voidsetName(String name)
     Sets the name of this component.

Don't use this method if your application is purely based on ZK's event-driven model.

The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers.

public  voidsetRawValue(Object value)
     Sets the raw value directly.
public  voidsetReadonly(boolean readonly)
     Sets whether it is readonly.
public  voidsetSelectedText(int start, int end, String newtxt, boolean isHighLight)
     Sets the text of this InputElement to the specified text which is begining with the new start point and ending with the new end point.
public  voidsetSelectionRange(int start, int end)
     Sets the selection end to the specified position and the selection start to the specified position.
public  voidsetTabindex(int tabindex)
     Sets the tab order of this component.
public  voidsetText(String value)
     Sets the value in the String format.
protected  voidsetValueDirectly(Object value)
     Sets the value directly.
protected  WrongValueExceptionshowCustomError(WrongValueException ex)
     Shows the error message in the custom way by calling ( CustomConstraint.showCustomError , if the contraint implements CustomConstraint .

Derived class shall call this method before throwing WrongValueException , such that the constraint, if any, has a chance to show the error message in a custom way.
Parameters:
  ex - the exception, or null to clean up the error.

protected  voidvalidate(Object value)
     Validates the value returned by InputElement.coerceFromString .


Constructor Detail
InputElement
public InputElement()(Code)




Method Detail
checkUserError
protected void checkUserError() throws WrongValueException(Code)
Checks whether user entered a wrong value (and not correct it yet). Since user might enter a wrong value and moves on to other components, this methid is called when InputElement.getText or InputElement.getTargetValue is called.

Derives rarely need to access this method if they use only InputElement.getText and InputElement.getTargetValue .




clearErrorMessage
public void clearErrorMessage(boolean revalidateRequired)(Code)
Clears the error message.

The error message is cleared automatically, so you rarely need to call this method. However, if a constraint depends on multiple input fields and the error can be corrected by changing one of these fields, then you may have to clear the error message manullay by invoking this method.

For example, assume you have two org.zkoss.zul.Intbox and want the value of the first one to be smaller than that of the second one. Then, you have to call this method for the second intbox once the validation of the first intbox succeeds, and vice versa. Otherwise, the error message for the seoncd intbox remains if the user fixed the error by lowering down the value of the first one Why? The second intbox got no idea to clear the error message (since its content doesn't change).
Parameters:
  revalidateRequired - whether to re-validate the current valuewhen InputElement.getText or others (such as org.zkoss.zul.Intbox.getValue)is called.If false, the current value is assumed to be correct andthe following invocation to InputElement.getText or others (such as org.zkoss.zul.Intbox.getValue)won't check the value again.Note: when an input element is constrcuted, the initial valueis assumed to be "not-validated-yet".
since:
   3.0.1




clearErrorMessage
public void clearErrorMessage()(Code)
Clears the error message. It is the same as clearErrorMessage(false). That is, the current value is assumed to be correct. InputElement.getText or others (such as org.zkoss.zul.Intbox.getValue ) won't re-validate it again.

The error message is cleared automatically, so you rarely need to call this method.
See Also:   InputElement.clearErrorMessage(boolean)




coerceFromString
abstract protected Object coerceFromString(String value) throws WrongValueException(Code)
Coerces the value passed to InputElement.setText .

Deriving note:
If you want to store the value in other type, say BigDecimal, you have to override InputElement.coerceToString and InputElement.coerceFromString to convert between a string and your targeting type.

Moreover, when org.zkoss.zul.Textbox is called, it calls this method with value = null. Derives shall handle this case properly.




coerceToString
abstract protected String coerceToString(Object value)(Code)
Coerces the value passed to InputElement.setText .

Default: convert null to an empty string.

Deriving note:
If you want to store the value in other type, say BigDecimal, you have to override InputElement.coerceToString and InputElement.coerceFromString to convert between a string and your targeting type.




getAreaText
public String getAreaText()(Code)
Returns the text for HTML AREA (Internal Use Only).

Used only for component generation. Not for applications.




getCols
public int getCols()(Code)
Returns the cols.

Default: 0 (non-positive means the same as browser's default).




getConstraint
final public Constraint getConstraint()(Code)



getErrorMessage
public String getErrorMessage()(Code)
Returns the error message that is caused when user entered invalid value, or null if no error at all.

The error message is set when user has entered a wrong value, or setValue is called with a wrong value. It is cleared once a correct value is assigned.

If the error message is set, we say this input is in the error mode. Any following invocation to InputElement.getText or getValue will throw any exception. Example, org.zkoss.zul.Textbox.getValue and org.zkoss.zul.Intbox.getValue .




getInnerAttrs
public String getInnerAttrs()(Code)



getMaxlength
public int getMaxlength()(Code)
Returns the maxlength.

Default: 0 (non-postive means unlimited).




getName
public String getName()(Code)
Returns the name of this component.

Default: null.

Don't use this method if your application is purely based on ZK's event-driven model.

The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.




getOuterAttrs
public String getOuterAttrs()(Code)



getRawText
public String getRawText()(Code)
Returns the text directly without checking whether any error message not yet fixed. In other words, it does NOT invoke InputElement.checkUserError .

Note: if the user entered an incorrect value (i.e., caused WrongValueException ), the incorrect value doesn't be stored so this method returned the last correct value.
See Also:   InputElement.getRawValue
See Also:   InputElement.getText




getRawValue
public Object getRawValue()(Code)
Returns the raw value directly with checking whether any error message not yet fixed. In other words, it does NOT invoke InputElement.checkUserError .

Note: if the user entered an incorrect value (i.e., caused WrongValueException ), the incorrect value doesn't be stored so this method returned the last correct value.
See Also:   InputElement.getRawText
See Also:   InputElement.getText
See Also:   InputElement.setRawValue




getTabindex
public int getTabindex()(Code)
Returns the tab order of this component.

Default: -1 (means the same as browser's default).




getTargetValue
protected Object getTargetValue() throws WrongValueException(Code)
Returns the value in the targeting type. It is used by the deriving class to implement the getValue method. For example, org.zkoss.zul.Intbox.getValue is the same as this method except with a different signature.

It invokes InputElement.checkUserError to ensure no user error.
exception:
  WrongValueException - if the user entered a wrong value
See Also:   InputElement.getText




getText
public String getText() throws WrongValueException(Code)
Returns the value in the String format. In most case, you shall use the setValue method instead, e.g., org.zkoss.zul.Textbox.getValue and org.zkoss.zul.Intbox.getValue .

It invokes InputElement.checkUserError to ensure no user error.

It invokes InputElement.coerceToString to convert the stored value into a string.
exception:
  WrongValueException - if user entered a wrong value




getType
public String getType()(Code)
Returns the type.

Default: text.




isAsapRequired
protected boolean isAsapRequired(String evtnm)(Code)
Returns whether to send back the request of the specified event immediately -- non-deferable. Returns true if you want the component (on the server) to process the event immediately.

Default: Besides super.isAsapRequired(evtnm), it also returns true if evtnm is Events.ON_CHANGE, InputElement.getConstraint is not null, and ClientConstraint.getClientValidation is null.




isChildable
public boolean isChildable()(Code)
Not childable.



isDisabled
public boolean isDisabled()(Code)
Returns whether it is disabled.

Default: false.




isMultiline
public boolean isMultiline()(Code)
Returns whether it is multiline.

Default: false.




isReadonly
public boolean isReadonly()(Code)
Returns whether it is readonly.

Default: false.




isValid
public boolean isValid()(Code)
Returns the current content of this input is correct. If the content is not correct, next call to the getvalue method will throws WrongValueException.



newExtraCtrl
protected Object newExtraCtrl()(Code)



onWrongValue
public WrongValueException onWrongValue(WrongValueException ex)(Code)



select
public void select()(Code)
Selects the whole text in this input.



setCols
public void setCols(int cols) throws WrongValueException(Code)
Sets the cols.



setConstraint
public void setConstraint(String constr)(Code)



setConstraint
public void setConstraint(Constraint constr)(Code)



setDisabled
public void setDisabled(boolean disabled)(Code)
Sets whether it is disabled.



setMaxlength
public void setMaxlength(int maxlength)(Code)
Sets the maxlength.



setName
public void setName(String name)(Code)
Sets the name of this component.

Don't use this method if your application is purely based on ZK's event-driven model.

The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Parameters:
  name - the name of this component.




setRawValue
public void setRawValue(Object value)(Code)
Sets the raw value directly. The caller must make sure the value is correct (or intend to be incorrect), because this method doesn't do any validation.

If you feel confusing with setValue, such as org.zkoss.zul.Textbox.setValue , it is usually better to use setValue instead. This method is reserved for developer that really want to set an 'illegal' value (such as an empty string to a textbox with no-empty contraint).

Note: since 3.0.1, the value will be re-validate again if InputElement.getText or others (such as org.zkoss.zul.Intbox.getValue ) is called. In other words, it is assumed that the specified value is not validated yet -- the same state when this component is created. If you want to avoid the re-valiation, you have to invoke InputElement.clearErrorMessage() .

Like setValue, the result is returned back to the server by calling InputElement.getText .
See Also:   InputElement.getRawValue




setReadonly
public void setReadonly(boolean readonly)(Code)
Sets whether it is readonly.



setSelectedText
public void setSelectedText(int start, int end, String newtxt, boolean isHighLight)(Code)
Sets the text of this InputElement to the specified text which is begining with the new start point and ending with the new end point.
Parameters:
  start - the start position of the text (included)
Parameters:
  end - the end position of the text (excluded)
Parameters:
  newtxt - the new text to be set.
Parameters:
  isHighLight - Sets whether it will represent highlihgt style or cursorstyle.If the start point same with the end point alwaysrepresent cursor style.



setSelectionRange
public void setSelectionRange(int start, int end)(Code)
Sets the selection end to the specified position and the selection start to the specified position. The new end point is constrained to be at or after the current selection start. If the new start point is different with the new end point, then will represent the result of highlight in this text.

Set both arguments to the same value to move the cursor to the corresponding position without selecting text.
Parameters:
  start - the start position of the text (included)
Parameters:
  end - the end position of the text (excluded)




setTabindex
public void setTabindex(int tabindex) throws WrongValueException(Code)
Sets the tab order of this component.



setText
public void setText(String value) throws WrongValueException(Code)
Sets the value in the String format. In most case, you shall use the setValue method instead, e.g., org.zkoss.zul.Textbox.setValue and org.zkoss.zul.Intbox.setValue .

It invokes InputElement.coerceFromString fisrt and then InputElement.validate . Derives might override them for type conversion and special validation.
Parameters:
  value - the value; If null, it is considered as empty.




setValueDirectly
protected void setValueDirectly(Object value)(Code)
Sets the value directly. Note: Unlike InputElement.setRawValue (nor setValue), this method assigns the value directly without clearing error message or synchronizing with the client.

It is usually used only the constructor. Though it is also OK to use InputElement.setRawValue in the constructor, this method has better performance.
since:
   3.0.3




showCustomError
protected WrongValueException showCustomError(WrongValueException ex)(Code)
Shows the error message in the custom way by calling ( CustomConstraint.showCustomError , if the contraint implements CustomConstraint .

Derived class shall call this method before throwing WrongValueException , such that the constraint, if any, has a chance to show the error message in a custom way.
Parameters:
  ex - the exception, or null to clean up the error. the exception (ex)




validate
protected void validate(Object value) throws WrongValueException(Code)
Validates the value returned by InputElement.coerceFromString .

Default: use InputElement.getConstraint 's Constraint.validate , if not null.

You rarely need to override this method.




Methods inherited from org.zkoss.zul.impl.XulElement
public String getAction()(Code)(Java Doc)
public String getActionAttrs()(Code)(Java Doc)
protected String getAllOnClickAttrs(boolean ignoreOnClick)(Code)(Java Doc)
public String getContext()(Code)(Java Doc)
public String getInnerAttrs()(Code)(Java Doc)
public String getOuterAttrs()(Code)(Java Doc)
public String getPopup()(Code)(Java Doc)
public String getTooltip()(Code)(Java Doc)
public void setAction(String action)(Code)(Java Doc)
public void setContext(String context)(Code)(Java Doc)
public void setContext(Popup popup)(Code)(Java Doc)
public void setPopup(String popup)(Code)(Java Doc)
public void setPopup(Popup popup)(Code)(Java Doc)
public void setTooltip(String tooltip)(Code)(Java Doc)
public void setTooltip(Popup popup)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.