forked from LupusNobilis/java-org.hwo.ui
46 lines
942 B
Java
46 lines
942 B
Java
package org.hwo.ui.tree;
|
|
|
|
import javax.swing.plaf.basic.BasicTreeUI.SelectionModelPropertyChangeHandler;
|
|
|
|
public abstract class PooledAutomatedTreeNode extends AutomatedTreeNode {
|
|
|
|
private AutomatedTreeNode[] pool;
|
|
|
|
public PooledAutomatedTreeNode(AutomatedTreeNode parent) {
|
|
super(parent);
|
|
this.pool = new PooledAutomatedTreeNode[0];
|
|
}
|
|
|
|
public PooledAutomatedTreeNode(AutomatedTreeNode parent,AutomatedTreeNode[] pool) {
|
|
super(parent);
|
|
this.pool = pool;
|
|
}
|
|
|
|
public AutomatedTreeNode[] getPool() {
|
|
return pool;
|
|
}
|
|
public void setPool(AutomatedTreeNode[] pool) {
|
|
for (AutomatedTreeNode c: getChildren()){
|
|
removeChild(c);
|
|
}
|
|
|
|
this.pool = pool;
|
|
}
|
|
|
|
public boolean show(int index){
|
|
if (!hasChild(pool[index])){
|
|
addChild(pool[index]);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean hide(int index){
|
|
if (hasChild(pool[index])){
|
|
removeChild(pool[index]);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|