Outline extends AbstractCssProperty<Outline> implements StateChangeInformer<CssProperty> { public static boolean isValid(final String cssValue) { if (cssValue == null || StringUtil.isBlank(cssValue)) { return false; } final List<String> cssValueParts = CssValueUtil.split(cssValue); OutlineColor outlineColor = null; OutlineStyle outlineStyle = null; OutlineWidth outlineWidth = null; for (final String eachPart : cssValueParts) { boolean invalid = true; if (outlineColor == null && OutlineColor.isValid(eachPart)) { outlineColor = new OutlineColor(eachPart); invalid = false; } else if (outlineStyle == null && OutlineStyle.isValid(eachPart)) { outlineStyle = OutlineStyle.getThis(eachPart); invalid = false; } else if (outlineWidth == null && OutlineWidth.isValid(eachPart)) { outlineWidth = new OutlineWidth(eachPart); invalid = false; } if (invalid) { return false; } } return outlineWidth != null || outlineStyle != null || outlineColor != null; } Outline();  Outline(final String cssValue);  Outline(final Outline outline); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override Outline setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); OutlineColor getOutlineColor(); OutlineStyle getOutlineStyle(); OutlineWidth getOutlineWidth(); Outline setOutlineWidth(final OutlineWidth outlineWidth); Outline setOutlineStyle(final OutlineStyle outlineStyle); Outline setOutlineColor(final OutlineColor outlineColor); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testIsValid() { assertTrue(Outline.isValid("55px solid green")); assertTrue(Outline.isValid("55px solid rgb(25, 255, 155)")); assertTrue(Outline.isValid("55px")); assertTrue(Outline.isValid("solid")); assertTrue(Outline.isValid("green")); assertTrue(Outline.isValid(OutlineWidth.MEDIUM + " " + OutlineStyle.DASHED.getCssValue() + " " + CssColorName.AZURE)); assertTrue(Outline.isValid(OutlineWidth.THICK + " " + OutlineStyle.DOUBLE.getCssValue() + " " + CssColorName.AZURE)); assertFalse(Outline.isValid("cir cle inside url(Test.png)")); assertFalse(Outline.isValid("dmedium dfdf dfdfd")); assertFalse(Outline.isValid("medium medium medium ")); assertFalse(Outline.isValid("55 solid green")); assertFalse(Outline.isValid("solid solid solid")); assertFalse(Outline.isValid("55px solid green green")); }