From 43ce49151868b87c950bdd70b34376c14563b9b1 Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Tue, 21 Oct 2008 22:47:13 +0000 Subject: [PATCH] Whoops, how about I look more closely when I do that? We're dealing with two arrays here, so if I just sort the one, it'll give us nicely sorted tabs that point to the wrong contents. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5453 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../admin/client/ConfigEditorPanel.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/admin/client/ConfigEditorPanel.java b/src/java/com/threerings/admin/client/ConfigEditorPanel.java index 554acdb58..20f5e7307 100644 --- a/src/java/com/threerings/admin/client/ConfigEditorPanel.java +++ b/src/java/com/threerings/admin/client/ConfigEditorPanel.java @@ -21,13 +21,14 @@ package com.threerings.admin.client; +import java.util.Comparator; + import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import com.samskivert.util.QuickSort; - import com.samskivert.swing.VGroupLayout; import com.threerings.presents.util.PresentsContext; @@ -95,11 +96,21 @@ public class ConfigEditorPanel extends JPanel /** * Called in response to our getConfigInfo server-side service request. */ - public void gotConfigInfo (String[] keys, int[] oids) + public void gotConfigInfo (final String[] keys, final int[] oids) { - QuickSort.sort(keys); + Integer indexes[] = new Integer[keys.length]; + for (int ii = 0; ii < indexes.length; ii++) { + indexes[ii] = ii; + } + + QuickSort.sort(indexes, new Comparator() { + public int compare (Integer i1, Integer i2) { + return keys[i1].compareTo(keys[i2]); + } + }); + // create object editor panels for each of the categories - for (int ii = 0; ii < keys.length; ii++) { + for (Integer ii : indexes) { ObjectEditorPanel panel = new ObjectEditorPanel(_ctx, keys[ii], oids[ii]); JScrollPane scrolly = new JScrollPane(panel); _oeditors.addTab(keys[ii], scrolly);