protected static StyleSheet addRulesToStyleSheet(RuleList rules, StyleSheet sheet) { if (rules != null) { for (RuleBlock<?> rule : rules) { sheet.add(rule); } } return sheet; }
public StyleSheet createStyleSheet(StyleSheet.Origin origin) { StyleSheet ret = new StyleSheetImpl(); ret.setOrigin(origin); return ret; } }
/** * 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); }
final StyleSheet.Origin origin = (sheet == null) ? StyleSheet.Origin.AGENT : sheet.getOrigin();
/** * 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; }
Element inline, boolean inlinePriority, StyleSheet sheet, URL base) throws IOException, CSSException { Priority start = sheet.getLastMark(); if (start == null) start = lastPriority; lastPriority = ret.getLastMark(); return ret;
/** * 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); }
final StyleSheet.Origin origin = (sheet == null) ? StyleSheet.Origin.AGENT : sheet.getOrigin();
/** * 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); }
StyleSheet.Origin origin = (sheet == null) ? StyleSheet.Origin.AGENT : sheet.getOrigin();
public StyleSheet createStyleSheet(StyleSheet.Origin origin) { StyleSheet ret = new StyleSheetImpl(); ret.setOrigin(origin); return ret; } }
protected static StyleSheet addRulesToStyleSheet(RuleList rules, StyleSheet sheet) { if (rules != null) { for (RuleBlock<?> rule : rules) { sheet.add(rule); } } return sheet; }
/** * 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; }
StyleSheet.Origin origin = (sheet == null) ? StyleSheet.Origin.AGENT : sheet.getOrigin();
public StyleSheet createStyleSheet(StyleSheet.Origin origin) { StyleSheet ret = new StyleSheetImpl(); ret.setOrigin(origin); return ret; } }
protected static StyleSheet addRulesToStyleSheet(RuleList rules, StyleSheet sheet) { if (rules != null) { for (RuleBlock<?> rule : rules) { sheet.add(rule); } } return sheet; }
StyleSheet stylesheet; if (medium.equals("embossed")) { stylesheet = (StyleSheet)brailleRuleFactory.createStyleSheet().unlock(); if (defaultSheets != null) for (URL sheet : defaultSheets) style.otherAtRules = filter(stylesheet, AnyAtRule.class); } else if (medium.equals("print")) { stylesheet = (StyleSheet)printRuleFactory.createStyleSheet().unlock(); if (defaultSheets != null) for (URL sheet : defaultSheets) {
if (sheet == null) log.warn("No source style sheet set for rule: {}", rule.toString()); StyleSheet.Origin origin = (sheet == null) ? StyleSheet.Origin.AGENT : sheet.getOrigin();