31 lines
792 B
ActionScript
31 lines
792 B
ActionScript
class TreePannel : DockPanel {
|
|
void onMenuBar() {
|
|
if (menuItem("Hey!")) {
|
|
print("clicked");
|
|
}
|
|
}
|
|
|
|
void onRender() {
|
|
Entity root = getRoot();
|
|
|
|
treeNode(root.getName(), root.getId(), any(root),CallbackFunc(this.render));
|
|
}
|
|
|
|
void render(any@ data) {
|
|
Entity entity;
|
|
data.retrieve(entity);
|
|
|
|
int childCount = entity.getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
Entity child = entity.getChild(i);
|
|
|
|
if (child.getChildCount() == 0) {
|
|
treeNode(child.getName(), child.getId());
|
|
} else {
|
|
treeNode(child.getName(), child.getId(), any(child),CallbackFunc(this.render));
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|