/** * This is the same as {@link CSSFactory#getUsedStyles(Document, String, URL, MediaSpec, NetworkProcessor, Stylesheet)} * but a new StyleSheet is created instead of appending to one. * * @param doc * DOM tree * @param encoding * The default encoding used for the referenced style sheets * @param base * Base URL against which all files are searched * @param media * Selected media for style sheet * @param network * The network processor used for accessing the URL resources * @return the rules of all the style sheets used in the document including the inline styles */ public static final StyleSheet getUsedStyles(Document doc, String encoding, URL base, MediaSpec media, NetworkProcessor network) { StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock(); return getUsedStyles(doc, encoding, base, media, network, style); }
/** * Creates a single property declaration. * @param property Property name. * @param term Property value. * @return The resulting declaration. */ protected Declaration createDeclaration(String property, Term<?> term) { Declaration d = CSSFactory.getRuleFactory().createDeclaration(); d.unlock(); d.setProperty(property); d.add(term); return d; }
/** * Parses source of given type * * @param source Source, interpretation depends on {@code type} * @param type Type of source provided * @param inline InlineElement * @param inlinePriority True when the rule should have an 'inline' (greater) priority * @return Created StyleSheet * @throws IOException When problem with input stream occurs * @throws CSSException When unrecoverable exception during parsing occurs */ public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type, Element inline, boolean inlinePriority, URL base) throws IOException, CSSException { StyleSheet sheet = (StyleSheet) CSSFactory.getRuleFactory() .createStyleSheet().unlock(); Preparator preparator = new SimplePreparator(inline, inlinePriority); return parseAndImport(source, network, encoding, type, sheet, preparator, base, null); }
/** * Parses source of given type * * @param source Source, interpretation depends on {@code type} * @param type Type of source provided * @param inline InlineElement * @param inlinePriority True when the rule should have an 'inline' (greater) priority * @return Created StyleSheet * @throws IOException When problem with input stream occurs * @throws CSSException When unrecoverable exception during parsing occurs */ public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type, Element inline, boolean inlinePriority, URL base) throws IOException, CSSException { StyleSheet sheet = (StyleSheet) CSSFactory.getRuleFactory() .createStyleSheet().unlock(); Preparator preparator = new SimplePreparator(inline, inlinePriority); return parseAndImport(source, network, encoding, type, sheet, preparator, base, null); }
/** * Parses source of given type * * @param source * Source, interpretation depends on {@code type} * @param type * Type of source provided * @param inline * InlineElement * @param inlinePriority * True when the rule should have an 'inline' (greater) priority * @return Created StyleSheet * @throws IOException * When problem with input stream occurs * @throws CSSException * When unrecoverable exception during parsing occurs */ public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type, Element inline, boolean inlinePriority, URL base) throws IOException, CSSException { StyleSheet sheet = (StyleSheet) CSSFactory.getRuleFactory() .createStyleSheet().unlock(); Preparator preparator = new SimplePreparator(inline, inlinePriority); StyleSheet ret = parseAndImport(source, network, encoding, type, sheet, preparator, base, null); return ret; }
pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock(); traversal.listTraversal(style); return style;
(Object) pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock(); traversal.listTraversal(style); return style;
pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet().unlock(); traversal.listTraversal(style); return style;
/** * Parses source of given type * * @param source * Source, interpretation depends on {@code type} * @param type * Type of source provided * @param inline * InlineElement * @param inlinePriority * True when the rule should have an 'inline' (greater) priority * @return Created StyleSheet * @throws IOException * When problem with input stream occurs * @throws CSSException * When unrecoverable exception during parsing occurs */ public static StyleSheet parse(Object source, String encoding, SourceType type, Element inline, boolean inlinePriority, URL base) throws IOException, CSSException { StyleSheet sheet = (StyleSheet) CSSFactory.getRuleFactory() .createStyleSheet().unlock(); PriorityStrategy ps = new AtomicPriorityStrategy(lastPriority); Preparator preparator = new SimplePreparator(ps, inline, inlinePriority); CSSTreeParser parser = createParser(source, encoding, type, preparator, sheet, base); StyleSheet ret = type.parse(parser); lastPriority = ret.getLastMark(); return ret; }
(Object) pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet() .unlock(); traversal.listTraversal(style);
pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet() .unlock(); traversal.listTraversal(style);
(Object) pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet() .unlock(); traversal.listTraversal(style);
pair, NodeFilter.SHOW_ELEMENT); StyleSheet style = (StyleSheet) getRuleFactory().createStyleSheet() .unlock(); traversal.listTraversal(style);