KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > deliver > applications > databeans > Slot


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.deliver.applications.databeans;
25
26 import java.net.URLEncoder JavaDoc;
27 import java.util.ArrayList JavaDoc;
28 import java.util.List JavaDoc;
29
30 import org.infoglue.cms.util.CmsPropertyHandler;
31
32 /**
33  * @author mattias
34  * This class represents a slot in a page component structure.
35  * A slot can contain any number of components.
36  */

37
38 public class Slot
39 {
40     private String JavaDoc id;
41     private String JavaDoc number;
42     private String JavaDoc name;
43     private boolean inherit;
44     private List JavaDoc components = new ArrayList JavaDoc();
45     private String JavaDoc[] allowedComponentsArray = null;
46     
47     public List JavaDoc getComponents()
48     {
49         return this.components;
50     }
51
52     public String JavaDoc getId()
53     {
54         return this.id;
55     }
56
57     public String JavaDoc getName()
58     {
59         return this.name;
60     }
61
62     public void setComponents(List JavaDoc components)
63     {
64         this.components = components;
65     }
66
67     public void setId(String JavaDoc id)
68     {
69         this.id = id;
70     }
71
72     public void setName(String JavaDoc name)
73     {
74         this.name = name;
75     }
76
77     public String JavaDoc getNumber()
78     {
79         return this.number;
80     }
81
82     public void setNumber(String JavaDoc number)
83     {
84         this.number = number;
85     }
86
87     public boolean isInherit()
88     {
89         return inherit;
90     }
91
92     public void setInherit(boolean inherit)
93     {
94         this.inherit = inherit;
95     }
96
97     public String JavaDoc[] getAllowedComponentsArray()
98     {
99         return allowedComponentsArray;
100     }
101     
102     public void setAllowedComponentsArray(String JavaDoc[] allowedComponentsArray)
103     {
104         this.allowedComponentsArray = allowedComponentsArray;
105     }
106
107     public String JavaDoc getAllowedComponentsArrayAsUrlEncodedString() throws Exception JavaDoc
108     {
109         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
110         
111         if(allowedComponentsArray != null)
112         {
113             for(int i=0; i<allowedComponentsArray.length; i++)
114             {
115                 if(i > 0)
116                     sb.append("&");
117                 
118                 //sb.append("allowedComponentNames=" + URLEncoder.encode(allowedComponentsArray[i], "UTF-8"));
119
String JavaDoc encoding = CmsPropertyHandler.getURIEncoding();
120                 
121                 sb.append("allowedComponentNames=" + URLEncoder.encode(allowedComponentsArray[i], encoding));
122             }
123         }
124         else
125             return null;
126         
127         return sb.toString();
128     }
129
130 }
131
Popular Tags