click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r928501 - /click/trunk/click/framework/src/org/apache/click/control/Table.java
Date Sun, 28 Mar 2010 21:52:22 GMT
Author: sabob
Date: Sun Mar 28 21:52:21 2010
New Revision: 928501

URL: http://svn.apache.org/viewvc?rev=928501&view=rev
Log:
cater for stateful pages where table name is changed

Modified:
    click/trunk/click/framework/src/org/apache/click/control/Table.java

Modified: click/trunk/click/framework/src/org/apache/click/control/Table.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Table.java?rev=928501&r1=928500&r2=928501&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Table.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Table.java Sun Mar 28 21:52:21
2010
@@ -828,64 +828,65 @@ public class Table extends AbstractContr
      */
     @Override
     public List<Element> getHeadElements() {
+        Context context = getContext();
+        String versionIndicator = ClickUtils.getResourceVersionIndicator(context);
+
         if (headElements == null) {
             headElements = super.getHeadElements();
 
-            boolean isDarkStyle = isDarkStyle();
-
-            Context context = getContext();
-            String versionIndicator = ClickUtils.getResourceVersionIndicator(context);
             headElements.add(new CssImport("/click/table.css", versionIndicator));
 
-            String tableId = getId();
-            CssStyle cssStyle = new CssStyle();
-            cssStyle.setId(tableId + "_css_setup");
-
-            if (!headElements.contains(cssStyle)) {
-                String contextPath = context.getRequest().getContextPath();
-                HtmlStringBuffer buffer = new HtmlStringBuffer(100);
-                buffer.append("th.sortable a {\n");
-                buffer.append("background: url(");
-                buffer.append(contextPath);
-                buffer.append("/click/column-sortable-");
-                if (isDarkStyle) {
-                    buffer.append("dark");
-                } else {
-                    buffer.append("light");
-                }
-                buffer.append(versionIndicator);
-                buffer.append(".gif)");
-                buffer.append(" center right no-repeat;}\n");
-                buffer.append("th.ascending a {\n");
-                buffer.append("background: url(");
-                buffer.append(contextPath);
-                buffer.append("/click/column-ascending-");
-                if (isDarkStyle) {
-                    buffer.append("dark");
-                } else {
-                    buffer.append("light");
-                }
-                buffer.append(versionIndicator);
-                buffer.append(".gif)");
-                buffer.append(" center right no-repeat;}\n");
-                buffer.append("th.descending a {\n");
-                buffer.append("background: url(");
-                buffer.append(contextPath);
-                buffer.append("/click/column-descending-");
-                if (isDarkStyle) {
-                    buffer.append("dark");
-                } else {
-                    buffer.append("light");
-                }
-                buffer.append(versionIndicator);
-                buffer.append(".gif)");
-                buffer.append(" center right no-repeat;}");
-                cssStyle.setContent(buffer.toString());
-                headElements.add(cssStyle);
-            }
-
             headElements.addAll(getControlLink().getHeadElements());
         }
+
+        String tableId = getId();
+        CssStyle cssStyle = new CssStyle();
+        cssStyle.setId(tableId + "_css_setup");
+
+        if (!headElements.contains(cssStyle)) {
+            boolean isDarkStyle = isDarkStyle();
+
+            String contextPath = context.getRequest().getContextPath();
+            HtmlStringBuffer buffer = new HtmlStringBuffer(300);
+            buffer.append("th.sortable a {\n");
+            buffer.append("background: url(");
+            buffer.append(contextPath);
+            buffer.append("/click/column-sortable-");
+            if (isDarkStyle) {
+                buffer.append("dark");
+            } else {
+                buffer.append("light");
+            }
+            buffer.append(versionIndicator);
+            buffer.append(".gif)");
+            buffer.append(" center right no-repeat;}\n");
+            buffer.append("th.ascending a {\n");
+            buffer.append("background: url(");
+            buffer.append(contextPath);
+            buffer.append("/click/column-ascending-");
+            if (isDarkStyle) {
+                buffer.append("dark");
+            } else {
+                buffer.append("light");
+            }
+            buffer.append(versionIndicator);
+            buffer.append(".gif)");
+            buffer.append(" center right no-repeat;}\n");
+            buffer.append("th.descending a {\n");
+            buffer.append("background: url(");
+            buffer.append(contextPath);
+            buffer.append("/click/column-descending-");
+            if (isDarkStyle) {
+                buffer.append("dark");
+            } else {
+                buffer.append("light");
+            }
+            buffer.append(versionIndicator);
+            buffer.append(".gif)");
+            buffer.append(" center right no-repeat;}");
+            cssStyle.setContent(buffer.toString());
+            headElements.add(cssStyle);
+        }
         return headElements;
     }
 



Mime
View raw message