private String buildUrl(ModuleContextParameters moduleContextParameters, Optional<String> uiParameters, String namespace) { if (redirect) { return connectUriFactory.createRedirectServletUri(addOnKey, namespace, moduleContextParameters); } return connectUriFactory.createConnectAddonUriBuilder() .addon(addOnKey) .namespace(namespace) .urlTemplate(urlTemplate) .context(moduleContextParameters) .uiParams(uiParameters) .dialog(isDialog) .sign(sign) .build(); }
public IFrameContextImpl(IFrameContext iframeContext, String namespaceSuffix) { this(iframeContext.getPluginKey(), iframeContext.getIframePath(), iframeContext.getNamespace() + namespaceSuffix, iframeContext.getIFrameParams()); }
protected ConnectIFrameBuilder.TemplatedBuilder setIFrameTemplate(ConnectIFrameBuilder.ModuleUriBuilder builder) { return builder.pageTemplate(); }
private ModuleDescriptor<ConnectIFrame> createPageIFrame(ConnectPageModuleBean page, ConnectAddonBean connectAddonBean) { ConnectIFrameBuilder.ModuleUriBuilder moduleUriBuilder = connectIFrameBuilderFactory.builder() .addon(connectAddonBean.getKey()) .module(page.getKey(connectAddonBean)); ConnectIFrameBuilder.InitializedBuilder builder = setIFrameTemplate(moduleUriBuilder) .urlTemplate(page.getUrl()) .decorator(getDecorator()) .conditions(page.getConditions()) .conditionClasses(getConditionClasses()) .title(page.getDisplayName()) .resizeToParent(true); // allow subclasses to customize the IFrame builder = customizeIFrameBuilder(builder, page, connectAddonBean); return iFrameModuleDescriptorGenerator.createModuleDescriptor( new ConnectIFrameBean(builder.build(), page.getRawKey(), Optional.empty()), connectAddonBean); }
private ConnectIFrame createPageIFrame(ConnectPageModuleBean page, ConnectAddonBean connectAddonBean) { return connectIFrameBuilderFactory.builder() .addon(connectAddonBean.getKey()) .module(page.getRawKey()) .pageTemplate() .urlTemplate(page.getUrl()) .decorator(getDecorator()) .conditions(getPageAndAdditionalConditions(page)) .title(page.getDisplayName()) .resizeToParent(true) .build(); }
private ModuleDescriptor<ConnectIFrame> createRawIFrame(ConnectPageModuleBean page, ConnectAddonBean connectAddonBean) { ConnectIFrameBuilder.ModuleUriBuilder moduleUriBuilder = connectIFrameBuilderFactory.builder() .addon(connectAddonBean.getKey()) .module(page.getKey(connectAddonBean)); ConnectIFrameBuilder.InitializedBuilder builder = setRawIFrameTemplate(moduleUriBuilder) .urlTemplate(page.getUrl()) .conditions(page.getConditions()) .conditionClasses(getConditionClasses()) .dimensions("100%", "100%"); // the client (js) will size the parent of the iframe // allow subclasses to customize the IFrame builder = customizeIFrameBuilder(builder, page, connectAddonBean); return iFrameModuleDescriptorGenerator.createModuleDescriptor( new ConnectIFrameBean(builder.build(), page.getRawKey(), Optional.of(RAW_CLASSIFIER)), connectAddonBean); }
private ConnectIFrame createRawIFrame(ConnectPageModuleBean page, ConnectAddonBean connectAddonBean) { return connectIFrameBuilderFactory.builder() .addon(connectAddonBean.getKey()) .module(page.getRawKey()) .genericBodyTemplate() .urlTemplate(page.getUrl()) .title(page.getDisplayName()) .conditions(getPageAndAdditionalConditions(page)) .dimensions("100%", "100%") // the client (js) will size the parent of the iframe .build(); }
protected void registerIframeRenderStrategy(ConnectPageModuleBean page, ConnectAddonBean connectAddonBean) { // register a render strategy for our iframe page IFrameRenderStrategy pageRenderStrategy = iFrameRenderStrategyBuilderFactory.builder() .addOn(connectAddonBean.getKey()) .module(page.getKey(connectAddonBean)) .pageTemplate() .urlTemplate(page.getUrl()) .decorator(getDecorator()) .conditions(page.getConditions()) .conditionClasses(getConditionClasses()) .title(page.getDisplayName()) .resizeToParent(true) .build(); iFrameRenderStrategyRegistry.register(connectAddonBean.getKey(), page.getRawKey(), pageRenderStrategy); // and an additional strategy for raw content, in case the user wants to use it as a dialog target IFrameRenderStrategy rawRenderStrategy = iFrameRenderStrategyBuilderFactory.builder() .addOn(connectAddonBean.getKey()) .module(page.getKey(connectAddonBean)) .genericBodyTemplate() .urlTemplate(page.getUrl()) .conditions(page.getConditions()) .conditionClasses(getConditionClasses()) .dimensions("100%", "100%") // the client (js) will size the parent of the iframe .build(); iFrameRenderStrategyRegistry.register(connectAddonBean.getKey(), page.getRawKey(), RAW_CLASSIFIER, rawRenderStrategy); }
@Override public List<ModuleDescriptor<?>> createPluginModuleDescriptors(List<ConnectPageModuleBean> modules, ConnectAddonBean addon) { List<ModuleDescriptor<?>> descriptors = new ArrayList<>(); for (ConnectPageModuleBean bean : modules) { if (hasWebItem()) { WebItemModuleBean webItemBean = createWebItemModuleBean(bean, ConnectIFrameServletPath.forModule(addon.getKey(), bean.getRawKey())); descriptors.add(webItemModuleDescriptorFactory.createModuleDescriptor( webItemBean, addon, getAdditionalConditions())); } descriptors.add(iFrameModuleDescriptorGenerator.createModuleDescriptor( new ConnectIFrameBean(createPageIFrame(bean, addon), bean.getRawKey(), Optional.empty()), addon.getKey())); descriptors.add(iFrameModuleDescriptorGenerator.createModuleDescriptor( new ConnectIFrameBean(createRawIFrame(bean, addon), bean.getRawKey(), Optional.of(RAW_CLASSIFIER)), addon.getKey())); } return descriptors; }
@Override public String createConnectIFrameServletUri(final String addOnKey, final String moduleKey, final ModuleContextParameters moduleContext) { return urlVariableSubstitutor.append(ConnectIFrameServletPath.forModule(addOnKey, moduleKey), moduleContext); }
@Override public ConnectIFrameModuleDescriptor createModuleDescriptor(ConnectIFrameBean bean, String addonKey) { return createModuleDescriptor(bean.getConnectIFrame(), ConnectIFrameModuleDescriptorGenerator.getModuleKey(addonKey, bean.getModuleKey(), bean.getClassifier())); }
public static String renderAccessDeniedToString(ConnectIFrame connectIFrame) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { connectIFrame.renderAccessDenied(new OutputStreamWriter(out)); } catch (IOException e) { // no I/O, so no IOException.. right? throw new IllegalStateException(e); } return out.toString(); }
private Collection<TypedPluginModule> serializeConnectIframes(ConnectPageModuleBean module, ConnectAddonBean addon) { String pageIframePluginModuleKey = ConnectIFrameModuleDescriptorGenerator.getModuleKey(addon.getKey(), module.getRawKey(), Optional.empty()); TypedPluginModule pageIframePluginModule = TypedPluginModule.of(ConnectIFrame.IFRAME_PLUGIN_MODULE_DESERIALIZER_IDENTIFIER, pageIframePluginModuleKey, createPageIFrame(module, addon).serialize()); String rawIframepluginModuleKey = ConnectIFrameModuleDescriptorGenerator.getModuleKey(addon.getKey(), module.getRawKey(), Optional.of(RAW_CLASSIFIER)); TypedPluginModule rawIframePluginModule = TypedPluginModule.of(ConnectIFrame.IFRAME_PLUGIN_MODULE_DESERIALIZER_IDENTIFIER, rawIframepluginModuleKey, createRawIFrame(module, addon).serialize()); return ImmutableList.of(pageIframePluginModule, rawIframePluginModule); }
protected ConnectIFrameBuilder.TemplatedBuilder setRawIFrameTemplate(ConnectIFrameBuilder.ModuleUriBuilder builder) { return builder.genericBodyTemplate(); }
@Override public ConnectIFrameModuleDescriptor createModuleDescriptor(ConnectIFrame iframe, String pluginModuleKey) { ConnectIFrameModuleDescriptor iFrameModuleDescriptor = new ConnectIFrameModuleDescriptor(moduleFactory, iframe); Element iFrameModule = new DOMElement("connect-iframe"); iFrameModule.addAttribute("key", pluginModuleKey); iFrameModuleDescriptor.init(pluginRetrievalService.getPlugin(), iFrameModule); return iFrameModuleDescriptor; } }
private String buildUrl(ModuleContextParameters moduleContextParameters, Optional<String> uiParameters, String namespace) { if (redirect) { return connectUriFactory.createRedirectServletUri(addOnKey, namespace, moduleContextParameters); } return connectUriFactory.createConnectAddonUriBuilder() .addon(addOnKey) .namespace(namespace) .urlTemplate(urlTemplate) .context(moduleContextParameters) .uiParams(uiParameters) .dialog(isDialog) .sign(sign) .build(); }
public IFrameContextImpl(IFrameContext iframeContext, String namespaceSuffix) { this(iframeContext.getPluginKey(), iframeContext.getIframePath(), iframeContext.getNamespace() + namespaceSuffix, iframeContext.getIFrameParams()); }
@Override public KeyboardShortcutOperation mapToOperation(String addOnKey, String moduleKey) { return KeyboardShortcutOperation.goTo(ConnectIFrameServletPath.forModule(addOnKey, moduleKey)); } }, DIALOG {
public static String renderAccessDeniedToString(ConnectIFrame connectIFrame) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { connectIFrame.renderAccessDenied(new OutputStreamWriter(out)); } catch (IOException e) { // no I/O, so no IOException.. right? throw new IllegalStateException(e); } return out.toString(); }
@Override public String createConnectIFrameServletUri(final String addOnKey, final String moduleKey, final ModuleContextParameters moduleContext) { return urlVariableSubstitutor.append(ConnectIFrameServletPath.forModule(addOnKey, moduleKey), moduleContext); }