Package org.zkoss.web.servlet

Examples of org.zkoss.web.servlet.StyleSheet


    final List sses = new LinkedList(); //a list of StyleSheet
    for (Iterator it = LanguageDefinition.getByDeviceType(deviceType).iterator();
    it.hasNext();) {
      final LanguageDefinition langdef = (LanguageDefinition)it.next();
      for (Iterator e = langdef.getStyleSheets().iterator(); e.hasNext();) {
        final StyleSheet ss = (StyleSheet)e.next();
        if (!disabled.contains(ss.getHref()))
          sses.add(ss);
      }
    }

    //Process configuration
    final ThemeProvider themeProvider = config.getThemeProvider();
    if (themeProvider != null) {
      final List orgss = new LinkedList();
      for (Iterator it =  sses.iterator(); it.hasNext();) {
        final StyleSheet ss = (StyleSheet)it.next();
        final String href = ss.getHref();
        if (href != null && href.length() > 0)
          orgss.add(ss.getMedia() != null ? ss: (Object)href); //we don't support getContent
      }

      final String[] hrefs = config.getThemeURIs();
      for (int j = 0; j < hrefs.length; ++j)
        orgss.add(hrefs[j]);

      sses.clear();
      final Collection res = themeProvider.getThemeURIs(exec, orgss);
      if (res != null) {
        for (Iterator it = res.iterator(); it.hasNext();) {
          final Object re = it.next();
          sses.add(re instanceof StyleSheet ? (StyleSheet)re:
            new StyleSheet((String)re, "text/css"));
        }
      }
    } else {
      final String[] hrefs = config.getThemeURIs();
      for (int j = 0; j < hrefs.length; ++j)
        sses.add(new StyleSheet(hrefs[j], "text/css"));
    }
    return sses;
  }
View Full Code Here


    for (Iterator it = root.getElements("stylesheet").iterator();
    it.hasNext();) {
      final Element el = (Element)it.next();
      final String href = el.getAttributeValue("href");
      final String ctn = el.getText(true);
      final StyleSheet ss;
      if (href != null && href.length() > 0) {
        if (ctn != null && ctn.length() > 0)
          throw new UiException("You cannot specify the content if the href attribute is specified, "+el.getLocator());
        ss = new StyleSheet(href, el.getAttributeValue("type"), el.getAttributeValue("media"), false);
      } else if (ctn != null && ctn.length() > 0) {
        ss = new StyleSheet(ctn, el.getAttributeValue("type"), el.getAttributeValue("media"), true);
      } else {
        throw new UiException("You must specify either the href attribute or the content, "+el.getLocator());
      }
      langdef.addStyleSheet(ss);
    }
View Full Code Here

TOP

Related Classes of org.zkoss.web.servlet.StyleSheet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.