You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2009/06/13 22:56:40 UTC

svn commit: r784472 - in /incubator/click/trunk/click: extras/src/org/apache/click/extras/control/TableInlinePaginator.java framework/src/org/apache/click/control/Table.java framework/src/org/apache/click/control/TablePaginator.java

Author: sabob
Date: Sat Jun 13 20:56:40 2009
New Revision: 784472

URL: http://svn.apache.org/viewvc?rev=784472&view=rev
Log:
render paginator class attribute

Modified:
    incubator/click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java
    incubator/click/trunk/click/framework/src/org/apache/click/control/Table.java
    incubator/click/trunk/click/framework/src/org/apache/click/control/TablePaginator.java

Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java?rev=784472&r1=784471&r2=784472&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java Sat Jun 13 20:56:40 2009
@@ -104,13 +104,22 @@
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-first-image"));
             controlLink.setParameter(Table.PAGE, String.valueOf(0));
             controlLink.setTitle(table.getMessage("table-first-title"));
-            controlLink.setId("control-first");
+            String styleClass = controlLink.getAttribute("class");
+            if (styleClass == null) {
+                controlLink.setAttribute("class", "control-first");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-first");
+            }
             firstLabel = controlLink.toString();
 
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-previous-image"));
             controlLink.setParameter(Table.PAGE, String.valueOf(table.getPageNumber() - 1));
             controlLink.setTitle(table.getMessage("table-previous-title"));
-            controlLink.setId("control-previous");
+            if (styleClass == null) {
+                controlLink.setAttribute("class", "control-previous");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-previous");
+            }
             previousLabel = controlLink.toString();
 
         } else {
@@ -119,13 +128,22 @@
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-first-disabled-image"));
             controlLink.setParameter(Table.PAGE, null);
             controlLink.setTitle(null);
-            controlLink.setId("control-first");
+            String styleClass = controlLink.getAttribute("class");
+            if (styleClass == null) {
+                controlLink.setAttribute("class", "control-first");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-first");
+            }
             firstLabel = controlLink.toString();
 
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-previous-disabled-image"));
             controlLink.setParameter(Table.PAGE, null);
             controlLink.setTitle(null);
-            controlLink.setId("control-previous");
+            if (styleClass == null) {
+                controlLink.setAttribute("class", "control-previous");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-previous");
+            }
             previousLabel = controlLink.toString();
         }
 
@@ -152,7 +170,12 @@
                 controlLink.setLabel(pageNumber);
                 controlLink.setParameter(Table.PAGE, String.valueOf(i));
                 controlLink.setTitle(gotoTitle + " " + pageNumber);
-                controlLink.setId("control-" + pageNumber);
+                String styleClass = controlLink.getAttribute("class");
+                if (styleClass == null) {
+                   controlLink.setAttribute("class", "control-page");
+                } else {
+                    controlLink.setAttribute("class", styleClass + " control-page");
+                }
                 pagesBuffer.append(controlLink.toString());
             }
 
@@ -169,13 +192,22 @@
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-next-image"));
             controlLink.setParameter(Table.PAGE, String.valueOf(table.getPageNumber() + 1));
             controlLink.setTitle(table.getMessage("table-next-title"));
-            controlLink.setId("control-next");
+            String styleClass = controlLink.getAttribute("class");
+            if (styleClass == null) {
+               controlLink.setAttribute("class", "control-next");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-next");
+            }
             nextLabel = controlLink.toString();
 
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-last-image"));
             controlLink.setParameter(Table.PAGE, String.valueOf(table.getNumberPages() - 1));
             controlLink.setTitle(table.getMessage("table-last-title"));
-            controlLink.setId("control-last");
+            if (styleClass == null) {
+               controlLink.setAttribute("class", "control-last");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-last");
+            }
             lastLabel = controlLink.toString();
 
         } else {
@@ -184,18 +216,26 @@
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-next-disabled-image"));
             controlLink.setParameter(Table.PAGE, null);
             controlLink.setTitle(null);
-            controlLink.setId("control-next");
+            String styleClass = controlLink.getAttribute("class");
+            if (styleClass == null) {
+               controlLink.setAttribute("class", "control-next");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-next");
+            }
             nextLabel = controlLink.toString();
 
             controlLink.setImageSrc(paginatorMessages.getMessage("table-inline-last-disabled-image"));
             controlLink.setParameter(Table.PAGE, null);
             controlLink.setTitle(null);
-            controlLink.setId("control-last");
+            if (styleClass == null) {
+               controlLink.setAttribute("class", "control-last");
+            } else {
+                controlLink.setAttribute("class", styleClass + " control-last");
+            }
             lastLabel = controlLink.toString();
         }
 
         controlLink.setDisabled(false);
