use of org.apache.tapestry5.services.javascript.StylesheetLink in project tapestry-5 by apache.
the class AssetDemo method afterRender.
@Import(stylesheet = "context:css/via-import.css")
void afterRender() {
javascriptSupport.importStylesheet(new StylesheetLink(ieOnly, new StylesheetOptions(null, "IE")));
javascriptSupport.importJavaScriptLibrary(getAssetWithWrongChecksumUrl());
}
use of org.apache.tapestry5.services.javascript.StylesheetLink in project tapestry-5 by apache.
the class DocumentLinkerImpl method addStylesheetsToHead.
/**
* Locates the head element under the root ("html") element, creating it if necessary, and adds the stylesheets to
* it.
*
* @param root
* element of document
* @param stylesheets
* to add to the document
*/
protected void addStylesheetsToHead(Element root, List<StylesheetLink> stylesheets) {
int count = stylesheets.size();
if (count == 0) {
return;
}
// This only applies when the document is an HTML document. This may need to change in the
// future, perhaps configurable, to allow for html and xhtml and perhaps others. Does SVG
// use stylesheets?
String rootElementName = root.getName();
// Not an html document, don't add anything.
if (!rootElementName.equals("html")) {
return;
}
Element head = findOrCreateElement(root, "head", true);
// Create a temporary container element.
Element container = createTemporaryContainer(head, "style", "stylesheet-container");
for (int i = 0; i < count; i++) {
stylesheets.get(i).add(container);
}
container.pop();
}
use of org.apache.tapestry5.services.javascript.StylesheetLink in project tapestry-5 by apache.
the class PartialMarkupDocumentLinker method addStylesheetLink.
public void addStylesheetLink(StylesheetLink stylesheet) {
JSONObject object = new JSONObject("href", stylesheet.getURL(), "media", stylesheet.getOptions().media);
stylesheets.put(object);
}
Aggregations