/** * Assigns the default values to all the properties. * @param properties * @param values */ public void assignDefaults(Map<String, CSSProperty> properties, Map<String, Term<?>> values) { SupportedCSS css = CSSFactory.getSupportedCSS(); for (String name : names) { CSSProperty dp = css.getDefaultProperty(name); if (dp != null) properties.put(name, dp); Term<?> dv = css.getDefaultValue(name); if (dv != null) values.put(name, dv); } }
protected Map<String, Method> parsingMethods() { Map<String, Method> map = new HashMap<String, Method>(css .getTotalProperties(), 1.0f); for (String key : css.getDefinedPropertyNames()) { try { Method m = DeclarationTransformerImpl.class.getDeclaredMethod( DeclarationTransformerImpl.camelCase("process-" + key), Declaration.class, Map.class, Map.class); map.put(key, m); } catch (Exception e) { log.warn("Unable to find method for property {}.", key); } } log.info("Totally found {} parsing methods", map.size()); return map; }
public QuadrupleMapNodeData() { this.propertiesOwn = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.propertiesInh = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.valuesOwn = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.valuesInh = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.sourcesOwn = new HashMap<String, Declaration>(css.getTotalProperties(), 1.0f); this.sourcesInh = new HashMap<String, Declaration>(css.getTotalProperties(), 1.0f); }
if (!css.isSupportedCSSProperty(propertyName)) return false;
@Override public <T extends CSSProperty> T getSpecifiedProperty(String name) { T prop = getProperty(name, true); if (prop == null) { @SuppressWarnings("unchecked") T def = (T) css.getDefaultProperty(name); return def; } else { return prop; } }
@Override public Term<?> getSpecifiedValue(String name) { Term<?> ret = getValue(name, true); if (ret == null) ret = css.getDefaultValue(name); if (ret != null) { if (ret instanceof TermColor && ((TermColor) ret).getKeyword() == Keyword.CURRENT_COLOR) { //clone the value fot setting the current color final TermFactory tf = CSSFactory.getTermFactory(); ret = tf.createColor(tf.createIdent("currentColor")); //set the current color value TermColor cvalue = getValue(TermColor.class, "color", true); if (cvalue == null) cvalue = (TermColor) css.getDefaultValue("color"); ((TermColor) ret).setValue(cvalue.getValue()); } } return ret; }
public void analyse(Collection<URI> sheetURIs, Collection<String> embeddedCSS, URI embedContainerURI, NetworkProcessor network) throws IOException, URISyntaxException, CSSException { if (!SupportedCSS.isSupportedMedia(Medium)) { throw new IllegalStateException("medium '" + Medium + "' is not supported"); } List<URI> alluris = new ArrayList<URI>(); List<String> csscode = new ArrayList<String>(embeddedCSS); for (int k = 0; k < embeddedCSS.size(); ++k) alluris.add(embedContainerURI); for (URI uri : sheetURIs) { if (uri != null) { alluris.add(uri); csscode.add(IOUtils.toString(uri.toURL().openStream(), "UTF-8")); } } List<StyleSheet> styleSheets = new ArrayList<StyleSheet>(); for (int k = 0; k < csscode.size(); ++k) { String basePath = alluris.get(k).resolve(".").toString(); String withAbsURL = makeURLabsolute(csscode.get(k), basePath); styleSheets.add(parserFactory.parse(withAbsURL, network, null, SourceType.EMBEDDED, new URL("http://base"))); /* * we cannot use CSSFactory.parse(withAbsURL) because it tries to * convert the null base URL into a String */ } mAnalyzer = new Analyzer(styleSheets); }
public QuadrupleMapNodeData() { this.propertiesOwn = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.propertiesInh = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.valuesOwn = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.valuesInh = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.sourcesOwn = new HashMap<String, Declaration>(css.getTotalProperties(), 1.0f); this.sourcesInh = new HashMap<String, Declaration>(css.getTotalProperties(), 1.0f); }
if (!css.isSupportedCSSProperty(propertyName)) return false;
@Override public <T extends CSSProperty> T getSpecifiedProperty(String name) { T prop = getProperty(name, true); if (prop == null) { @SuppressWarnings("unchecked") T def = (T) css.getDefaultProperty(name); return def; } else { return prop; } }
@Override public Term<?> getSpecifiedValue(String name) { Term<?> ret = getValue(name, true); if (ret == null) ret = css.getDefaultValue(name); if (ret != null) { if (ret instanceof TermColor && ((TermColor) ret).getKeyword() == Keyword.CURRENT_COLOR) { //clone the value fot setting the current color final TermFactory tf = CSSFactory.getTermFactory(); ret = tf.createColor(tf.createIdent("currentColor")); //set the current color value TermColor cvalue = getValue(TermColor.class, "color", true); if (cvalue == null) cvalue = (TermColor) css.getDefaultValue("color"); ((TermColor) ret).setValue(cvalue.getValue()); } } return ret; }
if(css.isSupportedMedia(m)) affected.add(m);
/** * Assigns the default values to all the properties. * @param properties * @param values */ public void assignDefaults(Map<String, CSSProperty> properties, Map<String, Term<?>> values) { SupportedCSS css = CSSFactory.getSupportedCSS(); for (String name : names) { CSSProperty dp = css.getDefaultProperty(name); if (dp != null) properties.put(name, dp); Term<?> dv = css.getDefaultValue(name); if (dv != null) values.put(name, dv); } }
protected Map<String, Method> parsingMethods() { Map<String, Method> map = new HashMap<String, Method>(css .getTotalProperties(), 1.0f); for (String key : css.getDefinedPropertyNames()) { try { Method m = DeclarationTransformer.class.getDeclaredMethod( DeclarationTransformer.camelCase("process-" + key), Declaration.class, Map.class, Map.class); map.put(key, m); } catch (Exception e) { log.warn("Unable to find method for property {}.", key); } } log.info("Totally found {} parsing methods", map.size()); return map; }
public QuadrupleMapNodeData() { this.propertiesOwn = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.propertiesInh = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.valuesOwn = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.valuesInh = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); }
if (!css.isSupportedCSSProperty(propertyName)) return false;
if(css.isSupportedMedia(mText)) media.append(mText); else if(css.isSupportedMedia(mText)) media.append(",").append(mText); else
/** * Assigns the default values to all the properties. * @param properties * @param values */ public void assignDefaults(Map<String, CSSProperty> properties, Map<String, Term<?>> values) { SupportedCSS css = CSSFactory.getSupportedCSS(); for (String name : names) { CSSProperty dp = css.getDefaultProperty(name); if (dp != null) properties.put(name, dp); Term<?> dv = css.getDefaultValue(name); if (dv != null) values.put(name, dv); } }
protected Map<String, Method> parsingMethods() { Map<String, Method> map = new HashMap<String, Method>(css .getTotalProperties(), 1.0f); for (String key : css.getDefinedPropertyNames()) { try { Method m = DeclarationTransformer.class.getDeclaredMethod( DeclarationTransformer.camelCase("process-" + key), Declaration.class, Map.class, Map.class); map.put(key, m); } catch (Exception e) { log.warn("Unable to find method for property {}.", key); } } log.info("Totally found {} parsing methods", map.size()); return map; }
public QuadrupleMapNodeData() { this.propertiesOwn = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.propertiesInh = new HashMap<String, CSSProperty>(css.getTotalProperties(), 1.0f); this.valuesOwn = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.valuesInh = new HashMap<String, Term<?>>(css.getTotalProperties(), 1.0f); this.sourcesOwn = new HashMap<String, Declaration>(css.getTotalProperties(), 1.0f); this.sourcesInh = new HashMap<String, Declaration>(css.getTotalProperties(), 1.0f); }