1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| */
public ComponentTreeNode(String name, ComponentTreeNode aParent,
String type, int id, Color color) {
/*
* init the parameters of the current node*/
this.name = name;
this.parent = aParent;
this.type = type;
this.id = id;
this.color = color;
/*
* initialize columns for the current node
*/
valeurs.add("");
valeurs.add("");
valeurs.add("");
valeurs.add("");
/*
* if type is "r" for root
*/
if (type == "r") {
leaf = false;
for (int i = 1; i <= 10; i++) {
String vName = "Echantillon " + i;
if ((i % 2) == 0)
children.add(new ComponentTreeNode(vName, this, "c", i,
Color.green));
else
children.add(new ComponentTreeNode(vName, this, "c", i,
Color.white));
}
}
/*
* if type is "c" for children
*/
if (type == "c") {
leaf = true;
for (int i = 1; i <= 5; i++) {
String vName = "Echantillon " + id + " - " + i;
children.add(new ComponentTreeNode(vName, this, "f", i, color));
}
}
/*
* if type is "f" for leaf
*/
if (type == "f") {
leaf = true;
}
} |
Partager