Changed builder model to make data available on the character classes

and components unmodifiable.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@590 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-11-02 15:39:07 +00:00
parent b42f20f191
commit 639007759c
2 changed files with 10 additions and 10 deletions
@@ -1,5 +1,5 @@
// //
// $Id: BuilderModel.java,v 1.1 2001/11/02 01:10:28 shaper Exp $ // $Id: BuilderModel.java,v 1.2 2001/11/02 15:39:07 shaper Exp $
package com.threerings.cast.builder; package com.threerings.cast.builder;
@@ -54,16 +54,16 @@ public class BuilderModel
*/ */
public List getComponentClasses () public List getComponentClasses ()
{ {
return _classes; return Collections.unmodifiableList(_classes);
} }
/** /**
* Returns a hashtable of the components available for each * Returns a map of the components available for each component
* component class, keyed on component class id. * class, keyed on component class id.
*/ */
public HashIntMap getComponents () public Map getComponents ()
{ {
return _components; return Collections.unmodifiableMap(_components);
} }
/** /**
@@ -1,15 +1,15 @@
// //
// $Id: ComponentPanel.java,v 1.3 2001/11/02 01:10:28 shaper Exp $ // $Id: ComponentPanel.java,v 1.4 2001/11/02 15:39:07 shaper Exp $
package com.threerings.cast.builder; package com.threerings.cast.builder;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import com.samskivert.swing.*; import com.samskivert.swing.*;
import com.samskivert.util.HashIntMap;
import com.threerings.cast.Log; import com.threerings.cast.Log;
import com.threerings.cast.*; import com.threerings.cast.*;
@@ -40,12 +40,12 @@ public class ComponentPanel extends JPanel
protected void addClassEditors (BuilderModel model) protected void addClassEditors (BuilderModel model)
{ {
List classes = model.getComponentClasses(); List classes = model.getComponentClasses();
HashIntMap components = model.getComponents(); Map components = model.getComponents();
int size = classes.size(); int size = classes.size();
for (int ii = 0; ii < size; ii++) { for (int ii = 0; ii < size; ii++) {
ComponentClass cclass = (ComponentClass)classes.get(ii); ComponentClass cclass = (ComponentClass)classes.get(ii);
List ccomps = (List)components.get(cclass.clid); List ccomps = (List)components.get(new Integer(cclass.clid));
add(new ClassEditor(model, cclass, ccomps)); add(new ClassEditor(model, cclass, ccomps));
} }
} }