From 93f3eabf26bf7477bb699354bf639151d6f3db16 Mon Sep 17 00:00:00 2001 From: Bob Jacobsen Date: Fri, 17 Nov 2023 18:55:58 -0500 Subject: [PATCH 1/2] allow using code to retry an ordering --- src/org/openlcb/swing/networktree/TreePane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/org/openlcb/swing/networktree/TreePane.java b/src/org/openlcb/swing/networktree/TreePane.java index 4cda7437..6673dedd 100644 --- a/src/org/openlcb/swing/networktree/TreePane.java +++ b/src/org/openlcb/swing/networktree/TreePane.java @@ -314,9 +314,6 @@ private void addNewHardwareNode(NodeTreeRep n) { * @param order new order. */ public void setSortOrder(SortOrder order) { - if (sortOrder == order) { - return; - } sortOrder = order; SwingUtilities.invokeLater(() -> resortTree()); } From 253576650bbd49e4bb2195488f7d138e51618910 Mon Sep 17 00:00:00 2001 From: Bob Jacobsen Date: Fri, 17 Nov 2023 19:41:01 -0500 Subject: [PATCH 2/2] also resort on new node --- src/org/openlcb/swing/networktree/TreePane.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/org/openlcb/swing/networktree/TreePane.java b/src/org/openlcb/swing/networktree/TreePane.java index 6673dedd..dc5d427f 100644 --- a/src/org/openlcb/swing/networktree/TreePane.java +++ b/src/org/openlcb/swing/networktree/TreePane.java @@ -223,6 +223,8 @@ public void propertyChange(java.beans.PropertyChangeEvent e) { memo.addPropertyChangeListener(resortListener); tree.expandPath(new TreePath(nodes.getPath())); } + // ensure still properly sorted + SwingUtilities.invokeLater(() -> resortTree()); } else if (e.getPropertyName().equals(MimicNodeStore.CLEAR_ALL_NODES)) { synchronized (nodes) { nodes.removeAllChildren();