Acciones
Errores #2364
abierta
AA
EB
Retocar el arbol de la grupal mayorista
Errores #2364:
Retocar el arbol de la grupal mayorista
Fecha de inicio:
10/02/2023
Fecha fin:
% Realizado:
0%
Tiempo estimado:
Cliente:
*
Descripción
org.zkoss.zksandbox.tree.BinaryTreeModel
public class BinaryTreeModel extends AbstractTreeModel{
private ArrayList _tree =null;
public BinaryTreeModel(List tree){
super(tree.get(0));
_tree = (ArrayList)tree;
}
public Object getChild(Object parent, int index) {
int i = _tree.indexOf(parent) *2 +1 + index;
if( i>= _tree.size())
return null;
else
return _tree.get(i);
}
public int getChildCount(Object parent) {
int count = 0;
if(getChild(parent,0) != null)
count++;
if(getChild(parent,1) != null)
count++;
return count;
}
public boolean isLeaf(Object node) {
return (getChildCount(node) == 0);
}
}
org.zkoss.zksandbox.BigList
public class BigList extends java.util.AbstractList {
private int _sz;
public BigList(int sz) {
if (sz < 0)
throw new IllegalArgumentException(
"Negative not allowed: "+sz);
_sz = sz;
}
public int size() {
return _sz;
}
public Object get(int j) {
return new Integer(j);
}
}
------------------------------
<zk>
<zscript>
import org.zkoss.zksandbox.tree.BinaryTreeModel;
BinaryTreeModel btm = new BinaryTreeModel(new ArrayList(new org.zkoss.zksandbox.BigList(50)));
</zscript>
<tree id="tree" model="&#36;{btm}" vflex="1"/>
</zk>
Ningún dato disponible
Acciones