Proyecto

General

Perfil

Acciones

Errores #2364

abierta
AA EB

Retocar el arbol de la grupal mayorista

Errores #2364: Retocar el arbol de la grupal mayorista

Añadido por Admin Savia Web Admin hace más de 3 años.

Estado:
Nueva
Prioridad:
Normal
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)));
&lt;/zscript&gt;
&lt;tree id=&quot;tree&quot; model=&quot;&amp;#36;{btm}&quot; vflex=&quot;1&quot;/&gt;
&lt;/zk&gt;

https://www.zkoss.org/zksandbox/#g12

Ningún dato disponible

Acciones

Exportar a: PDF Atom