Have CompoundEvent handle propagating setTargetOid() to its internal events and
clean things up for the callers. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4731 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -115,25 +115,35 @@ public class CompoundEvent extends DEvent
|
||||
_events.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to propagate our source oid to our constituent events.
|
||||
*/
|
||||
@Override // from DEvent
|
||||
public void setSourceOid (int sourceOid)
|
||||
{
|
||||
super.setSourceOid(sourceOid);
|
||||
|
||||
// we need to propagate our source oid to our constituent events
|
||||
int ecount = _events.size();
|
||||
for (int i = 0; i < ecount; i++) {
|
||||
_events.get(i).setSourceOid(sourceOid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Nothing to apply here.
|
||||
*/
|
||||
@Override // from DEvent
|
||||
public void setTargetOid (int targetOid)
|
||||
{
|
||||
super.setTargetOid(targetOid);
|
||||
|
||||
// we need to propagate our target oid to our constituent events
|
||||
int ecount = _events.size();
|
||||
for (int i = 0; i < ecount; i++) {
|
||||
_events.get(i).setTargetOid(targetOid);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // from DEvent
|
||||
public boolean applyToObject (DObject target)
|
||||
throws ObjectAccessException
|
||||
{
|
||||
// nothing to apply here
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,25 +303,6 @@ public class PresentsDObjectMgr
|
||||
// if this is a runnable, it's just an executable unit that should be invoked
|
||||
((Runnable)unit).run();
|
||||
|
||||
} else if (unit instanceof CompoundEvent) {
|
||||
CompoundEvent event = (CompoundEvent)unit;
|
||||
|
||||
// if this event is on a proxied object, forward it to the owning manager
|
||||
ProxyReference proxy = _proxies.get(event.getTargetOid());
|
||||
if (proxy != null) {
|
||||
// rewrite the oid into the originating manager's id space
|
||||
event.setTargetOid(proxy.origObjectId);
|
||||
List<DEvent> events = event.getEvents();
|
||||
for (int ii = 0, ll = events.size(); ii < ll; ii++) {
|
||||
events.get(ii).setTargetOid(proxy.origObjectId);
|
||||
}
|
||||
// then pass it on to the originating manager to handle
|
||||
proxy.origManager.postEvent(event);
|
||||
|
||||
} else {
|
||||
processCompoundEvent(event);
|
||||
}
|
||||
|
||||
} else {
|
||||
DEvent event = (DEvent)unit;
|
||||
|
||||
@@ -333,6 +314,9 @@ public class PresentsDObjectMgr
|
||||
// then pass it on to the originating manager to handle
|
||||
proxy.origManager.postEvent(event);
|
||||
|
||||
} else if (event instanceof CompoundEvent) {
|
||||
processCompoundEvent((CompoundEvent)event);
|
||||
|
||||
} else {
|
||||
processEvent(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user