@Override public void handleNotification(Notification notification) { super.handleNotification(notification); switch (notification.getName()) { case Overlap2D.SCENE_RIGHT_CLICK: Vector2 stageCoords = notification.getBody(); showPopup(SCENE_ACTIONS_SET, stageCoords); break; case Overlap2D.ITEM_RIGHT_CLICK: Array<String> actionsSet = new Array<>(actionSets.get(ITEMS_ACTIONS_SET)); applyItemTypeMutators(actionsSet); showPopup(actionsSet, sandbox.getSelector().getSelectedItem()); break; case UIResourcesBoxMediator.IMAGE_RIGHT_CLICK: showPopup(IMAGE_RESOURCE_ACTION_SET, notification.getBody()); break; case UIResourcesBoxMediator.ANIMATION_RIGHT_CLICK: showPopup(RESOURCE_ACTION_SET, notification.getBody()); break; case UIResourcesBoxMediator.LIBRARY_ITEM_RIGHT_CLICK: showPopup(RESOURCE_ACTION_SET, notification.getBody()); break; case UIResourcesBoxMediator.PARTICLE_EFFECT_RIGHT_CLICK: showPopup(RESOURCE_ACTION_SET, notification.getBody()); break; case UIDropDownMenu.ITEM_CLICKED: facade.sendNotification(notification.getBody(), currentObservable); break; default: break; } }
/** * If an <code>ICommand</code> has previously been registered to handle a the given <code> * INotification</code>, then it is executed. * * @param note The notification to send associated with the command to call. */ public void executeCommand(Notification note) { // No reflexion in GWT Class<? extends Command> commandClass = commandMap.get(note.getName()); if (commandClass != null) { Command command; try { command = commandClass.newInstance(); command.execute(note); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } }
@Override public void handleNotification(Notification notification) { super.handleNotification(notification); switch (notification.getName()) { case UIPhysicsProperties.CLOSE_CLICKED: Overlap2DFacade.getInstance() .sendNotification( Sandbox.ACTION_REMOVE_COMPONENT, RemoveComponentFromItemCommand.payload( observableReference, PhysicsBodyComponent.class)); break; } }