public void dispatchEvent(String command, Object param) { BookAction action = this.mainFrame.menu.$(command); if (action != null) { action.actionPerformed(null, param); } else { log.warn("Not found action:" + command); } }
public void processEvent(BookAction e) { final String HANDLER = "__actionHander"; String command = (String) e.getValue(Action.ACTION_COMMAND_KEY); log.debug("processEvent:" + command); Method m = (Method) e.getValue(HANDLER); if (m == null) { try { m = MenuAction.class.getMethod(command, new Class[] {BookAction.class}); e.putValue(HANDLER, m); log.debug("get action process for menu, " + command); } catch (Exception e1) { } } if (m == null) { log.warn("Not found action handler, for " + command); } else { try { m.invoke(this.menuActions, new Object[] {e}); } catch (Exception e1) { log.error(e1.toString(), e1.getCause()); } } }