Rolled SettedObject right into DObject, because it's just too useful.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3019 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DSetEditor.java,v 1.1 2004/06/03 17:15:38 ray Exp $
|
||||
// $Id: DSetEditor.java,v 1.2 2004/06/03 18:15:03 ray Exp $
|
||||
|
||||
package com.threerings.admin.client;
|
||||
|
||||
@@ -18,13 +18,12 @@ import com.samskivert.util.ListUtil;
|
||||
import com.threerings.media.SafeScrollPane;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.dobj.SettedObject;
|
||||
import com.threerings.presents.dobj.EntryAddedEvent;
|
||||
import com.threerings.presents.dobj.EntryRemovedEvent;
|
||||
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
||||
import com.threerings.presents.dobj.SetListener;
|
||||
import com.threerings.presents.dobj.SettedObject;
|
||||
|
||||
/**
|
||||
* Allows simple editing of DSets withing a distributed object.
|
||||
@@ -100,7 +99,7 @@ public class DSetEditor extends JPanel
|
||||
* @param entryClass the Class of the DSet.Entry elements contained in the
|
||||
* set.
|
||||
*/
|
||||
public DSetEditor (SettedObject setter, String setName, Class entryClass)
|
||||
public DSetEditor (DObject setter, String setName, Class entryClass)
|
||||
{
|
||||
this(setter, setName, entryClass, null);
|
||||
}
|
||||
@@ -115,7 +114,7 @@ public class DSetEditor extends JPanel
|
||||
* @param editableFields the names of the fields in the entryClass that
|
||||
* should be editable.
|
||||
*/
|
||||
public DSetEditor (SettedObject setter, String setName, Class entryClass,
|
||||
public DSetEditor (DObject setter, String setName, Class entryClass,
|
||||
String[] editableFields)
|
||||
{
|
||||
this(setter, setName, entryClass, editableFields, null);
|
||||
@@ -132,7 +131,7 @@ public class DSetEditor extends JPanel
|
||||
* should be editable.
|
||||
* @param interp The FieldInterpreter to use.
|
||||
*/
|
||||
public DSetEditor (SettedObject setter, String setName, Class entryClass,
|
||||
public DSetEditor (DObject setter, String setName, Class entryClass,
|
||||
String[] editableFields, FieldInterpreter interp)
|
||||
{
|
||||
super(new BorderLayout());
|
||||
@@ -274,7 +273,7 @@ public class DSetEditor extends JPanel
|
||||
}
|
||||
|
||||
/** The object that contains the set we're displaying. */
|
||||
protected SettedObject _setter;
|
||||
protected DObject _setter;
|
||||
|
||||
/** The name of the set in that object. */
|
||||
protected String _setName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DObject.java,v 1.72 2004/02/25 14:45:16 mdb Exp $
|
||||
// $Id: DObject.java,v 1.73 2004/06/03 18:15:03 ray Exp $
|
||||
|
||||
package com.threerings.presents.dobj;
|
||||
|
||||
@@ -255,6 +255,45 @@ public class DObject implements Streamable
|
||||
return _controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the DSet with the specified name.
|
||||
*/
|
||||
public final DSet getSet (String setName)
|
||||
{
|
||||
try {
|
||||
return (DSet) getField(setName).get(this);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("No such set: " + setName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the specified item added to the specified DSet.
|
||||
*/
|
||||
public void addToSet (String setName, DSet.Entry entry)
|
||||
{
|
||||
getSet(setName); // validate the set
|
||||
requestEntryAdd(setName, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the specified item updated in the specified DSet.
|
||||
*/
|
||||
public void updateSet (String setName, DSet.Entry entry)
|
||||
{
|
||||
getSet(setName); // validate the set
|
||||
requestEntryUpdate(setName, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the specified key removed from the specified DSet.
|
||||
*/
|
||||
public void removeFromSet (String setName, Comparable key)
|
||||
{
|
||||
getSet(setName); // validate the set
|
||||
requestEntryRemove(setName, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* At times, an entity on the server may need to ensure that events it
|
||||
* has queued up have made it through the event queue and are applied
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// $Id: SettedObject.java,v 1.1 2004/06/03 16:34:07 ray Exp $
|
||||
|
||||
package com.threerings.presents.dobj;
|
||||
|
||||
/**
|
||||
* Allows manipulation of DSets in generic ways.
|
||||
*/
|
||||
public interface SettedObject
|
||||
{
|
||||
/**
|
||||
* Get the specified set.
|
||||
*/
|
||||
public DSet getSet (String name);
|
||||
|
||||
/**
|
||||
* Add the item to the set.
|
||||
*/
|
||||
public void addToSet (String setName, DSet.Entry entry);
|
||||
|
||||
/**
|
||||
* Update an item in the set.
|
||||
*/
|
||||
public void updateSet (String setName, DSet.Entry entry);
|
||||
|
||||
/**
|
||||
* Remove the item from set.
|
||||
*/
|
||||
public void removeFromSet (String setName, Comparable key);
|
||||
|
||||
/**
|
||||
* See {@link DObject#getOid}.
|
||||
*/
|
||||
public int getOid ();
|
||||
|
||||
/**
|
||||
* See {@link DObject#addListener}.
|
||||
*/
|
||||
public void addListener (ChangeListener listener);
|
||||
|
||||
/**
|
||||
* See {@link DObject#removeListener}.
|
||||
*/
|
||||
public void removeListener (ChangeListener listener);
|
||||
}
|
||||
Reference in New Issue
Block a user