@Override public Object apply(List<String> args) throws TemplateModelException { return uri(getContext().getURI(route, merge(args))); } }
@Override public Iterable<Script> getHeaderScripts() { if (jsFileData != null) { return ImmutableList.of(new Script(context, context.getURI(config.file(), config.jsFileUrl()))); } else { return ImmutableList.of(); } } };
private boolean prepareContentXML(RenderContext context, Object o) { if (o instanceof Content) { final Content c = (Content) o; final Map<String, Object> local = c.getLocalValues(); if (local.get(Model.XML) == null) { local.put(Model.XML, Model.loadXML(c.getContent())); } final ContentKey key = c.getContentKey(); if (key != null) { local.put(Model.HREF, context.getURI(PageKey.content(key))); } return true; } return false; }
String getURI(final RenderContext context) { if (config == null) { return null; } FileId file = config.file(); if (file != null) { return context.getURI(file).toASCIIString(); } String name = config.name(); if (name == null) { return null; } if (moduleConfig != null) { file = moduleConfig.bundle(); if (file != null) { try { fileLoader.loadFromBundle(file, name); return context.getURI(file, name).toASCIIString(); } catch (Exception e) {} } } if (imgUri != null) { return imgUri.getURI(context, name); } return null; }
String getURI(final RenderContext context) { if (config == null) { return null; } FileId file = config.file(); if (file != null) { return context.getURI(file).toASCIIString(); } String name = config.name(); if (name == null) { return null; } if (moduleConfig != null) { file = moduleConfig.bundle(); if (file != null) { try { fileLoader.loadFromBundle(file, name); return context.getURI(file, name).toASCIIString(); } catch (Exception e) {} } } if (imgUri != null) { return imgUri.getURI(context, name); } return null; }
@Override public HTMLFragment getBody() { if (flashFileData == null) { return HTMLFragments.empty(); } String flashUri = context.getURI(config.file(), componentConfig.fileUrl()).toASCIIString(); final HTML html = HTML.create(context); final Tag div = html.div(); final Tag objectParent; // Script tag if (jsFileData != null) { div.javascript().add( "AC_FL_RunContent('codebase','" + CODEBASE + "','width','" + componentConfig.width().toString() + "','height','" + componentConfig.height().toString() + "','src','" + flashUri.substring(0, flashUri.length() - 4) + "','quality','" + QUALITY + "','pluginspage','" + PLUGINSPAGE + "','movie','" + flashUri.substring(0, flashUri.length() - 4) + "');"); objectParent = div.tag(HTMLConstants.NOSCRIPT); } else { objectParent = div; } Tag object = objectParent.object(componentConfig.height().toString(), componentConfig.width() .toString(), CODEBASE, CLASSID); object.p(componentConfig.alt()); object.param("movie", flashUri); object.param("quality", "high"); object.embed(componentConfig.height().toString(), componentConfig.width().toString(), TYPE, PLUGINSPAGE, QUALITY, flashUri); return html; }
String getA(final RenderContext context) { if (config == null) { return null; } final Category cg = config.category(); final ContentType ct = config.contentType(); PageKey pk = null; if (cg != null && ct != null) { pk = PageKey.contentType(NavigationKey.category(cg, ct)); } else if (ct != null) { pk = PageKey.contentType(ct); } else if (cg != null) { pk = PageKey.navigation(cg); } if (pk != null) { return context.getURI(pk).toASCIIString(); } return config.link(); }
return context.getURI(pk).toASCIIString();