/** * constructor. * * @param menuItemConfig the menu configuration * @param resourcePath the resource path */ public MenuItem( final Application client, final ConfigMenuItem menuItemConfig, final String resourcePath) { this.setName(menuItemConfig.getName()); Action configAction = menuItemConfig.getAction(); if (configAction != null && configAction.getParentBean() != null && configAction.getParentBean() instanceof ConfigMenuItem) { ((ConfigMenuItem) configAction.getParentBean()).setChildaction(null); } if (configAction != null && configAction.getParentBean() != null && configAction.getParentBean() instanceof ConfigApplication) { final Action clonedAction = (Action) configAction.clone(); clonedAction.setParentBean(null); clonedAction.setContainer(null); this.setAction(clonedAction); } else { this.setAction(configAction); } Enabler configEnabler = menuItemConfig.getEnabler(); if (configEnabler != null && configEnabler.getParentBean() != null) { if (configEnabler.getParentBean() instanceof ConfigMenuItem) { ((ConfigMenuItem) configEnabler.getParentBean()).setEnabler(null); } } if (configEnabler != null && configEnabler.getParentBean() != null && configEnabler.getParentBean() instanceof Action) { final Enabler clonedEnabler = (Enabler) configEnabler.clone(); clonedEnabler.setParentBean(null); clonedEnabler.setContainer(null); this.setEnabler(clonedEnabler); } else { this.setEnabler(configEnabler); } }