Toolbar

From Documentation
Revision as of 07:32, 3 April 2012 by Samchuang (talk | contribs)

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!



Purpose

ZK Spreadsheet supports various toolbar buttons for user to perform actions.

Show toolbar

Use Spreadsheet.setShowToolbar to show toolbar.

Action Handler

The Spreadsheet use a default ActionHandler to perform toolbar button's action. Developer could use customized ActionHandler by API Spreadsheet.setActionHandler or by library property org.zkoss.zss.ui.ActionHandler.class, refer to sample zk.xml

Each toolbar's button represent a action, the ActionHandler process action when user click it.


For example, the paste button represent Action.PASTE, deveoper could override default behavior by

public void doPaste(Rect selection) {
 //override
}


ZKSsEss Spreadsheet Toolbar paste.png
File:ZKSsEss Spreadsheet Toolbar pasteMenuitem.png

New book

The default Action Handler


ZUML

Here is a sample example ZUL file

<zk>
	<window vflex="1" width="100%" apply="org.zkoss.zssessentials.config.ToolbarComposer">
		<button id="toggleToolbar" label="Toggle toolbar"/>
		<spreadsheet showToolbar="true"
			id="ss" vflex="true" width="100%"
			src="/WEB-INF/excel/config/ZSS-demo_sample.xlsx" maxcolumns="40" maxrows="200"
			></spreadsheet>
	</window>
</zk>