Style extends AbstractAttribute implements GlobalAttributable, StateChangeInformer<CssProperty> { public boolean markAsImportant(final String styleName) { if (styleName == null) { return false; } final long stamp = lock.writeLock(); try { final String trimmedStyleName = StringUtil.strip(styleName); final String value = super.getAttributeValueMap() .get(trimmedStyleName); if (value != null && !value.isEmpty()) { return super.addToAttributeValueMap(trimmedStyleName, value + " " + IMPORTANT); } return false; } finally { lock.unlockWrite(stamp); } } Style();  Style(final String styles);  Style(final Map<String, String> styles);  Style(final CssProperty... cssProperties);  Style(final boolean important, final CssProperty... cssProperties); static void addSupportForNewCustomCssClass(final String cssName,
            final Class<?> cssClass); static void removeSupportOfCssClass(final Class<?> cssClass); static void removeSupportOfCssClasses(final Class<?>... cssClasses); void addCssProperties(final String cssProperties); boolean addCssProperties(final Map<String, String> cssProperties); boolean addCssProperty(final String cssName, final String cssValue); void addCssProperties(final boolean important,
            final CssProperty... cssProperties); List<CssProperty> addCssProperties(
            final CssProperty... cssProperties); @Deprecated List<CssProperty> addCssProperties(
            final Collection<? extends CssProperty> cssProperties); CssProperty addCssProperty(final CssProperty cssProperty); boolean removeCssProperty(final String cssName); boolean removeCssProperty(final String cssName,
            final String cssValue); boolean removeCssProperty(final CssProperty cssProperty); List<Boolean> removeCssProperties(
            final CssProperty... cssProperties); void removeAllCssProperties(); boolean contains(final CssProperty cssProperty); @Deprecated List<Boolean> removeCssProperties(
            final Collection<CssProperty> cssProperties); boolean markAsImportant(final String styleName); boolean markAsUnimportant(final String styleName); boolean isImportant(final CssProperty cssProperty); boolean isImportant(final String styleName); CssProperty getCssProperty(final String cssName); Collection<CssProperty> getCssProperties(); int getCssPropertiesSize(); boolean isCssPropertiesEmpty(); @Override void stateChanged(final CssProperty stateChangedObject); static Map<String, Class<?>> getSupportedCsspropertyClasses(); @Override String getAttributeValue();  }
@Test public void testMarkAsImportant() { final Style style = new Style("color:green"); style.markAsImportant("color"); assertEquals("style=\"color:green !important;\"", style.toHtmlString()); assertEquals("color:green !important;", style.getAttributeValue()); final CssProperty cssProperty = style.getCssProperty("color"); assertNotNull(cssProperty); { boolean important = style.isImportant("color"); assertTrue(important); important = style.isImportant(cssProperty); assertTrue(important); assertEquals("green", cssProperty.getCssValue()); } style.markAsUnimportant("color"); { boolean important = style.isImportant("color"); assertFalse(important); important = style.isImportant(cssProperty); assertFalse(important); assertEquals("style=\"color:green;\"", style.toHtmlString()); assertEquals("color:green;", style.getAttributeValue()); assertEquals("green", cssProperty.getCssValue()); } }