@Test public void testParseElementSelectorsForRoot() { Collection<String> selectors = SVGStyleTranslator.parseElementSelectors(root); assertNotNull(selectors); assertEquals(3, selectors.size()); assertTrue(selectors.contains("#" + ID_ROOT)); assertTrue(selectors.contains(".cr1")); assertTrue(selectors.contains(".cr2")); }
static Collection<String> parseElementSelectors(final Element element) { final List<String> result = new LinkedList<>(); final String cssClassRaw = getStyleDeclaration(element); if (!isEmpty(cssClassRaw)) { Arrays.stream(cssClassRaw.split(PATTERN_CLASSNAME_SEPARATOR)) .map(c -> "." + c) .forEach(result::add); } final String id = element.getAttribute(ID); if (!isEmpty(id)) { result.add("#" + id); } return result; }
SVGStyleTranslator { static Collection<String> parseElementSelectors(final Element element) { final List<String> result = new LinkedList<>(); final String cssClassRaw = getStyleDeclaration(element); if (!isEmpty(cssClassRaw)) { Arrays.stream(cssClassRaw.split(PATTERN_CLASSNAME_SEPARATOR)) .map(c -> "." + c) .forEach(result::add); } final String id = element.getAttribute(ID); if (!isEmpty(id)) { result.add("#" + id); } return result; } }
SVGStyleTranslator { static Collection<String> parseElementSelectors(final Element element) { final List<String> result = new LinkedList<>(); final String cssClassRaw = getStyleDeclaration(element); if (!isEmpty(cssClassRaw)) { Arrays.stream(cssClassRaw.split(PATTERN_CLASSNAME_SEPARATOR)) .map(c -> "." + c) .forEach(result::add); } final String id = element.getAttribute(ID); if (!isEmpty(id)) { result.add("#" + id); } return result; } private  SVGStyleTranslator(); }
SVGStyleTranslator { static Collection<String> parseElementSelectors(final Element element) { final List<String> result = new LinkedList<>(); final String cssClassRaw = getStyleDeclaration(element); if (!isEmpty(cssClassRaw)) { Arrays.stream(cssClassRaw.split(PATTERN_CLASSNAME_SEPARATOR)) .map(c -> "." + c) .forEach(result::add); } final String id = element.getAttribute(ID); if (!isEmpty(id)) { result.add("#" + id); } 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 Collection<String> parseElementSelectors(final Element element) { final List<String> result = new LinkedList<>(); final String cssClassRaw = getStyleDeclaration(element); if (!isEmpty(cssClassRaw)) { Arrays.stream(cssClassRaw.split(PATTERN_CLASSNAME_SEPARATOR)) .map(c -> "." + c) .forEach(result::add); } final String id = element.getAttribute(ID); if (!isEmpty(id)) { result.add("#" + id); } 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; }