@Override
public void onMessage(String s, MessageType t) {
System.out.println("got message " + s);
Beanery factory = AppController.getBeanFactory();
IconPanel iconPanel = mainPanel.draggablePanel;
switch(t) {
case AddEvent:
JsArray<BlobInfoJS> c = JsonUtils.safeEval(s);
for (int i = 0; i < c.length(); i++) {
BlobInfoJS x = c.get(i);
iconPanel.add(x);
}
break;
case MoveEvent:
AutoBean<MoveEvent> moveBean = AutoBeanCodex.decode(factory, MoveEvent.class, s);
MoveEvent moveEvent = moveBean.as();
moveIcon(moveEvent.getBlobKey(), moveEvent.getFrom(), moveEvent.getTo());
break;
case DeleteEvent:
iconPanel.delete(s);
break;
default:
// Ignore
}
}