GWT Cell Tree Right Click Selection -
so have created celltree , want select cell receives right click when open context menu things, know cell working with. maybe going wrong way, can override onbrowserevent method , detect when right clicks on tree can't figure out cell being clicked can manually select it. has found solution problem?
the solution consists of 2 steps:
1) add treeviewmodel
constructor of celltree
. model can set names of elements in tree. here simple implementation api:
private static class customtreemodel implements treeviewmodel { /** * {@link nodeinfo} provides children of specified * value. */ public <t> nodeinfo<?> getnodeinfo(t value) { /* * create data in data provider. use parent value prefix * next level. */ listdataprovider<string> dataprovider = new listdataprovider<string>(); (int = 0; < 2; i++) { dataprovider.getlist().add(value + "." + string.valueof(i)); } // return node info pairs data cell. return new defaultnodeinfo<string>(dataprovider, new textcell()); } /** * check if specified value represents leaf node. leaf nodes cannot * opened. */ public boolean isleaf(object value) { // maximum length of value ten characters. return value.tostring().length() > 10; } }
2) when receive right click event
, eventtarget
name , compare name of item set using model.
Comments
Post a Comment