X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FTreeModelTransformer.java;fp=src%2Fbe%2Fnikiroo%2Futils%2Fui%2FTreeModelTransformer.java;h=9568f175dc7530b57a7be343b4d494a79e2fb67a;hb=60ee255638ef6e151a18ee1a93dd9a6c0e9ee1a7;hp=0000000000000000000000000000000000000000;hpb=727b9fb39d3386f14f66a33de80de04f1f58734c;p=nikiroo-utils.git
diff --git a/src/be/nikiroo/utils/ui/TreeModelTransformer.java b/src/be/nikiroo/utils/ui/TreeModelTransformer.java
new file mode 100644
index 0000000..9568f17
--- /dev/null
+++ b/src/be/nikiroo/utils/ui/TreeModelTransformer.java
@@ -0,0 +1,1217 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+// Can be found at: https://code.google.com/archive/p/aephyr/source/default/source
+// package aephyr.swing;
+package be.nikiroo.utils.ui;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.swing.JTree;
+import javax.swing.SortOrder;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeWillExpandListener;
+import javax.swing.tree.ExpandVetoException;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+
+public class TreeModelTransformer implements TreeModel {
+
+ public TreeModelTransformer(JTree tree, TreeModel model) {
+ if (tree == null)
+ throw new IllegalArgumentException();
+ if (model == null)
+ throw new IllegalArgumentException();
+ this.tree = tree;
+ this.model = model;
+ handler = createHandler();
+ addListeners();
+ }
+
+ private JTree tree;
+
+ private TreeModel model;
+
+ private Handler handler;
+
+ private Filter filter;
+
+ private TreePath filterStartPath;
+
+ private int filterDepthLimit;
+
+ private SortOrder sortOrder = SortOrder.UNSORTED;
+
+ private Map