Author: nbelaevski
Date: 2009-04-02 14:00:13 -0400 (Thu, 02 Apr 2009)
New Revision: 13364
Modified:
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
Log:
HtmlUtil: added conactClasses & concatStyles methods
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2009-04-02
17:12:33 UTC (rev 13363)
+++
trunk/framework/impl/src/main/java/org/richfaces/component/util/HtmlUtil.java 2009-04-02
18:00:13 UTC (rev 13364)
@@ -120,4 +120,39 @@
return false;
}
+ private static boolean isEmpty(String s) {
+ return s == null || s.length() == 0;
+ }
+
+ public static String concatClasses(String... classes) {
+ StringBuilder result = new StringBuilder();
+
+ for (String className : classes) {
+ if (!isEmpty(className)) {
+ if (result.length() != 0) {
+ result.append(' ');
+ }
+
+ result.append(className.trim());
+ }
+ }
+
+ return result.toString();
+ }
+
+ public static String concatStyles(String... styles) {
+ StringBuilder result = new StringBuilder();
+
+ for (String style : styles) {
+ if (!isEmpty(style)) {
+ if (result.length() != 0) {
+ result.append(';');
+ }
+
+ result.append(style.trim());
+ }
+ }
+
+ return result.toString();
+ }
}
Show replies by date