Columns extends AbstractCssProperty<Columns> implements StateChangeInformer<CssProperty> { public static boolean isValid(final String cssValue) { if (cssValue == null || StringUtil.isBlank(cssValue)) { return false; } final String[] cssValueParts = StringUtil.splitBySpace(cssValue); ColumnWidth columnWidth = null; ColumnCount columnCount = null; for (final String eachPart : cssValueParts) { boolean invalid = true; if (columnWidth == null && ColumnWidth.isValid(eachPart)) { columnWidth = new ColumnWidth(eachPart); invalid = false; } else if (columnCount == null && ColumnCount.isValid(eachPart)) { columnCount = new ColumnCount(eachPart); invalid = false; } if (invalid) { return false; } } return columnWidth != null || columnCount != null; } Columns();  Columns(final String cssValue);  Columns(final Columns columns); @Override String getCssName(); @Override String getCssValue(); @Override String toString(); @Override Columns setCssValue(final String cssValue); static boolean isValid(final String cssValue); void setAsInitial(); void setAsInherit(); ColumnWidth getColumnWidth(); ColumnCount getColumnCount(); Columns setColumnWidth(final ColumnWidth columnWidth); Columns setColumnCount(final ColumnCount columnCount); @Override void stateChanged(final CssProperty stateChangedObject); static final String INITIAL; static final String INHERIT; }
@Test public void testIsValid() { assertTrue(Columns.isValid("55px 5")); assertTrue(Columns.isValid("auto")); assertTrue(Columns.isValid(Columns.INHERIT)); assertTrue(Columns.isValid(Columns.INITIAL)); assertTrue(Columns.isValid("5")); assertTrue(Columns.isValid("55px")); assertFalse(Columns.isValid("cir cle inside url(Test.png)")); assertFalse(Columns.isValid("dircle inside url(Test.png)")); assertFalse(Columns.isValid("circle ins ide url(Test.png)")); assertFalse(Columns.isValid("circle insside url(Test.png)")); assertFalse(Columns.isValid("circle inside ur l(Test.png)")); assertFalse(Columns.isValid("circle inside urll(Test.png)")); }