Timepicker"

From Documentation
Line 24: Line 24:
  
 
=Properties=
 
=Properties=
 
== Constraint ==
 
You could specify what value to accept for input controls by use of the <tt>constraint </tt>property.
 
It could be <tt>no empty</tt>.
 
 
If you prefer to display different message to the default one, you can append the error message to the constraint with a colon.
 
 
<source lang="xml" >
 
<timebox constraint="no empty: cannot be empty"/>
 
</source>
 
 
Notes:
 
* The error message, if specified, must be the last element and start with colon.
 
* To support multiple languages, you could use the 「l」 function as depicted in the '''Internationalization''' chapter.
 
 
<source lang="xml" >
 
<timebox constraint="no empty: ${c:l('err.time.required')}"/>
 
</source>
 
  
 
== Format ==
 
== Format ==
Line 52: Line 34:
 
<zk>
 
<zk>
 
<window title="Test">
 
<window title="Test">
<timebox cols="20" format="a hh:mm:ss"/>
+
<timepicker format="a hh:mm:ss"/>
 
</window>
 
</window>
 
</zk></source>
 
</zk></source>
  
In addition to specifying the format explicitly, you could specify the styling<ref>The styling is available since 5.0.7</ref>. There are four different types of styling: short, medium, long and full (representing the styling of java.text.DateFormat). For example, you could specify the styling rather than the real format as follows.
+
In addition to specifying the format explicitly, you could specify the styling<ref>The styling is available since 5.0.7</ref>. There are two different types of styling: short, medium (representing the styling of java.text.DateFormat). For example, you could specify the styling rather than the real format as follows.
  
 
<source lang="xml">
 
<source lang="xml">
<timebox format="short"/>
+
<timepicker format="short"/>
<timebox format="long"/>
+
<timepicker format="medium"/>
 
</source>
 
</source>
  
Then the real format of the timebox will be decided at run time depending the configuration. For more information, please refer to [[ZK Developer's Reference/Internationalization/Date and Time Formatting|ZK Developer's Reference: Date and Time Formatting]].
+
Then the real format of the timepicker will be decided at run time depending the configuration. For more information, please refer to [[ZK Developer's Reference/Internationalization/Date and Time Formatting|ZK Developer's Reference: Date and Time Formatting]].
  
 
<blockquote>
 
<blockquote>
Line 70: Line 52:
 
</blockquote>
 
</blockquote>
  
== Locale ==
+
== min ==
By default, the real format depends on the current locale (i.e., <javadoc method="getCurrent()">org.zkoss.util.Locales</javadoc>. However, you could specify the locale for an individual instance such as:
+
By default, the options of timepicker start at 0:00 AM, you could specify another minimum time by using a java.util.Date Object.
 +
 
 +
<source lang="xml">
 +
<zscript>
 +
import java.util.Date;
 +
Date min = new Date();
 +
min.setTime(0);
 +
</zscript>
 +
<timepicker format="HH:mm a" min="${min}" />
 +
</source>
 +
 
 +
== max ==
 +
By default, the options of timepicker end before 12:00 AM, you could specify another maximum time by using a java.util.Date Object.
 +
 
 +
<source lang="xml">
 +
<zscript>
 +
import java.util.Date;
 +
Date max = new Date();
 +
max.setTime(0);
 +
</zscript>
 +
<timepicker format="HH:mm a" max="${min}" />
 +
</source>
 +
 
 +
== interval ==
 +
By default, the interval of the options in timepicker is one hour, you could specify the interval by using an integer (unit: 1 second).
  
 
<source lang="xml">
 
<source lang="xml">
<timebox format="medium" locale="de_DE"/>
+
<timepicker format="HH:mm a" interval="600" />
<timebox format="long" locale="fr"/>
 
 
</source>
 
</source>
  

Revision as of 08:44, 13 May 2015

Timepicker

Employment/Purpose

A selection box for holding a time (a java.util.Date Object) , but only Hour, Minute, and Second are used.

Example

ZKCompRef Timebox.png


 <window title="Simple" width="300px" border="normal">
     <timebox id="tb0"/>
 </window>


Properties

Format

Use a to signify it is am or pm. The input string follows the formatting of the SimpleDateFormat.

Below is an example of using a within the format.

<zk>
	<window title="Test">
		<timepicker format="a hh:mm:ss"/>
	</window>
</zk>

In addition to specifying the format explicitly, you could specify the styling[1]. There are two different types of styling: short, medium (representing the styling of java.text.DateFormat). For example, you could specify the styling rather than the real format as follows.

<timepicker format="short"/>
<timepicker format="medium"/>

Then the real format of the timepicker will be decided at run time depending the configuration. For more information, please refer to ZK Developer's Reference: Date and Time Formatting.


  1. The styling is available since 5.0.7

min

By default, the options of timepicker start at 0:00 AM, you could specify another minimum time by using a java.util.Date Object.

<zscript>
	import java.util.Date;
	Date min = new Date();
	min.setTime(0);
</zscript>
<timepicker format="HH:mm a" min="${min}" />

max

By default, the options of timepicker end before 12:00 AM, you could specify another maximum time by using a java.util.Date Object.

<zscript>
	import java.util.Date;
	Date max = new Date();
	max.setTime(0);
</zscript>
<timepicker format="HH:mm a" max="${min}" />

interval

By default, the interval of the options in timepicker is one hour, you could specify the interval by using an integer (unit: 1 second).

<timepicker format="HH:mm a" interval="600" />

Inherited Functions

Please refer to FormatInputElement for inherited functions.

Supported Events

Name
Event Type
None None

Supported Molds

Available molds of a component are defined in lang.xml embedded in zul.jar.

Name
Snapshot
default
Timebox mold default.png
rounded
Timebox mold rounded.png
[Since 5.0.0]

Supported Children

*NONE

Use Cases

Version Description Example Location
     

Version History

Last Update : 2015/05/13


Version Date Content
     


Last Update : 2015/05/13

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.