private UIComponent addUIExtension(UIExtension extension, Map<String, Object> context) throws Exception { UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class); UIComponent component = manager.addUIExtension(extension, context, this); if (component == null) return null; synchronized (component) { if (component instanceof UIAbstractManagerComponent) { // You can access to the given extension and the extension is valid UIAbstractManagerComponent uiAbstractManagerComponent = (UIAbstractManagerComponent) component; uiAbstractManagerComponent.setUIExtensionName(extension.getName()); uiAbstractManagerComponent.setUIExtensionCategory(extension.getCategory()); return component; } else if (component != null) { // You can access to the given extension but the extension is not valid if (LOG.isWarnEnabled()) { LOG.warn( "All the extension '" + extension.getName() + "' of type '" + EXTENSION_TYPE + "' must be associated to a component of type " + UIAbstractManagerComponent.class); } removeChild(component.getClass()); } } return null; }
/** * Get UIComponent to process render a node which has specified mimeType * * @param mimeType * @param container * @return * @throws Exception */ public static UIComponent getUIComponent(String mimeType, UIContainer container) throws Exception { UIExtensionManager manager = WCMCoreUtils.getService(UIExtensionManager.class); List<UIExtension> extensions = manager.getUIExtensions(FILE_VIEWER_EXTENSION_TYPE); Map<String, Object> context = new HashMap<String, Object>(); context.put(MIME_TYPE, mimeType.toLowerCase()); for (UIExtension extension : extensions) { UIComponent uiComponent = manager.addUIExtension(extension, context, container); if (uiComponent != null) return uiComponent; } return null; }
public UIComponent getUIComponent(String mimeType) throws Exception { if (mimeType != null && !mimeType.startsWith("text") && !mimeType.startsWith("application")) { UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class); List<UIExtension> extensions = manager.getUIExtensions(org.exoplatform.ecm.webui.utils.Utils.FILE_VIEWER_EXTENSION_TYPE); Map<String, Object> context = new HashMap<String, Object>(); context.put(org.exoplatform.ecm.webui.utils.Utils.MIME_TYPE, mimeType); for (UIExtension extension : extensions) { UIComponent uiComponent = manager.addUIExtension(extension, context, this); if (uiComponent != null) return uiComponent; } } return null; }
public UIComponent getCreateLinkAction() throws Exception { UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class); UIExtension extension = manager.getUIExtension(EXTENSION_TYPE, CREATE_LINK); return addUIExtension(extension, null); }
public UIComponent getJCRMoveAction() throws Exception { UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class); UIExtension extension = manager.getUIExtension(EXTENSION_TYPE, MOVE_NODE); return addUIExtension(extension, null); }
private List<UIExtension> getUIExtensionList() { UIExtensionManager manager = getApplicationComponent(UIExtensionManager.class); return manager.getUIExtensions(EXTENSION_TYPE); }