summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/PropList.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/PropList.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/PropList.java')
-rw-r--r--NET/worlds/scape/PropList.java150
1 files changed, 150 insertions, 0 deletions
diff --git a/NET/worlds/scape/PropList.java b/NET/worlds/scape/PropList.java
new file mode 100644
index 0000000..898eab1
--- /dev/null
+++ b/NET/worlds/scape/PropList.java
@@ -0,0 +1,150 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.core.IniFile;
+/* */ import java.awt.List;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class PropList
+/* */ extends List
+/* */ {
+/* */ private static final long serialVersionUID = 1L;
+/* */ private Object obj;
+/* */ private Vector<Property> properties;
+/* 31 */ private static String[] sortOrder = {
+/* 32 */ "Name",
+/* 33 */ "Tilesize",
+/* 34 */ "Transform",
+/* 35 */ "From",
+/* 36 */ "To",
+/* 37 */ "Extent",
+/* 38 */ "Bumpable",
+/* 39 */ "Collision Extent",
+/* 40 */ "Visible",
+/* 41 */ "Optimizable",
+/* 42 */ "DrawFirstOnIntersection",
+/* 43 */ "DrawOrderUnimportant" };
+/* */
+/* */
+/* */ public static void setPreferences(String[] prefs)
+/* */ {
+/* 48 */ sortOrder = prefs;
+/* */ }
+/* */
+/* */ static
+/* */ {
+/* 53 */ int numUserPreferences =
+/* 54 */ IniFile.gamma().getIniInt("PropertyOrderCount", -1);
+/* 55 */ if (numUserPreferences >= 0) {
+/* 56 */ sortOrder = new String[numUserPreferences];
+/* 57 */ for (int i = 0; i < numUserPreferences; i++)
+/* 58 */ sortOrder[i] =
+/* 59 */ IniFile.gamma().getIniString("PropertyOrder" + i, "");
+/* */ }
+/* */ }
+/* */
+/* */ public Object getObject() {
+/* 64 */ return this.obj;
+/* */ }
+/* */
+/* */ public void setObject(Object obj) {
+/* 68 */ int selected = getSelectedIndex();
+/* 69 */ if (obj != this.obj)
+/* 70 */ selected = -1;
+/* 71 */ this.obj = obj;
+/* 72 */ int count = getItemCount();
+/* 73 */ if (count != 0)
+/* */ {
+/* 75 */ removeAll();
+/* */ }
+/* */
+/* 78 */ Vector<Property> unsorted = new Vector();
+/* 79 */ EnumProperties e = new EnumProperties(obj);
+/* 80 */ for (count = 0; e.hasMoreElements(); count++) {
+/* 81 */ Property p = (Property)e.nextElement();
+/* 82 */ if ((!(p instanceof VectorProperty)) && (
+/* 83 */ (p.getEditor() != null) ||
+/* 84 */ (!(p.get() instanceof Properties)))) {
+/* 85 */ unsorted.addElement(p);
+/* */ }
+/* */ }
+/* */
+/* 89 */ this.properties = new Vector(unsorted.size());
+/* 90 */ for (int sortItem = 0; sortItem < sortOrder.length; sortItem++)
+/* */ {
+/* 92 */ String s = sortOrder[sortItem];
+/* */
+/* 94 */ int size = unsorted.size();
+/* 95 */ for (int i = 0; i < size; i++) {
+/* 96 */ Property p = (Property)unsorted.elementAt(i);
+/* 97 */ if (p.getName().equals(s)) {
+/* 98 */ this.properties.addElement(p);
+/* 99 */ unsorted.removeElementAt(i);
+/* 100 */ break;
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* 106 */ int size = unsorted.size();
+/* 107 */ for (int i = 0; i < size; i++) {
+/* 108 */ this.properties.addElement((Property)unsorted.elementAt(i));
+/* */ }
+/* */
+/* 111 */ size = this.properties.size();
+/* 112 */ for (int i = 0; i < size; i++) {
+/* 113 */ Property prop = (Property)this.properties.elementAt(i);
+/* 114 */ addItem(prop.getName() + " (" + prop.getPropertyType() + ")" +
+/* 115 */ " (" + prop.get() + ")");
+/* */ }
+/* */
+/* */
+/* */
+/* 120 */ count = getItemCount();
+/* 121 */ if ((count != 0) && (selected != -1)) {
+/* 122 */ if (selected >= count)
+/* 123 */ selected = count - 1;
+/* 124 */ select(selected);
+/* */ }
+/* */ }
+/* */
+/* */ public Property getSelectedProperty()
+/* */ {
+/* 130 */ int i = getSelectedIndex();
+/* 131 */ if (i != -1)
+/* 132 */ return (Property)this.properties.elementAt(i);
+/* 133 */ return null;
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public void addItem(String s)
+/* */ {
+/* 139 */ if (s.length() > 128) {
+/* 140 */ s = s.substring(0, 125) + "...";
+/* */ }
+/* 142 */ super.addItem(s);
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PropList.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file