Move Picture"

From Documentation
m (correct highlight (via JWB))
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{ZKSpreadsheetEssentialsPageHeader}}
 
{{ZKSpreadsheetEssentialsPageHeader}}
 +
 +
{{Deprecated|url=http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials}}
 +
 +
 
{{ZSS EE}}
 
{{ZSS EE}}
  
Line 8: Line 12:
  
 
===ZUML===
 
===ZUML===
<source lang="xml" high="6">
+
<source lang="xml" highlight="6">
 
<window vflex="1" width="100%"  
 
<window vflex="1" width="100%"  
 
apply="org.zkoss.zssessentials.config.MovePictureComposer">
 
apply="org.zkoss.zssessentials.config.MovePictureComposer">
Line 14: Line 18:
 
         maxcolumns="40" vflex="1" width="100%">
 
         maxcolumns="40" vflex="1" width="100%">
 
     </spreadsheet>
 
     </spreadsheet>
     <button id="delete" label="Move All Pictures"/>
+
     <button id="move" label="Move All Pictures"/>
 
</window>
 
</window>
 
</source>
 
</source>
Line 20: Line 24:
 
===Composer===
 
===Composer===
 
ZK Spreadsheet use <javadoc directory="zss" method="getPictures()">org.zkoss.zss.model.Worksheet</javadoc> to retrieve all pictures in the sheet.
 
ZK Spreadsheet use <javadoc directory="zss" method="getPictures()">org.zkoss.zss.model.Worksheet</javadoc> to retrieve all pictures in the sheet.
<source lang="java" high="7">
+
<source lang="java" highlight="7">
 
private Spreadsheet myss;
 
private Spreadsheet myss;
 
 
Line 36: Line 40:
 
</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 movePicture.zul]
  
 
View the complete source of composer [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/src/org/zkoss/zssessentials/config/MovePictureComposer.java MovePictureComposer.java]
 
View the complete source of composer [https://code.google.com/p/zkbooks/source/browse/trunk/zssessentials/examples/src/org/zkoss/zssessentials/config/MovePictureComposer.java MovePictureComposer.java]

Latest revision as of 12:56, 19 January 2022


Stop.png This article is out of date, please refer to http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials for more up to date information.


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="move" 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 movePicture.zul

View the complete source of composer MovePictureComposer.java

Version History

Last Update : 2022/01/19


Version Date Content
2.2.0 Nov. 11, 2011 API to move a picture
     


All source code listed in this book is at Github.


Last Update : 2022/01/19

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