KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > controlx > list > ListControlRenderer


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.controlx.list;
14
15 import info.magnolia.cms.gui.controlx.impl.TemplatedRenderer;
16
17
18 /**
19  * Renders a list view.
20  * @author Philipp Bracher
21  * @version $Revision: 6341 $ ($Author: philipp $)
22  */

23 public class ListControlRenderer extends TemplatedRenderer {
24
25     /**
26      * Default template used.
27      */

28     public ListControlRenderer() {
29         super();
30     }
31
32     /**
33      * Pass the template to use.
34      * @param templateName
35      */

36     public ListControlRenderer(String JavaDoc templateName) {
37         super(templateName);
38     }
39
40     /**
41      * Return asc or desc.
42      * @param list
43      * @param field
44      * @return
45      */

46     public String JavaDoc nextSortByOrder(ListControl list, String JavaDoc field) {
47         if (list.getSortBy().equals(field)) {
48             if (list.getSortByOrder().equals("asc")) {
49                 return "desc";
50             }
51         }
52         return "asc";
53     }
54
55     /**
56      * Return asc or desc.
57      * @param list
58      * @param field
59      * @return
60      */

61     public String JavaDoc nextGroupByOrder(ListControl list, String JavaDoc field) {
62         if (list.getGroupBy().equals(field)) {
63             if (list.getGroupByOrder().equals("asc")) {
64                 return "desc";
65             }
66         }
67         return "asc";
68     }
69
70     /**
71      * Called onclick, dblclick, contextmenu
72      * @param list
73      * @return
74      */

75     public String JavaDoc onSelect(ListControl list, Integer JavaDoc index) {
76         return "";
77     }
78
79     /**
80      * Render the click event
81      * @param iter
82      * @return
83      */

84     public String JavaDoc onClick(ListControl list, Integer JavaDoc index) {
85         return "";
86     }
87
88     /**
89      * Render the double click event
90      * @param iter
91      * @return
92      */

93     public String JavaDoc onDblClick(ListControl list, Integer JavaDoc index) {
94         return "";
95     }
96
97     /**
98      * Render the double click event
99      * @param iter
100      * @return
101      */

102     public String JavaDoc onRightClick(ListControl list, Integer JavaDoc index) {
103         return "";
104     }
105
106     /**
107      * Used to get the css class for the grouplinks
108      * @param list
109      * @param field
110      * @return the css class as a string
111      */

112     public String JavaDoc getGroupLinkCSSClass(ListControl list, String JavaDoc field) {
113         if (list.getGroupBy().equals(field)) {
114             return "mgnlListSortGroupLink" + list.getGroupByOrder().toUpperCase();
115         }
116         return "mgnlListSortGroupLink";
117     }
118
119     /**
120      * Used to get the css class for the sort links
121      * @param list
122      * @param field
123      * @return the css class as a string
124      */

125     public String JavaDoc getSortLinkCSSClass(ListControl list, String JavaDoc field) {
126         if (list.getSortBy().equals(field)) {
127             return "mgnlListSortGroupLink" + list.getSortByOrder().toUpperCase();
128         }
129         return "mgnlListSortGroupLink";
130     }
131
132 }
133
Popular Tags