Signature"

From Documentation
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Template:Smalltalk_Author|
+
{{ZKComponentReferencePageHeader}}
|author=Hawk Chen, Engineer, Potix Corporation
 
|date=2018
 
|version=ZK 8.6.0}}
 
  
__TOC__
+
= Signature =
 +
{{versionSince| 8.6.0}}
 +
{{ZK EE}}
  
 +
*Java API: <javadoc>org.zkoss.zkmax.zul.Signature</javadoc>
 +
*JavaScript API: <javadoc directory="jsdoc">zkmax.wgt.Signature</javadoc>
  
= Introduction =
+
= Browser Support =
Rich and reusable components are the main reason that people adopt ZK. In 8.6 release, we focus on making components more powerful, we create several new components for multimedia and enhance some components to support more features.  
+
*This component supports IE10+ and modern browsers.
  
Highlighted features:
+
= Employment/Purpose =
* 8 new components
+
Signature components support signature pad on the desktop and mobile browsers. User can customize pen size, pen color, background color etc., it also provides undo, save and clear methods.
* Compact theme
 
  
== Download and Demo ==
+
= Example =
<br />
+
[[File:Signature.png]]
<div style="float: left;"><imagelink link="http://www.zkoss.org/download/zk" image="/_w/images/0/00/Download-zk-7.png" /></div>
 
<div style="float: left"><imagelink link="http://www.zkoss.org/zkdemo/" image="/_w/images/6/68/Demo-zk-7.png" /></div>
 
<br />
 
<br />
 
<br />
 
<br />
 
<br />
 
<div style="height:70px; border-radius:5px;font-family: 'Didact Gothic', sans-serif; text-align:center; padding:5px; background-color: #0093f9;">
 
<h1 style="margin: 5px;padding-bottom: 15px;border:2px dashed #F7EEEE;color:#fff;">Highlighted Features</h1>
 
</div>
 
  
= Refresh Theme without Change - Compact Theme =
+
<source lang="xml" >
{{ZK All}}
+
<signature width="600px" height="300px" penColor="white" backgroundColor="#AED6F1" penSize="6"/>
The new default theme iceblue is great. But we also hear from some users' voice, we now build a compact theme to let you refresh your application's looking without modification.
+
</source>
  
