You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/06/24 16:03:38 UTC
[1/3] git commit: WICKET-5340 CssAttributeModifier and
StyleAttributeModifier
Repository: wicket
Updated Branches:
refs/heads/master fc34fb6c6 -> fc9522267
WICKET-5340 CssAttributeModifier and StyleAttributeModifier
(cherry picked from commit 526280230eb1ae69ec9dfbf801557c2bbc7b07e1)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/96b90813
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/96b90813
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/96b90813
Branch: refs/heads/master
Commit: 96b90813bc042564a00ee12ff297f6b50b1b1bd3
Parents: fc34fb6
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 26 17:17:16 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jun 24 17:01:40 2014 +0300
----------------------------------------------------------------------
.../org/apache/wicket/AttributeModifier.java | 6 +-
.../apache/wicket/ClassAttributeModifier.java | 80 ++++++++++++
.../apache/wicket/AttributeModifierTest.java | 2 +-
.../wicket/ClassAttributeModifierTest.java | 121 +++++++++++++++++++
4 files changed, 207 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/96b90813/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java
index 3a9b3f7..826939b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java
+++ b/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java
@@ -173,7 +173,11 @@ public class AttributeModifier extends Behavior implements IClusterable
{
final String value = toStringOrNull(attributes.get(attribute));
final String newValue = newValue(value, toStringOrNull(replacementValue));
- if (newValue != null)
+ if (newValue == VALUELESS_ATTRIBUTE_REMOVE)
+ {
+ attributes.remove(attribute);
+ }
+ else if (newValue != null)
{
attributes.put(attribute, newValue);
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/96b90813/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
new file mode 100644
index 0000000..6f3bf8a
--- /dev/null
+++ b/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.util.string.Strings;
+
+/**
+ * An AttributeModifier specialized in managing the <em>CSS class</em>
+ * attribute
+ */
+public abstract class ClassAttributeModifier extends AttributeAppender
+{
+ private static final Pattern SPLITTER = Pattern.compile("\\s+");
+
+ /**
+ * Constructor.
+ */
+ public ClassAttributeModifier()
+ {
+ super("class", null, " ");
+ }
+
+ @Override
+ protected final String newValue(String currentValue, String appendValue)
+ {
+ String[] classes;
+ if (Strings.isEmpty(currentValue))
+ {
+ classes = new String[0];
+ }
+ else
+ {
+ classes = SPLITTER.split(currentValue);
+ }
+ Set<String> oldClasses = new TreeSet<>();
+ Collections.addAll(oldClasses, classes);
+
+ Set<String> newClasses = update(oldClasses);
+
+ StringBuilder result = new StringBuilder();
+ for (String cls : newClasses)
+ {
+ if (result.length() > 0)
+ {
+ result.append(getSeparator());
+ }
+ result.append(cls);
+ }
+ return result.length() > 0 ? result.toString() : VALUELESS_ATTRIBUTE_REMOVE;
+ }
+
+ /**
+ * Callback to update the CSS class values for a tag.
+ *
+ * @param oldClasses
+ * A set with the old class values
+ * @return A set with the new class values
+ */
+ protected abstract Set<String> update(Set<String> oldClasses);
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/96b90813/wicket-core/src/test/java/org/apache/wicket/AttributeModifierTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/AttributeModifierTest.java b/wicket-core/src/test/java/org/apache/wicket/AttributeModifierTest.java
index edc8cdc..bd71b4f 100644
--- a/wicket-core/src/test/java/org/apache/wicket/AttributeModifierTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/AttributeModifierTest.java
@@ -38,7 +38,7 @@ public class AttributeModifierTest extends Assert
@Test(expected = IllegalArgumentException.class)
public void nullAttributeFailsConstruction()
{
- new AttributeModifier(null, new Model<String>("model"));
+ new AttributeModifier(null, new Model<>("model"));
}
/**
http://git-wip-us.apache.org/repos/asf/wicket/blob/96b90813/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java b/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
new file mode 100644
index 0000000..9b425ad
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.parser.XmlTag;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for ClassAttributeModifier
+ */
+public class ClassAttributeModifierTest extends Assert
+{
+ /**
+ * Adds two values
+ */
+ @Test
+ public void addCssClasses()
+ {
+ ClassAttributeModifier cam = new ClassAttributeModifier()
+ {
+ @Override
+ protected Set<String> update(Set<String> oldClasses)
+ {
+ oldClasses.add("one");
+ oldClasses.add("two");
+ return oldClasses;
+ }
+ };
+ ComponentTag tag = createTag();
+
+ Map<String, Object> attributes = tag.getAttributes();
+
+ cam.replaceAttributeValue(null, tag);
+
+ String classes = (String) attributes.get(cam.getAttribute());
+ assertEquals("one two", classes);
+ }
+
+ /**
+ * Adds 'three' and removes 'two'
+ */
+ @Test
+ public void addRemoveCssClasses()
+ {
+ ClassAttributeModifier cam = new ClassAttributeModifier()
+ {
+ @Override
+ protected Set<String> update(Set<String> oldClasses)
+ {
+ oldClasses.add("one");
+ oldClasses.remove("two");
+ oldClasses.add("three");
+ return oldClasses;
+ }
+ };
+ ComponentTag tag = createTag();
+
+ Map<String, Object> attributes = tag.getAttributes();
+ attributes.put(cam.getAttribute(), "one two");
+
+ cam.replaceAttributeValue(null, tag);
+
+ String classes = (String) attributes.get(cam.getAttribute());
+ assertEquals("one three", classes);
+ }
+
+ /**
+ * Removes all CSS class values
+ */
+ @Test
+ public void removeAllCssClasses()
+ {
+ ClassAttributeModifier cam = new ClassAttributeModifier()
+ {
+ @Override
+ protected Set<String> update(Set<String> oldClasses)
+ {
+ oldClasses.remove("one");
+ oldClasses.remove("two");
+ return oldClasses;
+ }
+ };
+ ComponentTag tag = createTag();
+
+ Map<String, Object> attributes = tag.getAttributes();
+ attributes.put(cam.getAttribute(), "two one");
+
+ cam.replaceAttributeValue(null, tag);
+
+ String classes = (String) attributes.get(cam.getAttribute());
+ assertNull(classes);
+ }
+
+ private ComponentTag createTag()
+ {
+ XmlTag xmlTag = new XmlTag();
+ ComponentTag tag = new ComponentTag(xmlTag);
+ tag.setId("ClassAttributeModifier");
+ tag.setName("test");
+ return tag;
+ }
+}
[2/3] git commit: WICKET-5340 CssAttributeModifier and
StyleAttributeModifier
Posted by mg...@apache.org.
WICKET-5340 CssAttributeModifier and StyleAttributeModifier
(cherry picked from commit a20cdb51cc77765fff0a82d66f02e4abc68c31b8)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e2f8fae1
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e2f8fae1
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e2f8fae1
Branch: refs/heads/master
Commit: e2f8fae14e22a63d79236ba07b78dcb6dd3200ad
Parents: 96b9081
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 26 17:37:09 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jun 24 17:01:51 2014 +0300
----------------------------------------------------------------------
.../apache/wicket/ClassAttributeModifier.java | 2 +-
.../apache/wicket/StyleAttributeModifier.java | 84 +++++++++++++
.../wicket/ClassAttributeModifierTest.java | 4 +-
.../wicket/StyleAttributeModifierTest.java | 120 +++++++++++++++++++
4 files changed, 207 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/e2f8fae1/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
index 6f3bf8a..b67ff5b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
@@ -50,7 +50,7 @@ public abstract class ClassAttributeModifier extends AttributeAppender
}
else
{
- classes = SPLITTER.split(currentValue);
+ classes = SPLITTER.split(currentValue.trim());
}
Set<String> oldClasses = new TreeSet<>();
Collections.addAll(oldClasses, classes);
http://git-wip-us.apache.org/repos/asf/wicket/blob/e2f8fae1/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
new file mode 100644
index 0000000..64cf077
--- /dev/null
+++ b/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.util.string.Strings;
+
+/**
+ * An AttributeModifier specialized in managing the <em>CSS style</em>
+ * attribute
+ */
+public abstract class StyleAttributeModifier extends AttributeAppender
+{
+ private static final Pattern STYLES_SPLITTER = Pattern.compile("\\s*;\\s*");
+ private static final Pattern KEY_VALUE_SPLITTER = Pattern.compile("\\s*:\\s*");
+
+ /**
+ * Constructor.
+ */
+ public StyleAttributeModifier()
+ {
+ super("style", null, ";");
+ }
+
+ @Override
+ protected final String newValue(String currentValue, String appendValue)
+ {
+ String[] styles;
+ if (Strings.isEmpty(currentValue))
+ {
+ styles = new String[0];
+ }
+ else
+ {
+ styles = STYLES_SPLITTER.split(currentValue.trim());
+ }
+ Map<String, String> oldStyles = new LinkedHashMap<>();
+ for (String style : styles)
+ {
+ String[] keyValue = KEY_VALUE_SPLITTER.split(style, 2);
+ oldStyles.put(keyValue[0], keyValue[1]);
+ }
+
+ Map<String, String> newStyles = update(oldStyles);
+
+ StringBuilder result = new StringBuilder();
+ for (Map.Entry<String, String> entry : newStyles.entrySet())
+ {
+ result
+ .append(entry.getKey())
+ .append(':')
+ .append(entry.getValue())
+ .append(getSeparator());
+ }
+ return result.length() > 0 ? result.toString() : VALUELESS_ATTRIBUTE_REMOVE;
+ }
+
+ /**
+ * Callback to update the CSS class values for a tag.
+ *
+ * @param oldStyles
+ * A map with the old style key/values
+ * @return A map with the new style key/values
+ */
+ protected abstract Map<String, String> update(Map<String, String> oldStyles);
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/e2f8fae1/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java b/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
index 9b425ad..7cde80c 100644
--- a/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/ClassAttributeModifierTest.java
@@ -75,7 +75,7 @@ public class ClassAttributeModifierTest extends Assert
ComponentTag tag = createTag();
Map<String, Object> attributes = tag.getAttributes();
- attributes.put(cam.getAttribute(), "one two");
+ attributes.put(cam.getAttribute(), "one two ");
cam.replaceAttributeValue(null, tag);
@@ -102,7 +102,7 @@ public class ClassAttributeModifierTest extends Assert
ComponentTag tag = createTag();
Map<String, Object> attributes = tag.getAttributes();
- attributes.put(cam.getAttribute(), "two one");
+ attributes.put(cam.getAttribute(), "two one");
cam.replaceAttributeValue(null, tag);
http://git-wip-us.apache.org/repos/asf/wicket/blob/e2f8fae1/wicket-core/src/test/java/org/apache/wicket/StyleAttributeModifierTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/StyleAttributeModifierTest.java b/wicket-core/src/test/java/org/apache/wicket/StyleAttributeModifierTest.java
new file mode 100644
index 0000000..b471166
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/StyleAttributeModifierTest.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import java.util.Map;
+
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.parser.XmlTag;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for StyleAttributeModifier
+ */
+public class StyleAttributeModifierTest extends Assert
+{
+ /**
+ * Adds two style properties
+ */
+ @Test
+ public void addCssStyles()
+ {
+ StyleAttributeModifier cam = new StyleAttributeModifier()
+ {
+ @Override
+ protected Map<String, String> update(Map<String, String> oldStyles)
+ {
+ oldStyles.put("color", "white");
+ oldStyles.put("font-size", "9px");
+ return oldStyles;
+ }
+ };
+ ComponentTag tag = createTag();
+
+ Map<String, Object> attributes = tag.getAttributes();
+
+ cam.replaceAttributeValue(null, tag);
+
+ String styles = (String) attributes.get(cam.getAttribute());
+ assertEquals("color:white;font-size:9px;", styles);
+ }
+
+ /**
+ * Modifies one style, removes another and adds a new style
+ */
+ @Test
+ public void addRemoveCssStyles()
+ {
+ StyleAttributeModifier cam = new StyleAttributeModifier()
+ {
+ @Override
+ protected Map<String, String> update(Map<String, String> oldStyles)
+ {
+ oldStyles.put("color", "black"); // modify the value
+ oldStyles.remove("font-size"); // remove
+ oldStyles.put("background-color", "red"); // add
+ return oldStyles;
+ }
+ };
+ ComponentTag tag = createTag();
+
+ Map<String, Object> attributes = tag.getAttributes();
+ attributes.put(cam.getAttribute(), "color:white;font-size:9px;");
+
+ cam.replaceAttributeValue(null, tag);
+
+ String classes = (String) attributes.get(cam.getAttribute());
+ assertEquals("color:black;background-color:red;", classes);
+ }
+
+ /**
+ * Removes all CSS style values and the attribute itself
+ */
+ @Test
+ public void removeAllCssStyles()
+ {
+ StyleAttributeModifier cam = new StyleAttributeModifier()
+ {
+ @Override
+ protected Map<String, String> update(Map<String, String> oldStyles)
+ {
+ oldStyles.remove("color");
+ oldStyles.remove("font-size");
+ return oldStyles;
+ }
+ };
+ ComponentTag tag = createTag();
+
+ Map<String, Object> attributes = tag.getAttributes();
+ attributes.put(cam.getAttribute(), "color:white ; font-size:99999px; ");
+
+ cam.replaceAttributeValue(null, tag);
+
+ String classes = (String) attributes.get(cam.getAttribute());
+ assertNull(classes);
+ }
+
+ private ComponentTag createTag()
+ {
+ XmlTag xmlTag = new XmlTag();
+ ComponentTag tag = new ComponentTag(xmlTag);
+ tag.setId("StyleAttributeModifier");
+ tag.setName("test");
+ return tag;
+ }
+}
[3/3] git commit: WICKET-5340 CssAttributeModifier and
StyleAttributeModifier
Posted by mg...@apache.org.
WICKET-5340 CssAttributeModifier and StyleAttributeModifier
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fc952226
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fc952226
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fc952226
Branch: refs/heads/master
Commit: fc95222672cc06b5b2cf6f6efaa171666ba44fd5
Parents: e2f8fae
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Jun 24 17:03:21 2014 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jun 24 17:03:21 2014 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/wicket/ClassAttributeModifier.java | 5 +++--
.../src/main/java/org/apache/wicket/StyleAttributeModifier.java | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/fc952226/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
index b67ff5b..3f6e1ef 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ClassAttributeModifier.java
@@ -41,7 +41,7 @@ public abstract class ClassAttributeModifier extends AttributeAppender
}
@Override
- protected final String newValue(String currentValue, String appendValue)
+ protected String newValue(String currentValue, String appendValue)
{
String[] classes;
if (Strings.isEmpty(currentValue))
@@ -57,12 +57,13 @@ public abstract class ClassAttributeModifier extends AttributeAppender
Set<String> newClasses = update(oldClasses);
+ String separator = getSeparator();
StringBuilder result = new StringBuilder();
for (String cls : newClasses)
{
if (result.length() > 0)
{
- result.append(getSeparator());
+ result.append(separator);
}
result.append(cls);
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/fc952226/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
index 64cf077..70fa8d6 100644
--- a/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
+++ b/wicket-core/src/main/java/org/apache/wicket/StyleAttributeModifier.java
@@ -41,7 +41,7 @@ public abstract class StyleAttributeModifier extends AttributeAppender
}
@Override
- protected final String newValue(String currentValue, String appendValue)
+ protected String newValue(String currentValue, String appendValue)
{
String[] styles;
if (Strings.isEmpty(currentValue))
@@ -61,6 +61,7 @@ public abstract class StyleAttributeModifier extends AttributeAppender
Map<String, String> newStyles = update(oldStyles);
+ String separator = getSeparator();
StringBuilder result = new StringBuilder();
for (Map.Entry<String, String> entry : newStyles.entrySet())
{
@@ -68,7 +69,7 @@ public abstract class StyleAttributeModifier extends AttributeAppender
.append(entry.getKey())
.append(':')
.append(entry.getValue())
- .append(getSeparator());
+ .append(separator);
}
return result.length() > 0 ? result.toString() : VALUELESS_ATTRIBUTE_REMOVE;
}