KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > admin > AdminPageBean


1 /**
2  * $RCSfile: AdminPageBean.java,v $
3  * $Revision: 1.3 $
4  * $Date: 2004/11/10 20:13:33 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.admin;
13
14 import org.jivesoftware.util.StringUtils;
15
16 import java.util.Collection JavaDoc;
17 import java.util.ArrayList JavaDoc;
18
19 /**
20  * A bean to hold page information for the admin console.
21  */

22 public class AdminPageBean {
23
24     private String JavaDoc title;
25     private Collection JavaDoc breadcrumbs;
26     private String JavaDoc pageID;
27     private String JavaDoc subPageID;
28     private String JavaDoc extraParams;
29     private Collection JavaDoc scripts;
30
31     public AdminPageBean() {
32     }
33
34     /**
35      * Returns the title of the page with HTML escaped.
36      */

37     public String JavaDoc getTitle() {
38         if (title != null) {
39             return StringUtils.escapeHTMLTags(title);
40         }
41         else {
42             return title;
43         }
44     }
45
46     /**
47      * Sets the title of the admin console page.
48      */

49     public void setTitle(String JavaDoc title) {
50         this.title = title;
51     }
52
53     /**
54      * Returns a collection of breadcrumbs. Use the Collection API to get/set/remove crumbs.
55      */

56     public Collection JavaDoc getBreadcrumbs() {
57         if (breadcrumbs == null) {
58             breadcrumbs = new ArrayList JavaDoc();
59         }
60         return breadcrumbs;
61     }
62
63     /**
64      * Returns the page ID (corresponds to sidebar ID's).
65      */

66     public String JavaDoc getPageID() {
67         return pageID;
68     }
69
70     /**
71      * Sets the ID of the page (corresponds to sidebar ID's).
72      * @param pageID
73      */

74     public void setPageID(String JavaDoc pageID) {
75         this.pageID = pageID;
76     }
77
78     /**
79      * Returns the subpage ID (corresponds to sidebar ID's).
80      */

81     public String JavaDoc getSubPageID() {
82         return subPageID;
83     }
84
85     /**
86      * Sets the subpage ID (corresponds to sidebar ID's).
87      * @param subPageID
88      */

89     public void setSubPageID(String JavaDoc subPageID) {
90         this.subPageID = subPageID;
91     }
92
93     /**
94      * Returns a string of extra parameters for the URLs - these might be specific IDs for resources.
95      */

96     public String JavaDoc getExtraParams() {
97         return extraParams;
98     }
99
100     /**
101      * Sets the string of extra parameters for the URLs.
102      */

103     public void setExtraParams(String JavaDoc extraParams) {
104         this.extraParams = extraParams;
105     }
106
107     /**
108      * Returns a collection of scripts. Use the Collection API to get/set/remove scripts.
109      */

110     public Collection JavaDoc getScripts() {
111         if (scripts == null) {
112             scripts = new ArrayList JavaDoc();
113         }
114         return scripts;
115     }
116
117     /**
118      * A simple model of a breadcrumb. A bread crumb is a link with a display name.
119      */

120     public static class Breadcrumb {
121         private String JavaDoc name;
122         private String JavaDoc url;
123
124         /**
125          * Creates a crumb given a name an URL.
126          */

127         public Breadcrumb(String JavaDoc name, String JavaDoc url) {
128             this.name = name;
129             this.url = url;
130         }
131
132         /**
133          * Returns the name, with HTML escaped.
134          */

135         public String JavaDoc getName() {
136             if (name != null) {
137                 return StringUtils.escapeHTMLTags(name);
138             }
139             else {
140                 return name;
141             }
142         }
143
144         /**
145          * Returns the URL.
146          */

147         public String JavaDoc getUrl() {
148             return url;
149         }
150     }
151 }
152
Popular Tags