001: /**
002: * $RCSfile$
003: * $Revision: 297 $
004: * $Date: 2004-11-10 12:13:33 -0800 (Wed, 10 Nov 2004) $
005: *
006: * Copyright (C) 2004 Jive Software. All rights reserved.
007: *
008: * This software is published under the terms of the GNU Public License (GPL),
009: * a copy of which is included in this distribution.
010: */package org.jivesoftware.admin;
011:
012: import org.jivesoftware.util.StringUtils;
013:
014: import java.util.Collection;
015: import java.util.ArrayList;
016:
017: /**
018: * A bean to hold page information for the admin console.
019: */
020: public class AdminPageBean {
021:
022: private String title;
023: private Collection breadcrumbs;
024: private String pageID;
025: private String subPageID;
026: private String extraParams;
027: private Collection scripts;
028:
029: public AdminPageBean() {
030: }
031:
032: /**
033: * Returns the title of the page with HTML escaped.
034: */
035: public String getTitle() {
036: if (title != null) {
037: return StringUtils.escapeHTMLTags(title);
038: } else {
039: return title;
040: }
041: }
042:
043: /**
044: * Sets the title of the admin console page.
045: */
046: public void setTitle(String title) {
047: this .title = title;
048: }
049:
050: /**
051: * Returns a collection of breadcrumbs. Use the Collection API to get/set/remove crumbs.
052: */
053: public Collection getBreadcrumbs() {
054: if (breadcrumbs == null) {
055: breadcrumbs = new ArrayList();
056: }
057: return breadcrumbs;
058: }
059:
060: /**
061: * Returns the page ID (corresponds to sidebar ID's).
062: */
063: public String getPageID() {
064: return pageID;
065: }
066:
067: /**
068: * Sets the ID of the page (corresponds to sidebar ID's).
069: * @param pageID
070: */
071: public void setPageID(String pageID) {
072: this .pageID = pageID;
073: }
074:
075: /**
076: * Returns the subpage ID (corresponds to sidebar ID's).
077: */
078: public String getSubPageID() {
079: return subPageID;
080: }
081:
082: /**
083: * Sets the subpage ID (corresponds to sidebar ID's).
084: * @param subPageID
085: */
086: public void setSubPageID(String subPageID) {
087: this .subPageID = subPageID;
088: }
089:
090: /**
091: * Returns a string of extra parameters for the URLs - these might be specific IDs for resources.
092: */
093: public String getExtraParams() {
094: return extraParams;
095: }
096:
097: /**
098: * Sets the string of extra parameters for the URLs.
099: */
100: public void setExtraParams(String extraParams) {
101: this .extraParams = extraParams;
102: }
103:
104: /**
105: * Returns a collection of scripts. Use the Collection API to get/set/remove scripts.
106: */
107: public Collection getScripts() {
108: if (scripts == null) {
109: scripts = new ArrayList();
110: }
111: return scripts;
112: }
113:
114: /**
115: * A simple model of a breadcrumb. A bread crumb is a link with a display name.
116: */
117: public static class Breadcrumb {
118: private String name;
119: private String url;
120:
121: /**
122: * Creates a crumb given a name an URL.
123: */
124: public Breadcrumb(String name, String url) {
125: this .name = name;
126: this .url = url;
127: }
128:
129: /**
130: * Returns the name, with HTML escaped.
131: */
132: public String getName() {
133: if (name != null) {
134: return StringUtils.escapeHTMLTags(name);
135: } else {
136: return name;
137: }
138: }
139:
140: /**
141: * Returns the URL.
142: */
143: public String getUrl() {
144: return url;
145: }
146: }
147: }
|