1 18 19 package org.apache.roller.pojos; 20 21 import java.io.Serializable ; 22 import java.util.Collection ; 23 import java.util.Date ; 24 import java.util.HashMap ; 25 import java.util.Iterator ; 26 import java.util.Map ; 27 28 29 34 public class Theme implements Serializable { 35 36 public static final String CUSTOM = "custom"; 38 39 private String id; 40 private String name; 41 private String description; 42 private String author; 43 private String lastEditor; private Date lastModified; 45 private boolean enabled; 46 47 private Map templates; 50 51 52 public Theme() { 53 this.id = null; 54 this.name = null; 55 this.description = null; 56 this.author = null; 57 this.lastEditor = null; 58 this.lastModified = null; 59 this.enabled = false; 60 this.templates = new HashMap (); 61 } 62 63 64 67 public Collection getTemplates() { 68 return this.templates.values(); 69 } 70 71 72 76 public ThemeTemplate getTemplate(String name) { 77 return (ThemeTemplate) this.templates.get(name); 78 } 79 80 81 90 public ThemeTemplate getTemplateByLink(String link) { 91 return (ThemeTemplate) this.templates.get(link); 92 } 93 94 95 98 public void setTemplate(String name, ThemeTemplate template) { 99 this.templates.put(name, template); 100 } 101 102 103 107 public boolean hasTemplate(String name) { 108 return this.templates.containsKey(name); 109 } 110 111 112 public String getId() { 113 return id; 114 } 115 116 public void setId(String id) { 117 this.id = id; 118 } 119 120 public String getName() { 121 return name; 122 } 123 124 public void setName(String name) { 125 this.name = name; 126 } 127 128 public String getDescription() { 129 return description; 130 } 131 132 public void setDescription(String description) { 133 this.description = description; 134 } 135 136 public String getAuthor() { 137 return author; 138 } 139 140 public void setAuthor(String author) { 141 this.author = author; 142 } 143 144 public String getLastEditor() { 145 return lastEditor; 146 } 147 148 public void setLastEditor(String lastEditor) { 149 this.lastEditor = lastEditor; 150 } 151 152 public Date getLastModified() { 153 return lastModified; 154 } 155 156 public void setLastModified(Date lastModified) { 157 this.lastModified = lastModified; 158 } 159 160 public boolean isEnabled() { 161 return enabled; 162 } 163 164 public void setEnabled(boolean enabled) { 165 this.enabled = enabled; 166 } 167 168 public String toString() { 169 StringBuffer sb = new StringBuffer (); 170 sb.append(name); 171 sb.append("\n"); 172 173 Iterator it = this.templates.values().iterator(); 174 while(it.hasNext()) { 175 sb.append(it.next()); 176 sb.append("\n"); 177 } 178 179 return sb.toString(); 180 181 } 182 183 } 184 | Popular Tags |