/** * Handles an action for the given target. The handler method may just discard the action if it's * not suitable. * * @param action the action to be handled. * @param sender the sender of the action. This is most often the action container. * @param target the target of the action. For item containers this is the item id. */ @Override @SuppressWarnings("unchecked") public void handleAction(Action action, Object sender, Object target) { if (target != null) { IntID itemId = (IntID) target; Item item = this.menuTree.getItem(itemId); MenuItemData itemData = this.menuTree.getItemData(itemId); if (item != null) { Map<Action, MenuActionProvider> actionComponentHandlerMap = itemData.getActionComponentHandlers(); if (actionComponentHandlerMap != null) { MenuActionProvider menuActionProvider = actionComponentHandlerMap.get(action); if (menuActionProvider != null) { if (menuActionProvider instanceof ComponentHandler) { this.layout.setCenter(((ComponentHandler) menuActionProvider).getComponent()); this.layout.doLayout(); } if (menuActionProvider instanceof MenuActionExecutor) { ((MenuActionExecutor) menuActionProvider).executeMenuAction(); } } } } } }