@Test public void getColorTest() { verifyEqualColor(Color.RED, "#FF0000"); verifyEqualColor(Color.RED, "#FFFF0000"); verifyEqualColor(Color.GREEN, "#00ff00"); verifyEqualColor(Color.BLUE, "#Ff0000Ff"); verifyEqualColor(Color.BLACK, "#ff000000"); verifyEqualColor(Color.WHITE, "#ffFFff"); verifyEqualColor(Color.TRANSPARENT, "#00000000"); verifyInvalidgetColor("#FF000"); verifyInvalidgetColor("#00FF000"); verifyInvalidgetColor("FF0000"); verifyInvalidgetColor("00FF0000"); verifyInvalidgetColor("#FF00000"); verifyInvalidgetColor("#00FF00000"); verifyInvalidgetColor(" #FF0000"); verifyInvalidgetColor("# FF0000"); verifyInvalidgetColor("#FF0000 "); verifyInvalidgetColor("#FFGGFF"); verifyInvalidgetColor("#FFggFF"); verifyInvalidgetColor(""); }
public static int getColor(GraphicFactory graphicFactory, String colorString) { if (colorString.isEmpty() || colorString.charAt(0) != '#') { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } else if (colorString.length() == 7) { return getColor(graphicFactory, colorString, 255, 1); } else if (colorString.length() == 9) { return getColor(graphicFactory, colorString, Integer.parseInt(colorString.substring(1, 3), 16), 3); } else { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } }
XmlUtils { public static int getColor(GraphicFactory graphicFactory, String colorString) { if (colorString.isEmpty() || colorString.charAt(0) != '#') { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } else if (colorString.length() == 7) { return getColor(graphicFactory, colorString, 255, 1); } else if (colorString.length() == 9) { return getColor(graphicFactory, colorString, Integer.parseInt(colorString.substring(1, 3), 16), 3); } else { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } } }
XmlUtils { public static int getColor(GraphicFactory graphicFactory, String colorString) { if (colorString.isEmpty() || colorString.charAt(0) != '#') { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } else if (colorString.length() == 7) { return getColor(graphicFactory, colorString, 255, 1); } else if (colorString.length() == 9) { return getColor(graphicFactory, colorString, Integer.parseInt(colorString.substring(1, 3), 16), 3); } else { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } } private  XmlUtils(); }
XmlUtils { public static int getColor(GraphicFactory graphicFactory, String colorString) { if (colorString.isEmpty() || colorString.charAt(0) != '#') { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } else if (colorString.length() == 7) { return getColor(graphicFactory, colorString, 255, 1); } else if (colorString.length() == 9) { return getColor(graphicFactory, colorString, Integer.parseInt(colorString.substring(1, 3), 16), 3); } else { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } } private  XmlUtils(); static void checkMandatoryAttribute(String elementName, String attributeName, Object attributeValue); static ResourceBitmap createBitmap(GraphicFactory graphicFactory, DisplayModel displayModel,
			String relativePathPrefix, String src); static SAXException createSAXException(String element, String name, String value, int attributeIndex); static int getColor(GraphicFactory graphicFactory, String colorString); static byte parseNonNegativeByte(String name, String value); static float parseNonNegativeFloat(String name, String value); static int parseNonNegativeInteger(String name, String value); }
XmlUtils { public static int getColor(GraphicFactory graphicFactory, String colorString) { if (colorString.isEmpty() || colorString.charAt(0) != '#') { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } else if (colorString.length() == 7) { return getColor(graphicFactory, colorString, 255, 1); } else if (colorString.length() == 9) { return getColor(graphicFactory, colorString, Integer.parseInt(colorString.substring(1, 3), 16), 3); } else { throw new IllegalArgumentException(UNSUPPORTED_COLOR_FORMAT + colorString); } } private  XmlUtils(); static void checkMandatoryAttribute(String elementName, String attributeName, Object attributeValue); static ResourceBitmap createBitmap(GraphicFactory graphicFactory, DisplayModel displayModel,
			String relativePathPrefix, String src); static SAXException createSAXException(String element, String name, String value, int attributeIndex); static int getColor(GraphicFactory graphicFactory, String colorString); static byte parseNonNegativeByte(String name, String value); static float parseNonNegativeFloat(String name, String value); static int parseNonNegativeInteger(String name, String value); static boolean supportOlderRenderThemes; }