@Override public void run() { userActionsLog.trace("Menu item {} triggered", item.getId()); StopWatch sw = createStopWatch(item); Object beanInstance = beanLocator.get(bean); try { Method methodWithParams = MethodUtils.getAccessibleMethod(beanInstance.getClass(), beanMethod, Map.class); if (methodWithParams != null) { methodWithParams.invoke(beanInstance, params); return; } Method methodWithScreen = MethodUtils.getAccessibleMethod(beanInstance.getClass(), beanMethod, FrameOwner.class); if (methodWithScreen != null) { methodWithScreen.invoke(beanInstance, origin); return; } MethodUtils.invokeMethod(beanInstance, beanMethod, (Object[]) null); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Unable to execute bean method", e); } sw.stop(); }
builder.put(element.attributeValue("name"), loadEntityInstance(info));
@Override public void accept(SideMenu.MenuItem menuItem) { SideMenu menu = menuItem.getMenu(); FrameOwner frameOwner = menu.getFrame().getFrameOwner(); MenuItemCommand command = menuItemCommands.create(frameOwner, item); command.run(); } }
/** * Create menu command. * * @param item menu item * @return command */ public MenuItemCommand create(FrameOwner origin, MenuItem item) { Map<String, Object> params = loadParams(item.getDescriptor(), item.getScreen()); if (StringUtils.isNotEmpty(item.getScreen())) { return new ScreenCommand(origin, item, item.getScreen(), item.getDescriptor(), params); } if (StringUtils.isNotEmpty(item.getRunnableClass())) { return new RunnableClassCommand(origin, item, item.getRunnableClass(), params); } if (StringUtils.isNotEmpty(item.getBean())) { return new BeanCommand(origin, item, item.getBean(), item.getBeanMethod(), params); } return null; }
@Override public void accept(AppMenu.MenuItem menuItem) { AppMenu menu = menuItem.getMenu(); FrameOwner frameOwner = menu.getFrame().getFrameOwner(); MenuItemCommand command = menuItemCommands.create(frameOwner, item); command.run(); } }
userActionsLog.trace("Menu item {} triggered", item.getId()); StopWatch sw = createStopWatch(item);
userActionsLog.trace("Menu item {} triggered", item.getId()); StopWatch sw = createStopWatch(item);