Moved the typed object registry into the same package with the rest of
the typed object stuff; made events typed so they can be transported; further wiring up of event dispatch over the network. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@34 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
//
|
||||
// $Id: AttributesChangedEvent.java,v 1.2 2001/06/02 01:30:37 mdb Exp $
|
||||
// $Id: AttributesChangedEvent.java,v 1.3 2001/06/11 17:44:04 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.dobj;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An attribute<em>s</em> changed event is dispatched when multiple
|
||||
* attributes of a distributed object have been changed in a single
|
||||
@@ -10,8 +14,11 @@ package com.threerings.cocktail.cher.dobj;
|
||||
*
|
||||
* @see DObjectManager.postEvent
|
||||
*/
|
||||
public class AttributesChangedEvent extends DEvent
|
||||
public class AttributesChangedEvent extends TypedEvent
|
||||
{
|
||||
/** The typed object code for this event. */
|
||||
public static final short TYPE = TYPE_BASE + 2;
|
||||
|
||||
/**
|
||||
* Constructs a new attribute changed event on the specified target
|
||||
* object with the supplied attribute name and value.
|
||||
@@ -152,6 +159,35 @@ public class AttributesChangedEvent extends DEvent
|
||||
return true;
|
||||
}
|
||||
|
||||
public short getType ()
|
||||
{
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public void writeTo (DataOutputStream out)
|
||||
throws IOException
|
||||
{
|
||||
super.writeTo(out);
|
||||
out.writeInt(_count);
|
||||
for (int i = 0; i < _count; i++) {
|
||||
out.writeUTF(_names[i]);
|
||||
// out.write...(_values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void readFrom (DataInputStream in)
|
||||
throws IOException
|
||||
{
|
||||
super.readFrom(in);
|
||||
_count = in.readInt();
|
||||
_names = new String[_count];
|
||||
_values = new Object[_count];
|
||||
for (int i = 0; i < _count; i++) {
|
||||
_names[i] = in.readUTF();
|
||||
// _values[i] = ...
|
||||
}
|
||||
}
|
||||
|
||||
protected int _count;
|
||||
protected String[] _names;
|
||||
protected Object[] _values;
|
||||
|
||||
Reference in New Issue
Block a user