diff options
| author | 2020-06-03 13:39:42 -0400 | |
|---|---|---|
| committer | 2020-06-03 18:39:42 +0100 | |
| commit | 0f47403d0220757fed189b76e2071e25b1025cb8 (patch) | |
| tree | 879bf72c4476f0a5e0d82da99d7ff2b2276bcaca /src/main/java/cuchaz/enigma/gui/node | |
| parent | Fix search dialog hanging for a short time sometimes (#250) (diff) | |
| download | enigma-fork-0f47403d0220757fed189b76e2071e25b1025cb8.tar.gz enigma-fork-0f47403d0220757fed189b76e2071e25b1025cb8.tar.xz enigma-fork-0f47403d0220757fed189b76e2071e25b1025cb8.zip | |
Split GUI code to separate module (#242)
* Split into modules
* Post merge compile fixes
Co-authored-by: modmuss50 <modmuss50@gmail.com>
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/node')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java | 72 | ||||
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java | 58 |
2 files changed, 0 insertions, 130 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java b/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java deleted file mode 100644 index 922f8f2..0000000 --- a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorClassNode.java +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.gui.node; | ||
| 13 | |||
| 14 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | ||
| 15 | |||
| 16 | import javax.swing.tree.DefaultMutableTreeNode; | ||
| 17 | |||
| 18 | public class ClassSelectorClassNode extends DefaultMutableTreeNode { | ||
| 19 | |||
| 20 | private final ClassEntry obfEntry; | ||
| 21 | private ClassEntry classEntry; | ||
| 22 | |||
| 23 | public ClassSelectorClassNode(ClassEntry obfEntry, ClassEntry classEntry) { | ||
| 24 | this.obfEntry = obfEntry; | ||
| 25 | this.classEntry = classEntry; | ||
| 26 | this.setUserObject(classEntry); | ||
| 27 | } | ||
| 28 | |||
| 29 | public ClassEntry getObfEntry() { | ||
| 30 | return obfEntry; | ||
| 31 | } | ||
| 32 | |||
| 33 | public ClassEntry getClassEntry() { | ||
| 34 | return this.classEntry; | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | public String toString() { | ||
| 39 | return this.classEntry.getSimpleName(); | ||
| 40 | } | ||
| 41 | |||
| 42 | @Override | ||
| 43 | public boolean equals(Object other) { | ||
| 44 | return other instanceof ClassSelectorClassNode && equals((ClassSelectorClassNode) other); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | public int hashCode() { | ||
| 49 | return 17 + (classEntry != null ? classEntry.hashCode() : 0); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | public Object getUserObject() { | ||
| 54 | return classEntry; | ||
| 55 | } | ||
| 56 | |||
| 57 | @Override | ||
| 58 | public void setUserObject(Object userObject) { | ||
| 59 | String packageName = ""; | ||
| 60 | if (classEntry.getPackageName() != null) | ||
| 61 | packageName = classEntry.getPackageName() + "/"; | ||
| 62 | if (userObject instanceof String) | ||
| 63 | this.classEntry = new ClassEntry(packageName + userObject); | ||
| 64 | else if (userObject instanceof ClassEntry) | ||
| 65 | this.classEntry = (ClassEntry) userObject; | ||
| 66 | super.setUserObject(classEntry); | ||
| 67 | } | ||
| 68 | |||
| 69 | public boolean equals(ClassSelectorClassNode other) { | ||
| 70 | return this.classEntry.equals(other.classEntry); | ||
| 71 | } | ||
| 72 | } | ||
diff --git a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java b/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java deleted file mode 100644 index caa985c..0000000 --- a/src/main/java/cuchaz/enigma/gui/node/ClassSelectorPackageNode.java +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.gui.node; | ||
| 13 | |||
| 14 | import javax.swing.tree.DefaultMutableTreeNode; | ||
| 15 | |||
| 16 | public class ClassSelectorPackageNode extends DefaultMutableTreeNode { | ||
| 17 | |||
| 18 | private String packageName; | ||
| 19 | |||
| 20 | public ClassSelectorPackageNode(String packageName) { | ||
| 21 | this.packageName = packageName != null ? packageName : "(none)"; | ||
| 22 | } | ||
| 23 | |||
| 24 | public String getPackageName() { | ||
| 25 | return packageName; | ||
| 26 | } | ||
| 27 | |||
| 28 | @Override | ||
| 29 | public Object getUserObject() { | ||
| 30 | return packageName; | ||
| 31 | } | ||
| 32 | |||
| 33 | @Override | ||
| 34 | public void setUserObject(Object userObject) { | ||
| 35 | if (userObject instanceof String) | ||
| 36 | this.packageName = (String) userObject; | ||
| 37 | super.setUserObject(userObject); | ||
| 38 | } | ||
| 39 | |||
| 40 | @Override | ||
| 41 | public String toString() { | ||
| 42 | return !packageName.equals("(none)") ? this.packageName : "(none)"; | ||
| 43 | } | ||
| 44 | |||
| 45 | @Override | ||
| 46 | public boolean equals(Object other) { | ||
| 47 | return other instanceof ClassSelectorPackageNode && equals((ClassSelectorPackageNode) other); | ||
| 48 | } | ||
| 49 | |||
| 50 | @Override | ||
| 51 | public int hashCode() { | ||
| 52 | return packageName.hashCode(); | ||
| 53 | } | ||
| 54 | |||
| 55 | public boolean equals(ClassSelectorPackageNode other) { | ||
| 56 | return other != null && this.packageName.equals(other.packageName); | ||
| 57 | } | ||
| 58 | } | ||