KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > htmleditors > HtmlEditorCSS


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//
13

14 package org.jahia.services.htmleditors;
15
16 import java.util.Collection JavaDoc;
17 import java.util.Set JavaDoc;
18 import java.util.HashSet JavaDoc;
19 import java.io.Serializable JavaDoc;
20
21 /**
22  * <p>Title: HtmlEditor Editor CSS</p>
23  * <p>Description: </p>
24  * <p>Copyright: Copyright (c) 2002</p>
25  * <p>Company: Jahia S.A.R.L</p>
26  * @author Khue Nguyen
27  * @version 1.0
28  */

29
30 public class HtmlEditorCSS implements Serializable JavaDoc {
31
32     private String JavaDoc id;
33     private String JavaDoc name;
34     private String JavaDoc url;
35     private boolean shared; // shared to all sites
36
private Set JavaDoc allowedSites = new HashSet JavaDoc();
37
38     /**
39      *
40      * @param id
41      * @param name
42      * @param url
43      * @param shared
44      */

45     public HtmlEditorCSS(String JavaDoc id, String JavaDoc name, String JavaDoc url, boolean shared){
46         this.id = id;
47         this.name = name;
48         this.url = url;
49         this.shared = shared;
50     }
51
52     /**
53      * Returns the unique identifier.
54      *
55      * @return the unique identifier
56      */

57     public String JavaDoc getId(){
58         return this.id;
59     }
60
61     /**
62      * Returns the visual Display Name
63      *
64      * @return the visual Display name
65      */

66     public String JavaDoc getName(){
67         return this.name;
68     }
69
70     /**
71      * Returns the CSS url
72      *
73      * @return the CSS url
74      */

75     public String JavaDoc getURL(){
76         return this.url;
77     }
78
79     /**
80      * Returns true if shared with all sites
81      *
82      * @return
83      */

84     public boolean isShared(){
85         return this.shared;
86     }
87
88     /**
89      * Add a site to the allowed site list
90      */

91     public void addAllowedSite(String JavaDoc siteKey){
92         if ( siteKey != null ){
93             this.allowedSites.add(siteKey);
94         }
95     }
96
97     /**
98      * Add a set of allowed site
99      *
100      * @param sites
101      */

102     public void addAllowedSites(Collection JavaDoc sites){
103         if ( sites != null ){
104             this.allowedSites.addAll(sites);
105         }
106     }
107
108     /**
109      * Returns true if a site is allowed to use this CSS
110      */

111     public boolean isSiteAllowed(String JavaDoc siteKey){
112         return ( this.isShared()
113                  || ( siteKey != null && this.allowedSites.contains(siteKey) ) );
114     }
115 }
116
Popular Tags