2024-10-07 00:58:29 +03:00
|
|
|
package Common_old.UI.Trees;
|
|
|
|
|
import Common_old.Current;
|
|
|
|
|
import _VisualDVM.Global;
|
|
|
|
|
import Common_old.UI.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) {
|
|
|
|
|
if (getCurrent() != Current.Undefined)
|
|
|
|
|
Current.set(getCurrent(), node.getUserObject());
|
|
|
|
|
}
|
|
|
|
|
@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) {
|
|
|
|
|
Global.Log.PrintException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SelectNodeByCriteria(Object criteria) {
|
|
|
|
|
EventsOff();
|
|
|
|
|
TreePath res = ShowNodeByCriteria(criteria);
|
|
|
|
|
setSelectionPath(res);
|
|
|
|
|
ChangeCurrentObject((DefaultMutableTreeNode) res.getLastPathComponent());
|
|
|
|
|
EventsOn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|