Context Menu"
m |
m |
||
Line 20: | Line 20: | ||
Refer to [http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials/Working_with_ZK_Spreadsheet/Configure_and_Control_ZK_Spreadsheet/Toolbar#Paste_Special here] | Refer to [http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials/Working_with_ZK_Spreadsheet/Configure_and_Control_ZK_Spreadsheet/Toolbar#Paste_Special here] | ||
=====Format Cell===== | =====Format Cell===== | ||
+ | |||
+ | [[File:ZKSsEss_Spreadsheet_Toolbar_rowContextMenu_formatCell.png]] | ||
<br/>The default ActionHandler does nothing when user click the button, developer could override <javadoc directory="zss" method="doFormatCell">org.zkoss.zss.ui.sys.ActionHandler</javadoc> | <br/>The default ActionHandler does nothing when user click the button, developer could override <javadoc directory="zss" method="doFormatCell">org.zkoss.zss.ui.sys.ActionHandler</javadoc> | ||
Line 36: | Line 38: | ||
=====Row Height===== | =====Row Height===== | ||
+ | |||
+ | [[File:ZKSsEss_Spreadsheet_Toolbar_rowContextMenu_rowHeight.png]] | ||
+ | <br/>The default ActionHandler does nothing when user click the button, developer could override <javadoc directory="zss" method="doRowHeight">org.zkoss.zss.ui.sys.ActionHandler</javadoc> | ||
+ | |||
+ | <source lang="java" high="2"> | ||
+ | @Override | ||
+ | public void doRowHeight(Rect selection) { | ||
+ | Spreadsheet spreadsheet = getSpreadsheet(); | ||
+ | if (spreadsheet.getBook() != null && validSelection(selection)) { | ||
+ | HeaderSizeDialog dialog = new HeaderSizeDialog("row", selection); | ||
+ | //omit | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | Refer to sample code [http://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/WebContent/config/headerSizeDialog.zul headerSizeDialog.zul] and [http://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/src/org/zkoss/zssessentials/config/CustomizedActionHandler.java CustomizedActionHandler.java] | ||
====Column==== | ====Column==== |
Revision as of 01:33, 5 April 2012
Purpose
ZK Spreadsheet supports various context menu for user to perform actions.
Show Context Menu
Use Spreadsheet.setShowContextMenu to show context menu.
Row
Row context menu also use ActionHandler for each button/menuitem. Note the default ActionHandler does nothing when user click Paste Special, Format Cell and Row Height
Paste Special
Refer to here
Format Cell
File:ZKSsEss Spreadsheet Toolbar rowContextMenu formatCell.png
The default ActionHandler does nothing when user click the button, developer could override ActionHandler.doFormatCell
@Override
public void doFormatCell(Rect selection) {
Spreadsheet spreadsheet = getSpreadsheet();
if (spreadsheet.getBook() != null && validSelection(selection)) {
FormatDialog dialog = new FormatDialog(selection);
//omit
}
}
Refer to sample code formatDialog.zul and CustomizedActionHandler.java
Row Height
File:ZKSsEss Spreadsheet Toolbar rowContextMenu rowHeight.png
The default ActionHandler does nothing when user click the button, developer could override ActionHandler.doRowHeight
@Override
public void doRowHeight(Rect selection) {
Spreadsheet spreadsheet = getSpreadsheet();
if (spreadsheet.getBook() != null && validSelection(selection)) {
HeaderSizeDialog dialog = new HeaderSizeDialog("row", selection);
//omit
}
}
Refer to sample code headerSizeDialog.zul and CustomizedActionHandler.java
Column
Paste Special
Format Cell
Column Width
Cell
Paste Special
Format Cell
Hyperlink
ZUML
Here is a sample example ZUL file
<zk>
<window vflex="1" width="100%" apply="org.zkoss.zssessentials.config.ContextMenuComposer">
<button id="toggleContextMenu" label="Toggle Context Menu"/>
<spreadsheet showContextMenu="true"
id="ss" vflex="true" width="100%"
src="/WEB-INF/excel/config/ZSS-demo_sample.xlsx" maxcolumns="40" maxrows="200"
></spreadsheet>
</window>
</zk>
Version History
Version | Date | Content |
---|---|---|
2.3.0 | April, 2012 | Context Menu |
All source code listed in this book is at Github.