Suggested case list:
Using timer to refresh a grid
383guest172.69.33.12125nk0uiMay 7, 2020 7:23:47 AMlinkuser model to move item to another listbox
120guest162.158.193.148d0n3krApr 2, 2020 5:28:28 AMlinkDisabled list item row passed to VM-1981
296fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:44 PMlinkDisabled list item row passed to VM-1981
295fatih123160.83.36.13025nk0uiFeb 13, 2018 4:25:16 PMlinkDisabled list item row passed to VM-1981
294fatih123160.83.36.13225nk0uiFeb 13, 2018 3:30:44 PMlinkgrid sample with ListModel/RowRenderer
816guest80.82.2.1312vah9ajFeb 21, 2017 11:42:21 AMlinkgrid sample with ListModel/RowRenderer
809guest175.98.113.1622vah9ajJan 26, 2017 9:19:33 AMlinkgrid sample with ListModel/RowRenderer
196guest79.185.142.402vah9ajApr 26, 2014 10:53:57 PMlinkgrid sample with ListModel/RowRenderer
195guest79.185.142.402vah9ajApr 26, 2014 10:53:54 PMlinkgrid sample with ListModel/RowRenderer
194guest79.185.142.402vah9ajApr 26, 2014 10:53:51 PMlinkgrid sample with ListModel/RowRenderer
193guest79.185.142.402vah9ajApr 26, 2014 10:53:48 PMlinkgrid sample with ListModel/RowRenderer
192guest79.185.142.402vah9ajApr 26, 2014 10:53:44 PMlinkgrid sample with ListModel/RowRenderer
191guest79.185.142.402vah9ajApr 26, 2014 10:53:40 PMlinkHierarchy table without using ZK PE/EE
1aaknai151.28.135.2131s871daJul 29, 2013 11:02:46 PMlinkgrid sample with ListModel/RowRenderer
128aaknai151.28.135.2132vah9ajJul 29, 2013 7:20:00 PMlinkuser model to move item to another listbox
1TonyQ114.25.109.94d0n3krApr 21, 2012 10:43:27 AMlinkUsing timer to refresh a grid
1TonyQ220.133.44.3725nk0uiFeb 17, 2012 3:17:34 AMlinkFire a event from child iframe
1TonyQ220.133.44.372eupjotFeb 3, 2012 5:04:52 AMlinkTextbox input restriction sample
1TonyQ72.21.245.2431b3nlr0Dec 20, 2011 10:09:10 AMlinkTest web core taglib in ZUL
1TonyQ198.203.175.175ofqkemDec 17, 2011 3:36:08 AMlinkLatest 10 Fiddles :
Another new ZK fiddle
31guest172.70.131.691mlke7fOct 3, 2023 6:27:23 PMlinkAnother new ZK fiddle
30guest172.70.178.1641mlke7fOct 3, 2023 6:26:11 PMlinkAnother new ZK fiddle
29guest172.70.178.1641mlke7fOct 3, 2023 6:26:09 PMlinkAnother new ZK fiddle
28guest172.70.100.1751mlke7fOct 3, 2023 6:24:37 PMlinkAnother new ZK fiddle
27guest108.162.216.1141mlke7fOct 3, 2023 6:13:35 PMlinkAnother new ZK fiddle
26guest172.70.179.1001mlke7fOct 3, 2023 6:08:44 PMlinkAnother new ZK fiddle
25guest172.70.179.991mlke7fOct 3, 2023 6:08:32 PMlinkAnother new ZK fiddle
24guest172.70.179.1001mlke7fOct 3, 2023 6:07:56 PMlinkAnother new ZK fiddle
23guest172.69.59.721mlke7fOct 3, 2023 6:06:42 PMlinkAnother new ZK fiddle
22guest172.70.178.1521mlke7fOct 3, 2023 6:04:10 PMlinkTextbox Search type attribute
4guest172.70.214.951maq2shJul 1, 2022 7:23:15 AMlinkresources
index.zulzul<zk xmlns:w="client" xmlns:ca="client/attribute">
<script><![CDATA[
zk.afterLoad("zul.inp", function () {
zul.inp.TextboxSearch = zk.$extends(zul.inp.Textbox, {
bind_: function() {
var result = this.$supers('bind_', arguments);
this.$n().type='search';
return result;
}
});
});
]]></script>
<div>
<textbox ca:type="search" />
<textbox w:use="zul.inp.TextboxSearch" />
<textbox use="pkg$.TextboxSearch" type="search"/>
</div>
</zk>TextboxSearch.javajava/* Textbox.java
Purpose:
Description:
History:
Tue Jun 14 15:48:28 2005, Created by tomyeh
Copyright (C) 2005 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under LGPL Version 2.1 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
import java.util.HashMap;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.UiException;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.sys.BooleanPropertyAccess;
import org.zkoss.zk.ui.sys.IntPropertyAccess;
import org.zkoss.zk.ui.sys.PropertyAccess;
import org.zkoss.zk.ui.sys.StringPropertyAccess;
import org.zkoss.zul.impl.InputElement;
/**
* A textbox.
*
* <p>See <a href="package-summary.html">Specification</a>.</p>
* <p>Default {@link #getZclass}: z-textbox.(since 3.5.0)</p>
* <p>When multiline is true, only default mold is available.<p>
* @author tomyeh
*/
public class TextboxSearch extends InputElement {
private AuxInfo _auxinf;
public TextboxSearch() {
setValueDirectly("");
}
public TextboxSearch(String value) throws WrongValueException {
setValue(value);
}
/** Returns the value.
* The same as {@link #getText}.
* <p>Default: "".
* @exception WrongValueException if user entered a wrong value
*/
public String getValue() throws WrongValueException {
return getText();
}
/** Sets the value.
*
* @param value the value; If null, it is considered as empty.
* @exception WrongValueException if value is wrong
*/
public void setValue(String value) throws WrongValueException {
setText(value);
}
//-- super --//
/** Coerces the value passed to {@link #setValue}.
*
* <p>Default: convert null to an empty string.
*/
protected Object coerceFromString(String value) throws WrongValueException {
return value != null ? value : "";
}
/** Coerces the value passed to {@link #setValue}.
*
* <p>Default: convert null to an empty string.
*/
protected String coerceToString(Object value) {
return value != null ? (String) value : "";
}
/** Returns the type.
* <p>Default: text.
*/
public String getType() {
return _auxinf != null ? _auxinf.type : TEXT;
}
/** Sets the type.
* @param type the type. Acceptable values are "text" and "password".
* Unlike XUL, "timed" is redundant because it is enabled as long as
* onChanging is added. Since 6.5.0 type also support tel, email and url.
*/
public void setType(String type) throws WrongValueException {
if (!TEXT.equals(type) && !"password".equals(type) && !"tel".equals(type) && !"email".equals(type)
&& !"url".equals(type) && !"search".equals(type))
throw new WrongValueException("Illegal type: " + type);
if (!type.equals(_auxinf != null ? _auxinf.type : TEXT)) {
initAuxInfo().type = type;
smartUpdate("type", getType());
}
}
/** Returns the rows.
* <p>Default: 1.
*/
public int getRows() {
return _auxinf != null ? _auxinf.rows : 1;
}
/** Sets the rows.
* <p>
* Note: Not allowed to set rows and height/vflex at the same time
*/
public void setRows(int rows) throws WrongValueException {
checkBeforeSetRows();
if (rows <= 0)
throw new WrongValueException("Illegal rows: " + rows);
if ((_auxinf != null ? _auxinf.rows : 1) != rows) {
initAuxInfo().rows = rows;
if (rows > 1)
setMultiline(true); //auto-enable
smartUpdate("rows", getRows());
}
}
/**
* Internal check if there is any use of vflex and height before setRows
*/
protected void checkBeforeSetRows() throws UiException { //ZK-4296: Error indicating incorrect usage when using both vflex and rows
if (this.getVflex() != null)
throw new UiException("Not allowed to set rows and vflex at the same time");
if (this.getHeight() != null)
throw new UiException("Not allowed to set rows and height at the same time");
}
/** Returns whether it is multiline.
* <p>Default: false.
*/
public boolean isMultiline() {
return _auxinf != null && _auxinf.multiline;
}
/** Sets whether it is multiline.
*/
public void setMultiline(boolean multiline) {
if ((_auxinf != null && _auxinf.multiline) != multiline) {
initAuxInfo().multiline = multiline;
smartUpdate("multiline", isMultiline());
}
}
/** Returns whether TAB is allowed.
* If true, the user can enter TAB in the textbox, rather than change
* focus.
* <p>Default: false.
* @since 3.6.0
*/
public boolean isTabbable() {
return _auxinf != null && _auxinf.tabbable;
}
/** Sets whether TAB is allowed.
* If true, the user can enter TAB in the textbox, rather than change
* focus.
* <p>Default: false.
* @since 3.6.0
*/
public void setTabbable(boolean tabbable) {
if ((_auxinf != null && _auxinf.tabbable) != tabbable) {
initAuxInfo().tabbable = tabbable;
smartUpdate("tabbable", isTabbable());
}
}
/** Returns whether it is submitByEnter,
* If submitByEnter is true, press enter will fire onOK event instead of move to next line,
* you should press shift + enter if you want to move to next line.
* <p>Default: false.
* @return true if it is submitByEnter.
* @since 8.5.2
*/
public boolean isSubmitByEnter() {
return _auxinf != null && _auxinf.submitByEnter;
}
/** Sets whether it is submitByEnter.
* If submitByEnter is true, press enter will fire onOK event instead of move to next line,
* you should press shift + enter if you want to move to next line.
* @param submitByEnter whether it is submitByEnter
* @since 8.5.2
*/
public void setSubmitByEnter(boolean submitByEnter) {
if ((_auxinf != null && _auxinf.submitByEnter) != submitByEnter) {
initAuxInfo().submitByEnter = submitByEnter;
smartUpdate("submitByEnter", isSubmitByEnter());
}
}
@Override
public void setVflex(String flex) { //ZK-4296: Error indicating incorrect usage when using both vflex and rows
if (this.getRows() != 1)
throw new UiException("Not allowed to set vflex and rows at the same time");
super.setVflex(flex);
}
@Override
public void setHeight(String height) { //ZK-4296: Error indicating incorrect usage when using both vflex and rows
if (this.getRows() != 1)
throw new UiException("Not allowed to set height and rows at the same time");
super.setHeight(height);
}
//Cloneable//
public Object clone() {
final TextboxSearch clone = (TextboxSearch) super.clone();
if (_auxinf != null)
clone._auxinf = (AuxInfo) _auxinf.clone();
return clone;
}
//--ComponentCtrl--//
private static HashMap<String, PropertyAccess> _properties = new HashMap<String, PropertyAccess>(5);
static {
_properties.put("value", new StringPropertyAccess() {
public void setValue(Component cmp, String value) {
((TextboxSearch) cmp).setValue(value);
}
public String getValue(Component cmp) {
return ((TextboxSearch) cmp).getValue();
}
});
_properties.put("type", new StringPropertyAccess() {
public void setValue(Component cmp, String value) {
((TextboxSearch) cmp).setType(value);
}
public String getValue(Component cmp) {
return ((TextboxSearch) cmp).getType();
}
});
_properties.put("tabbable", new BooleanPropertyAccess() {
public void setValue(Component cmp, Boolean value) {
((TextboxSearch) cmp).setTabbable(value);
}
public Boolean getValue(Component cmp) {
return ((TextboxSearch) cmp).isTabbable();
}
});
_properties.put("rows", new IntPropertyAccess() {
public void setValue(Component cmp, Integer value) {
((TextboxSearch) cmp).setRows(value);
}
public Integer getValue(Component cmp) {
return ((TextboxSearch) cmp).getRows();
}
});
_properties.put("multiline", new BooleanPropertyAccess() {
public void setValue(Component cmp, Boolean multiline) {
((TextboxSearch) cmp).setMultiline(multiline);
}
public Boolean getValue(Component cmp) {
return ((TextboxSearch) cmp).isMultiline();
}
});
_properties.put("submitByEnter", new BooleanPropertyAccess() {
public void setValue(Component cmp, Boolean submitByEnter) {
((TextboxSearch) cmp).setSubmitByEnter(submitByEnter);
}
public Boolean getValue(Component cmp) {
return ((TextboxSearch) cmp).isSubmitByEnter();
}
});
}
public PropertyAccess getPropertyAccess(String prop) {
PropertyAccess pa = _properties.get(prop);
if (pa != null)
return pa;
return super.getPropertyAccess(prop);
}
//-- super --//
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException {
super.renderProperties(renderer);
render(renderer, "multiline", isMultiline());
final int rows = getRows();
if (rows > 1)
renderer.render("rows", rows);
render(renderer, "tabbable", isTabbable());
final String type = getType();
if (!TEXT.equals(type))
renderer.render("type", type);
render(renderer, "submitByEnter", isSubmitByEnter());
}
public String getZclass() {
return _zclass != null ? _zclass : "z-textbox";
}
private static final String TEXT = "text";
private AuxInfo initAuxInfo() {
if (_auxinf == null)
_auxinf = new AuxInfo();
return _auxinf;
}
private static class AuxInfo implements java.io.Serializable, Cloneable {
private String type = TEXT;
private int rows = 1;
private boolean multiline;
private boolean tabbable;
private boolean submitByEnter;
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new InternalError();
}
}
}
}