-        controlLink.setId(null);
         controlLink.setImageSrc(null);
         controlLink.setTitle(null);
 

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/Table.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/Table.java?rev=784472&r1=784471&r2=784472&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/Table.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/Table.java Sat Jun 13 20:56:40 2009
@@ -1707,11 +1707,22 @@
                 link.setLabel(firstLabel);
                 link.setParameter(PAGE, String.valueOf(0));
                 link.setAttribute("title", firstTitle);
+                String styleClass = link.getAttribute("class");
+                if (styleClass == null) {
+                    link.setAttribute("class", "control-first");
+                } else {
+                    link.setAttribute("class", styleClass + " control-first");
+                }
                 firstLabel = link.toString();
 
                 link.setLabel(previousLabel);
                 link.setParameter(PAGE, String.valueOf(getPageNumber() - 1));
                 link.setAttribute("title", previousTitle);
+                if (styleClass == null) {
+                    link.setAttribute("class", "control-previous");
+                } else {
+                    link.setAttribute("class", styleClass + " control-previous");
+                }
                 previousLabel = link.toString();
             }
 
@@ -1734,6 +1745,12 @@
                     link.setLabel(pageNumber);
                     link.setParameter(PAGE, String.valueOf(i));
                     link.setAttribute("title", gotoTitle + " " + pageNumber);
+                    String styleClass = link.getAttribute("class");
+                    if (styleClass == null) {
+                       link.setAttribute("class", "control-page");
+                    } else {
+                        link.setAttribute("class", styleClass + " control-page");
+                    }
                     pagesBuffer.append(link.toString());
                 }
 
@@ -1747,11 +1764,22 @@
                 link.setLabel(nextLabel);
                 link.setParameter(PAGE, String.valueOf(getPageNumber() + 1));
                 link.setAttribute("title", nextTitle);
+                String styleClass = link.getAttribute("class");
+                if (styleClass == null) {
+                   link.setAttribute("class", "control-next");
+                } else {
+                    link.setAttribute("class", styleClass + " control-next");
+                }
                 nextLabel = link.toString();
 
                 link.setLabel(lastLabel);
                 link.setParameter(PAGE, String.valueOf(getNumberPages() - 1));
                 link.setAttribute("title", lastTitle);
+                if (styleClass == null) {
+                   link.setAttribute("class", "control-last");
+                } else {
+                    link.setAttribute("class", styleClass + " control-last");
+                }
                 lastLabel = link.toString();
             }
 

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/TablePaginator.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/TablePaginator.java?rev=784472&r1=784471&r2=784472&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/TablePaginator.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/TablePaginator.java Sat Jun 13 20:56:40 2009
@@ -137,11 +137,22 @@
                 controlLink.setLabel(firstLabel);
                 controlLink.setParameter(Table.PAGE, String.valueOf(0));
                 controlLink.setTitle(firstTitle);
+                String styleClass = controlLink.getAttribute("class");
+                if (styleClass == null) {
+                   controlLink.setAttribute("class", "control-first");
+                } else {
+                    controlLink.setAttribute("class", styleClass + " control-first");
+                }
                 firstLabel = controlLink.toString();
 
                 controlLink.setLabel(previousLabel);
                 controlLink.setParameter(Table.PAGE, String.valueOf(table.getPageNumber() - 1));
                 controlLink.setTitle(previousTitle);
+                if (styleClass == null) {
+                   controlLink.setAttribute("class", "control-previous");
+                } else {
+                    controlLink.setAttribute("class", styleClass + " control-previous");
+                }
                 previousLabel = controlLink.toString();
             }
 
@@ -164,6 +175,12 @@
                     controlLink.setLabel(pageNumber);
                     controlLink.setParameter(Table.PAGE, String.valueOf(i));
                     controlLink.setTitle(gotoTitle + " " + pageNumber);
+                    String styleClass = controlLink.getAttribute("class");
+                    if (styleClass == null) {
+                        controlLink.setAttribute("class", "control-page");
+                    } else {
+                        controlLink.setAttribute("class", styleClass + " control-page");
+                    }
                     controlLink.render(pagesBuffer);
                 }
 
@@ -177,11 +194,22 @@
                 controlLink.setLabel(nextLabel);
                 controlLink.setParameter(Table.PAGE, String.valueOf(table.getPageNumber() + 1));
                 controlLink.setTitle(nextTitle);
+                String styleClass = controlLink.getAttribute("class");
+                if (styleClass == null) {
+                   controlLink.setAttribute("class", "control-next");
+                } else {
+                    controlLink.setAttribute("class", styleClass + " control-next");
+                }
                 nextLabel = controlLink.toString();
 
                 controlLink.setLabel(lastLabel);
                 controlLink.setParameter(Table.PAGE, String.valueOf(table.getNumberPages() - 1));
                 controlLink.setTitle(lastTitle);
+                if (styleClass == null) {
+                   controlLink.setAttribute("class", "control-last");
+                } else {
+                    controlLink.setAttribute("class", styleClass + " control-last");
+                }
                 lastLabel = controlLink.toString();
             }