Fixed up a number of TODOs; created a new Wrapped interface to simplify
auto-unwrapping. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4286 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -3,8 +3,8 @@ package com.threerings.presents.dobj {
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
import com.threerings.util.Integer;
|
||||
import com.threerings.util.StringBuilder;
|
||||
import com.threerings.util.Wrapped;
|
||||
|
||||
/**
|
||||
* An attribute changed event is dispatched when a single attribute of a
|
||||
@@ -46,16 +46,7 @@ public class AttributeChangedEvent extends NamedEvent
|
||||
_oldValue = target[_name]; // fucking wack-ass language
|
||||
}
|
||||
|
||||
// possibly convert the value
|
||||
var v :Object = _value;
|
||||
if (v is Integer) {
|
||||
v = (v as Integer).value
|
||||
|
||||
} else {
|
||||
// TODO: more!
|
||||
}
|
||||
|
||||
target[_name] = v;
|
||||
target[_name] = _value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,6 +99,11 @@ public class AttributeChangedEvent extends NamedEvent
|
||||
{
|
||||
super.readObject(ins);
|
||||
_value = ins.readObject();
|
||||
|
||||
// possibly convert the value
|
||||
if (_value is Wrapped) {
|
||||
_value = (_value as Wrapped).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
protected var _value :Object;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
import com.threerings.util.StringBuilder;
|
||||
import com.threerings.util.Wrapped;
|
||||
|
||||
/**
|
||||
* An element updated event is dispatched when an element of an array
|
||||
@@ -93,6 +94,10 @@ public class ElementUpdatedEvent extends NamedEvent
|
||||
super.readObject(ins);
|
||||
_value = ins.readObject();
|
||||
_index = ins.readInt();
|
||||
|
||||
if (_value is Wrapped) {
|
||||
_value = (_value as Wrapped).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.threerings.presents.dobj {
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
import com.threerings.util.Integer;
|
||||
import com.threerings.util.StringBuilder;
|
||||
import com.threerings.util.Wrapped;
|
||||
|
||||
/**
|
||||
* An entry removed event is dispatched when an entry is removed from a
|
||||
@@ -101,9 +101,8 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
super.readObject(ins);
|
||||
_key = ins.readObject();
|
||||
|
||||
// TODO: for now...
|
||||
if (_key is Integer) {
|
||||
_key = (_key as Integer).value;
|
||||
if (_key is Wrapped) {
|
||||
_key = (_key as Wrapped).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user