Please check them at [https://www.zkoss.org/zk85themedemo/ Theme Demo]
+
== Buttons ==
  
 +
There are 3 buttons when you hover on this component: (from left to right)
  
= [[ZK_Component_Reference/Multimedia_and_Miscellaneous/Video|Video Player]] =
+
# '''undo''': to remove the last step that was drawn on the signature pad.
{{ZK All}}
+
# '''save''': to save the signature image to the server, a user can get the image by listening onSave event.
 +
# '''clear''': to clear signature pad.
  
[[Image:video-player.gif | center]]
+
= toolbarVisible =
  
With this component, you can build your own youtube or a online school.
+
The toolbar contains 3 buttons: undo button, clear button, and save button. They are visible by default. If you can hide them:
  
= [[ZK_Component_Reference/Input/Checkbox#Mold| Ios Style Switch and Toggle]] =
+
<source lang="xml">
<!-- http://tracker.zkoss.org/browse/ZK-3958 -->
+
<signature toolbarVisible="false"/>
{{ZK All}}
+
</source>
Checkbox supports 2 new molds:
 
== Ios Style Switch ==
 
[[File:checkbox-ios-style-switch.gif | center]]
 
  
== Toggle ==
+
The toolbar buttons only contain icons by default. If you want to show message after icons on the buttons, we provide three attributes: <code>undoLabel</code>, <code>clearLabel</code>, and <code>saveLabel</code>.
[[File:checkbox-toggle.gif | center]]
 
  
Check [[ZK%20Component%20Reference/Input/Checkbox| Component Reference]].
+
Default:
  
= [[ZK_Component_Reference/Input/Checkbox| 3 States Checkbox]] =
+
[[File:Signature toolbar.png]]
<!-- http://tracker.zkoss.org/browse/ZK-136 -->
 
{{ZK All}}
 
Checkbox supports intermediate states:
 
[[File:checkbox-3states.png | center]]
 
  
 +
Customized:
  
= [[ZK_Component_Reference/Input/Slider| Knob-like Slider]] =  
+
[[File:Signature toolbar2.png]]
<!-- http://tracker.zkoss.org/browse/ZK-3961 -->
+
<source lang="xml">
{{ZK All}}
+
<signature undoLabel="Undo" clearLabel="Clear" saveLabel="Save"/>
Set the mold attribute with <tt>knob</tt> will enable knob slider. So the slider can act as a normal knob. You can controll by wheel, drag, click and enter a value to the textbox in the center.
+
</source>
 
 
[[File:knob-slider.gif | center]]
 
  
 +
= Style Attributes =
  
= [[ZK%20Component%20Reference/Essential%20Components/Toolbar| Toolbar Accommodates More Buttons]] =
+
There are some attributes to adjust the signature style:
<!-- http://tracker.zkoss.org/browse/ZK-3179 -->
 
{{ZK All}}
 
When <tt>overflowPopup="true"</tt>, a toolbar will have a <tt>...</tt> symbol that shows a popup which contains those buttons weren't able to fit in the toolbar.
 
  
[[File:Toolbar-overflowPopup.gif | center]]
+
== penSize==
 +
the width of a line on the signature, the default is 1.
  
 +
== penColor ==
 +
Can be any color format accepted by context.fillStyle(canvas), defaults to black.
  
= Page Navigation Helper=  
+
== backgroundColor==  
<!-- http://tracker.zkoss.org/browse/ZK-4028 -->
+
Can be any color format accepted by context.fillStyle(canvas), defaults to white.
{{ZK All}}
 
  
= [[ZK%20Component%20Reference/Layouts/GoldenLayout| Multi-Screen Layout - Goldenlayout]] =  
+
== backgroundImage==  
<!-- http://tracker.zkoss.org/browse/ZK-3954 -->
+
{{versionSince| 9.6.0}}
{{ZK EE}}
+
Can be any image format accepted by context.drawImage(canvas), defaults to null.
  
GoldenLayout is a layout container which layouts panels as docker type. You can drag a panel to dock at 4 regions (north, east, south, west) or to stack on another panel. This component is suitable for building a workspace like interface.
+
= BackgroundIncluded =
 +
{{versionSince |9.6.0}}
  
[[File:goldenlayout.gif | center]]
+
The background color and image will be saved by default. If you don't want to save the background color and image, please use the following setting.
 
+
<source lang="xml">
 
+
<signature backgroundIncluded="false"/>
 
+
</source>
= [[ZK_Component_Reference/Multimedia_and_Miscellaneous/Camera| Take a Photo - Camera]] =
 
<!-- http://tracker.zkoss.org/browse/ZK-3930 -->
 
{{ZK EE}}
 
 
 
 
 
= [[ZK_Component_Reference/Multimedia_and_Miscellaneous/Camera|Record a Clip]] =
 
{{ZK EE}}
 
 
 
 
 
= [[ZK%20Component%20Reference/Layouts/Organigram| Show Your Organization - Organigram]] =
 
{{ZK EE}}
 
 
 
The component can render a organizational chart upon a <tt>TreeModel</tt>.
 
 
 
[[Image:organigram.gif | center]]
 
 
 
= [[ZK%20Component%20Reference/Input/Signature| Sign Here, Please]] =
 
<!-- http://tracker.zkoss.org/browse/ZK-3959 -->
 
{{ZK EE}}
 
 
 
[[File:sinature.gif | center]]
 
 
 
[[ZK_Component_Reference/Input/Signature| Signature]] supports singature pad on the desktop and mobile browsers. Developers can setup pen size, pen color, and background color etc. Users can undo, save and clear their signatres.
 
 
 
= [[ZK%20Component%20Reference/Essential%20Components/Rating| Give Me a Rating]] =
 
<!-- http://tracker.zkoss.org/browse/ZK-3960 -->
 
{{ZK EE}}
 
  
[[File:rating.gif | center]]
+
== Scanned Paper Form==
 +
You can load a scanned paper form as a background and save it with a signature.
 +
[[File:Paper-form.jpg|center]]
  
 +
= Saves Signature Image =
  
= [[ZK%20Component%20Reference/Multimedia%20and%20Miscellaneous/Cropper| Crop a Uploaded Image]] =
+
After clicking "Save" button, the component will upload the signature to a server. You can listen <code>onSave</code> to get the uploaded signature and show it with [https://www.zkoss.org/wiki/ZK_Component_Reference/Essential_Components/Image Image]:
<!-- http://tracker.zkoss.org/browse/ZK-3962 -->
 
{{ZK EE}}
 
  
[[File:cropper.gif | center]]
+
<source lang="xml">
 
+
<signature onSave="image.setContent(event.getMedia())"/>
= [[ZK%20Component%20Reference/Multimedia%20and%20Miscellaneous/Barcode| Display]] and Scan a Barcode =
+
<image id="image"/>
{{ZK EE}}
 
 
 
 
 
<br/>
 
<div style="height:70px; border-radius:5px;font-family: 'Didact Gothic', sans-serif; text-align:center; padding:5px; background-color: #0093f9;">
 
<h1 style="margin: 5px;padding-bottom: 15px;border:2px dashed #F7EEEE;color:#fff;">Other Enhancements</h1>
 
</div>
 
 
 
 
 
= [[ZK%20Component%20Reference/Essential%20Components/Menu/Menupopup| Guide Users with a Pop-up Menuitem]] =
 
{{ZK All}}
 
 
 
If you want to guide new users to click a menuitem or open a menupopup for them, ZK provide a method to pop up the menuitem in front of users.
 
 
 
[[File:menuitem-setactive.gif | center]]
 
 
 
<source lang='java'>
 
menu.getMenupopup().setActive(i);
 
 
</source>
 
</source>
  
= Web Fragment =
+
== File Size Limit ==  
 
+
If you see <code>SizeLimitExceededException</code>, you can adjust max uploading file size by
= Improved Rendering Speed =  
+
[[ZK_Configuration_Reference/zk.xml/The_system-config_Element/The_max-upload-size_Element | file-size-threshold]].
<!--
 
http://tracker.zkoss.org/browse/ZK-3978
 
http://tracker.zkoss.org/browse/ZK-3986
 
-->
 
 
 
We improve the rendering speed when opening a tree node and a model change of a chosenbox.
 
 
 
= Summary =
 
ZK is made by Java developers for Java developers; continue bringing technology innovations to enterprise Java web development has always been our top priority. ZK 8.5 provides a great balance between the required server-side simplicity, security, and integrity and the client-side usability, look, and feel. <br/>Join us this fall and harvest Javascript from Java roots!
 
<br />
 
<br/>
 
  
<div style="float: left;"><imagelink link="http://www.zkoss.org/download/zk" image="/_w/images/0/00/Download-zk-7.png" /></div>
+
=Supported Events=
  
<br />
+
{| class='wikitable' | width="100%"
<br/>
+
! <center>Name</center>
<br/>
+
! <center>Event Type</center>
 +
|-
 +
| <center>onSave</center>
 +
| '''Event:''' <javadoc>org.zkoss.zk.ui.event.UploadEvent</javadoc>
 +
When user invoke the save method, the event would be triggered.
 +
|-
 +
| <center>onClear</center>
 +
| '''Event:''' <javadoc>org.zkoss.zk.ui.event.Event</javadoc>
 +
When user invoke the clear method, the event would be triggered.
 +
|}
  
ZK grows with you. Feel free to [https://www.zkoss.org/support/about/contact share with us] your feedback or suggestion.
+
=Version History=
 +
{{LastUpdated}}
 +
{| class='wikitable' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| 8.6.0
 +
| August 2018
 +
|
 +
|}
  
{{Template:CommentedSmalltalk_Footer_new|
+
{{ZKComponentReferencePageFooter}}
|name=Potix Corporation
 
}}
 

Latest revision as of 10:15, 19 September 2022

Signature

Since 8.6.0

  • Available for ZK:
  • http://www.zkoss.org/product/zkhttp://www.zkoss.org/whyzk/zkeeVersion ee.png

Browser Support

  • This component supports IE10+ and modern browsers.

Employment/Purpose

Signature components support signature pad on the desktop and mobile browsers. User can customize pen size, pen color, background color etc., it also provides undo, save and clear methods.

Example

Signature.png

<signature width="600px" height="300px" penColor="white" backgroundColor="#AED6F1" penSize="6"/>

Buttons

There are 3 buttons when you hover on this component: (from left to right)

  1. undo: to remove the last step that was drawn on the signature pad.
  2. save: to save the signature image to the server, a user can get the image by listening onSave event.
  3. clear: to clear signature pad.

toolbarVisible

The toolbar contains 3 buttons: undo button, clear button, and save button. They are visible by default. If you can hide them:

<signature toolbarVisible="false"/>

The toolbar buttons only contain icons by default. If you want to show message after icons on the buttons, we provide three attributes: undoLabel, clearLabel, and saveLabel.

Default:

Signature toolbar.png

Customized:

Signature toolbar2.png

<signature undoLabel="Undo" clearLabel="Clear" saveLabel="Save"/>

Style Attributes

There are some attributes to adjust the signature style:

penSize

the width of a line on the signature, the default is 1.

penColor

Can be any color format accepted by context.fillStyle(canvas), defaults to black.

backgroundColor

Can be any color format accepted by context.fillStyle(canvas), defaults to white.

backgroundImage

Since 9.6.0 Can be any image format accepted by context.drawImage(canvas), defaults to null.

BackgroundIncluded

Since 9.6.0

The background color and image will be saved by default. If you don't want to save the background color and image, please use the following setting.

<signature backgroundIncluded="false"/>

Scanned Paper Form

You can load a scanned paper form as a background and save it with a signature.

Paper-form.jpg

Saves Signature Image

After clicking "Save" button, the component will upload the signature to a server. You can listen onSave to get the uploaded signature and show it with Image:

	<signature onSave="image.setContent(event.getMedia())"/>
	<image id="image"/>

File Size Limit

If you see SizeLimitExceededException, you can adjust max uploading file size by file-size-threshold.

Supported Events

Name
Event Type
onSave
Event: UploadEvent

When user invoke the save method, the event would be triggered.

onClear
Event: Event

When user invoke the clear method, the event would be triggered.

Version History

Last Update : 2022/09/19


Version Date Content
8.6.0 August 2018



Last Update : 2022/09/19

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