2024-10-09 20:35:18 +03:00
|
|
|
package Common.Visual.Trees;
|
2024-10-17 20:31:06 +03:00
|
|
|
import Common.Current_;
|
2024-10-16 00:40:45 +03:00
|
|
|
import Common.MainModule_;
|
2024-10-11 00:00:30 +03:00
|
|
|
import Common.Utils.Utils_;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
|
|
import javax.swing.tree.TreePath;
|
2024-10-17 20:31:06 +03:00
|
|
|
public class DataTree extends StyledTree{
|
2023-09-17 22:13:42 +03:00
|
|
|
public DataTree(DefaultMutableTreeNode root_in) {
|
|
|
|
|
super(root_in);
|
|
|
|
|
}
|
|
|
|
|
public void ChangeCurrentObject(DefaultMutableTreeNode node) {
|
2024-10-17 20:31:06 +03:00
|
|
|
if (currentName() != null)
|
|
|
|
|
MainModule_.instance.set(currentName(), node.getUserObject());
|
|
|
|
|
}
|
|
|
|
|
public Current_ currentName() {
|
|
|
|
|
return null;
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
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) {
|
2024-10-11 00:00:30 +03:00
|
|
|
Utils_.MainLog.PrintException(ex);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SelectNodeByCriteria(Object criteria) {
|
|
|
|
|
EventsOff();
|
|
|
|
|
TreePath res = ShowNodeByCriteria(criteria);
|
|
|
|
|
setSelectionPath(res);
|
|
|
|
|
ChangeCurrentObject((DefaultMutableTreeNode) res.getLastPathComponent());
|
|
|
|
|
EventsOn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|