@Test public void testParseAllSelectors() { Collection<String> selectors = SVGStyleTranslator.parseAllSelectors(element); assertNotNull(selectors); assertEquals(48, selectors.size()); assertArrayEquals(selectors.stream().toArray(String[]::new), ALL_SELECTORS.stream().toArray(String[]::new)); }
static List<String> parseAllSelectors(final Element element) { final List<Element> elements = getElementsTree(element); final List<String> result = new LinkedList<>(); for (final Element candidate : elements) { Collection<String> selectors = parseElementSelectors(candidate); if (result.isEmpty()) { result.addAll(selectors); } else { final List<String> parentSelectors = result.stream().collect(Collectors.toList()); for (String selector : selectors) { for (String parentSelector : parentSelectors) { result.add(selector + " " + parentSelector); } } } } return result; }
SVGStyleTranslator { static List<String> parseAllSelectors(final Element element) { final List<Element> elements = getElementsTree(element); final List<String> result = new LinkedList<>(); for (final Element candidate : elements) { Collection<String> selectors = parseElementSelectors(candidate); if (result.isEmpty()) { result.addAll(selectors); } else { final List<String> parentSelectors = result.stream().collect(Collectors.toList()); for (String selector : selectors) { for (String parentSelector : parentSelectors) { result.add(selector + " " + parentSelector); } } } } return result; } }
SVGStyleTranslator { static List<String> parseAllSelectors(final Element element) { final List<Element> elements = getElementsTree(element); final List<String> result = new LinkedList<>(); for (final Element candidate : elements) { Collection<String> selectors = parseElementSelectors(candidate); if (result.isEmpty()) { result.addAll(selectors); } else { final List<String> parentSelectors = result.stream().collect(Collectors.toList()); for (String selector : selectors) { for (String parentSelector : parentSelectors) { result.add(selector + " " + parentSelector); } } } } return result; } private  SVGStyleTranslator(); }
SVGStyleTranslator { static List<String> parseAllSelectors(final Element element) { final List<Element> elements = getElementsTree(element); final List<String> result = new LinkedList<>(); for (final Element candidate : elements) { Collection<String> selectors = parseElementSelectors(candidate); if (result.isEmpty()) { result.addAll(selectors); } else { final List<String> parentSelectors = result.stream().collect(Collectors.toList()); for (String selector : selectors) { for (String parentSelector : parentSelectors) { result.add(selector + " " + parentSelector); } } } } return result; } private  SVGStyleTranslator(); static TransformDefinition parseTransformDefinition(final Element element); static StyleSheetDefinition parseStyleSheetDefinition(final String cssPath,
                                                                 final InputStream cssStream); static StyleDefinition parseStyleDefinition(final Element element,
                                                       final String svgId,
                                                       final StyleSheetDefinition styleSheetDefinition); static String[] getClassNames(final Element element); }
SVGStyleTranslator { static List<String> parseAllSelectors(final Element element) { final List<Element> elements = getElementsTree(element); final List<String> result = new LinkedList<>(); for (final Element candidate : elements) { Collection<String> selectors = parseElementSelectors(candidate); if (result.isEmpty()) { result.addAll(selectors); } else { final List<String> parentSelectors = result.stream().collect(Collectors.toList()); for (String selector : selectors) { for (String parentSelector : parentSelectors) { result.add(selector + " " + parentSelector); } } } } return result; } private  SVGStyleTranslator(); static TransformDefinition parseTransformDefinition(final Element element); static StyleSheetDefinition parseStyleSheetDefinition(final String cssPath,
                                                                 final InputStream cssStream); static StyleDefinition parseStyleDefinition(final Element element,
                                                       final String svgId,
                                                       final StyleSheetDefinition styleSheetDefinition); static String[] getClassNames(final Element element); static final String ID; static final String OPACITY; static final String FILL; static final String FILL_OPACITY; static final String STROKE; static final String STROKE_OPACITY; static final String STROKE_WIDTH; static final String FONT_FAMILY; static final String STROKE_DASHARRAY; static final String FONT_SIZE; static final String STYLE; static final String CSS_CLASS; static final String TRANSFORM; static final String ATTR_VALUE_NONE; static final String[] ATTR_NAMES; }