-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am new to zk and want to implement the spreadsheet like features in my statement:
1) Un-limited Undo's
2) arrow keyboard navigations
3) re-sizable columns
4)freeze columns
5)copy-paste
I tried looking up samples and have following sample code:
index.zul
<window apply="org.zkdemo.controller.SpreadSheetDemoComposer">
<spreadsheet id="balance" src="/SpreadSheetDemo.xls" maxrows="20"
maxcolumns="20" height="600px" width="800px" ctrlKeys="^c^v^x^z^y" />
<menupopup id="cellMenu">
<menuitem id="cutMenu" label="Cut" />
<menuitem id="copyMenu" label="Copy" />
<menuitem id="pasteMenu" label="Paste" />
<menuitem id="undoMenu" label="Undo"/>
<menuitem id="redoMenu" label="Redo"/>
</menupopup>
</window>
Java Class contain following related methods:
public void onClick$undoMenu(){
onUndo();
}
public void onClick$redoMenu(){
onRedo();
}
/**
* Execute cut copy or paste using key control
* @param evt
*/
public void onCtrlKey$balance(KeyEvent evt) {
if (evt.isCtrlKey()) {
switch (evt.getKeyCode()) {
case 'C':
onCopy();
break;
case 'V':
onPaste();
break;
case 'X':
onCut();
break;
case 'Z':
onUndo();
break;
case 'Y':
onRedo();
break;
}
}
}
private void onUndo(){
// What should i write here to get the undo feature implemented.
System.out.println("UNDOooo");
}
private void onRedo(){
// What should i write here to get the redo feature implemented.
System.out.println("Redooo");
}
Please provide the valuable inputs. Thanks !
Asked: 2011-05-23 23:37:26 +0800
Seen: 235 times
Last updated: May 23 '11