Move Picture"
From Documentation
(1st Draft) |
|||
Line 35: | Line 35: | ||
} | } | ||
</source> | </source> | ||
− | |||
− | |||
View the complete source of ZUML [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/WebContent/config/movePicture.zul deletePicture.zul] | View the complete source of ZUML [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/WebContent/config/movePicture.zul deletePicture.zul] |
Revision as of 06:55, 11 November 2011
Available in ZK Spreadsheet EE only
Purpose
ZK Spreadsheet uses Range.movePicture (Picture, ClientAnchor) to move the position of the specified picture from the sheet.
ZUML
<window vflex="1" width="100%"
apply="org.zkoss.zssessentials.config.MovePictureComposer">
<spreadsheet id="myss" src="/WEB-INF/excel/config/MovePicture.xlsx" maxrows="200"
maxcolumns="40" vflex="1" width="100%">
</spreadsheet>
<button id="delete" label="Move All Pictures"/>
</window>
Composer
ZK Spreadsheet use Worksheet.getPictures() to retrieve all pictures in the sheet.
private Spreadsheet myss;
public void onClick$move(MouseEvent evt) throws Exception {
//move picture
Worksheet sheet = myss.getSelectedSheet();
Range rng = Ranges.range(sheet);
for(Picture pic : sheet.getPictures()) { //move picture down two rows
ClientAnchor anchor = pic.getPreferredSize();
anchor.setRow1(anchor.getRow1()+2);
anchor.setRow2(anchor.getRow2()+2);
rng.movePicture(pic, anchor);
}
}
View the complete source of ZUML deletePicture.zul
View the complete source of composer MovePictureComposer.java
Version History
Version | Date | Content |
---|---|---|
2.2.0 | Nov. 11, 2011 | API to move a picture |
All source code listed in this book is at Github.