Module wicket.bootstrap.core
Class CssClassNameAppender
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.AttributeModifier
org.apache.wicket.behavior.AttributeAppender
de.agilecoders.wicket.core.markup.html.bootstrap.behavior.CssClassNameAppender
- All Implemented Interfaces:
Serializable,IComponentAwareEventSink,IComponentAwareHeaderContributor,IClusterable
- Direct Known Subclasses:
CssClassNameRemover
#### Description
A CssClassNameAppender appends the given value, rather than replace it. This is especially useful
for adding CSS classes to markup elements.
#### Usage
```html
<span class="className" wicket:id="foo"></span>
```
can be modified with these CssClassNameAppender:
```java
link.add(new CssClassNameAppender("className2"));
link.add(new CssClassNameAppender(Arrays.asList("className2", "className3")));
```
this will result in the following markup:
```html
<span class="className className2 className3" wicket:id="foo"></span>
```- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.AttributeModifier
AttributeModifier.MarkerValue -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe name of the html class attribute name.Fields inherited from class org.apache.wicket.AttributeModifier
VALUELESS_ATTRIBUTE_ADD, VALUELESS_ATTRIBUTE_REMOVE -
Constructor Summary
ConstructorsConstructorDescriptionCssClassNameAppender(ICssClassNameProvider cssClassNameProvider) Constructor.CssClassNameAppender(String... appendValue) Constructor.CssClassNameAppender(List<String> appendValueList) Constructor.CssClassNameAppender(IModel<String> appendModel) Creates an AttributeModifier that appends the appendModel's value to the current value of the class attribute, and will add the attribute when it is not there already. -
Method Summary
Methods inherited from class org.apache.wicket.behavior.AttributeAppender
getSeparator, setSeparator, toStringMethods inherited from class org.apache.wicket.AttributeModifier
append, append, detach, getAttribute, getReplaceModel, onComponentTag, prepend, prepend, remove, replace, replace, replaceAttributeValueMethods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListener, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag, renderHead, unbind
-
Field Details
-
ATTRIBUTE_NAME
The name of the html class attribute name.- See Also:
-
-
Constructor Details
-
CssClassNameAppender
Creates an AttributeModifier that appends the appendModel's value to the current value of the class attribute, and will add the attribute when it is not there already.- Parameters:
appendModel- the model supplying a single value to append
-
CssClassNameAppender
Constructor.CssClassNameAppender(org.apache.wicket.model.IModel)- Parameters:
appendValue- one or more values to append
-
CssClassNameAppender
Constructor.CssClassNameAppender(org.apache.wicket.model.IModel)- Parameters:
appendValueList- a list of values to append
-
CssClassNameAppender
Constructor.CssClassNameAppender(org.apache.wicket.model.IModel)- Parameters:
cssClassNameProvider- a css class name provider
-
-
Method Details
-
newValue
- Overrides:
newValuein classAttributeAppender
-