2024-10-09 20:35:18 +03:00
|
|
|
package Common.Visual.Trees;
|
2024-10-09 23:37:58 +03:00
|
|
|
import Common.Current_;
|
2024-10-07 22:04:09 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-08 00:39:13 +03:00
|
|
|
import Common.Visual.DataControl_OLD;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
|
|
import javax.swing.tree.TreePath;
|
|
|
|
|
public class DataTree extends StyledTree implements DataControl_OLD {
|
|
|
|
|
public DataTree(DefaultMutableTreeNode root_in) {
|
|
|
|
|
super(root_in);
|
|
|
|
|
}
|
|
|
|
|
public void ChangeCurrentObject(DefaultMutableTreeNode node) {
|
2024-10-08 00:39:13 +03:00
|
|
|
if (getCurrent() != null)
|
2024-10-09 23:37:58 +03:00
|
|
|
Current_.set(getCurrent(), node.getUserObject());
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void ShowCurrentObject() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void ShowNoCurrentObject() throws Exception {
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void SelectionAction(TreePath path) {
|
|
|
|
|
ChangeCurrentObject((DefaultMutableTreeNode) path.getLastPathComponent());
|
|
|
|
|
try {
|
|
|
|
|
ShowCurrentObject();
|
|
|
|
|
} catch (Exception ex) {
|
2024-10-07 22:04:09 +03:00
|
|
|
CommonUtils.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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|