1 50 51 package com.lowagie.text; 52 53 import java.util.ArrayList ; 54 55 67 68 public class Meta implements Element { 69 70 72 73 private int type; 74 75 76 private StringBuffer content; 77 78 80 86 Meta(int type, String content) { 87 this.type = type; 88 this.content = new StringBuffer (content); 89 } 90 91 97 public Meta(String tag, String content) { 98 this.type = Meta.getType(tag); 99 this.content = new StringBuffer (content); 100 } 101 102 104 111 public boolean process(ElementListener listener) { 112 try { 113 return listener.add(this); 114 } 115 catch(DocumentException de) { 116 return false; 117 } 118 } 119 120 125 public int type() { 126 return type; 127 } 128 129 134 public ArrayList getChunks() { 135 return new ArrayList (); 136 } 137 138 140 146 public StringBuffer append(String string) { 147 return content.append(string); 148 } 149 150 152 157 public String getContent() { 158 return content.toString(); 159 } 160 161 166 167 public String getName() { 168 switch (type) { 169 case Element.SUBJECT: 170 return ElementTags.SUBJECT; 171 case Element.KEYWORDS: 172 return ElementTags.KEYWORDS; 173 case Element.AUTHOR: 174 return ElementTags.AUTHOR; 175 case Element.TITLE: 176 return ElementTags.TITLE; 177 case Element.PRODUCER: 178 return ElementTags.PRODUCER; 179 case Element.CREATIONDATE: 180 return ElementTags.CREATIONDATE; 181 default: 182 return ElementTags.UNKNOWN; 183 } 184 } 185 186 192 public static int getType(String tag) { 193 if (ElementTags.SUBJECT.equals(tag)) { 194 return Element.SUBJECT; 195 } 196 if (ElementTags.KEYWORDS.equals(tag)) { 197 return Element.KEYWORDS; 198 } 199 if (ElementTags.AUTHOR.equals(tag)) { 200 return Element.AUTHOR; 201 } 202 if (ElementTags.TITLE.equals(tag)) { 203 return Element.TITLE; 204 } 205 if (ElementTags.PRODUCER.equals(tag)) { 206 return Element.PRODUCER; 207 } 208 if (ElementTags.CREATIONDATE.equals(tag)) { 209 return Element.CREATIONDATE; 210 } 211 return Element.HEADER; 212 } 213 214 216 222 public String name() { 223 return getName(); 224 } 225 226 232 public String content() { 233 return getContent(); 234 } 235 } | Popular Tags |