41 lines
1.2 KiB
Java
41 lines
1.2 KiB
Java
package Common.Visual.Trees;
|
|
import Common.Current_;
|
|
import Common.MainModule_;
|
|
import Common.Utils.Utils_;
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
import javax.swing.tree.TreePath;
|
|
public class DataTree extends StyledTree {
|
|
public DataTree(DefaultMutableTreeNode root_in) {
|
|
super(root_in);
|
|
}
|
|
public void ChangeCurrentObject(DefaultMutableTreeNode node) {
|
|
if (currentName() != null)
|
|
MainModule_.instance.set(currentName(), node.getUserObject());
|
|
}
|
|
public Current_ currentName() {
|
|
return null;
|
|
}
|
|
public void ShowCurrentObject() throws Exception {
|
|
}
|
|
public void ShowNoCurrentObject() throws Exception {
|
|
}
|
|
@Override
|
|
public void SelectionAction(TreePath path) {
|
|
ChangeCurrentObject((DefaultMutableTreeNode) path.getLastPathComponent());
|
|
try {
|
|
ShowCurrentObject();
|
|
} catch (Exception ex) {
|
|
Utils_.MainLog.PrintException(ex);
|
|
}
|
|
}
|
|
public void SelectNodeByCriteria(Object criteria) {
|
|
EventsOff();
|
|
TreePath res = ShowNodeByCriteria(criteria);
|
|
setSelectionPath(res);
|
|
ChangeCurrentObject((DefaultMutableTreeNode) res.getLastPathComponent());
|
|
EventsOn();
|
|
}
|
|
}
|
|
|