KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > module > admininterface > lists > AdminListControlRenderer


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.module.admininterface.lists;
14
15 import info.magnolia.cms.gui.controlx.list.ListControl;
16 import info.magnolia.cms.gui.controlx.list.ListControlRenderer;
17
18
19 /**
20  * Show the context menu if existing.
21  * @author Philipp Bracher
22  * @version $Revision: 6341 $ ($Author: philipp $)
23  */

24 public class AdminListControlRenderer extends ListControlRenderer {
25
26     /**
27      * Set the admin interface list template
28      */

29     public AdminListControlRenderer() {
30         super();
31         setTemplateName("info/magnolia/module/admininterface/lists/ListControl.html");
32     }
33
34     /**
35      * Sets the selected id in the js object
36      */

37     public String JavaDoc onSelect(ListControl list, Integer JavaDoc index) {
38         return list.getName() + ".select(" + index + ");";
39     }
40
41     /**
42      * Show the context menu
43      */

44     public String JavaDoc onRightClick(ListControl list, Integer JavaDoc index) {
45         if (list.getContextMenu() != null) {
46             return list.getContextMenu().getName() + ".show(event);";
47         }
48         return "";
49     }
50 }
51
Popular Tags