Produced by Araxis Merge on 9/25/2018 2:13:12 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\javax\swing\text\html | HTML.java | Mon Jan 22 14:46:54 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\javax\swing\text\html | HTML.java | Wed Sep 12 17:29:47 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 1392 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 199 8, 2013, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | package ja vax.swing. text.html; | |
26 | ||
27 | import jav a.io.*; | |
28 | import jav a.util.Has htable; | |
29 | import jav ax.swing.t ext.Attrib uteSet; | |
30 | import jav ax.swing.t ext.StyleC onstants; | |
31 | import jav ax.swing.t ext.StyleC ontext; | |
32 | ||
33 | /** | |
34 | * Constan ts used in the <code >HTMLDocum ent</code> . These | |
35 | * are bas ically tag and attri bute defin itions. | |
36 | * | |
37 | * @author Timothy Prinzing | |
38 | * @author Sunita M ani | |
39 | * | |
40 | */ | |
41 | public cla ss HTML { | |
42 | ||
43 | /** | |
44 | * Typ esafe enum eration fo r an HTML tag. Alth ough the | |
45 | * set of HTML t ags is a c losed set, we have l eft the | |
46 | * set open so t hat people can add t heir own t ag types | |
47 | * to their cust om parser and still communicat e to the | |
48 | * rea der. | |
49 | */ | |
50 | public static cl ass Tag { | |
51 | ||
52 | /* * @since 1 .3 */ | |
53 | pu blic Tag() {} | |
54 | ||
55 | /* * | |
56 | * Creates a new <code >Tag</code > with the specified <code>id< /code>, | |
57 | * and with <code>caus esBreak</c ode> and < code>isBlo ck</code> | |
58 | * set to <c ode>false< /code>. | |
59 | * | |
60 | * @param id the id o f the new tag | |
61 | * / | |
62 | pr otected Ta g(String i d) { | |
63 | this(id, false, fa lse); | |
64 | } | |
65 | ||
66 | /* * | |
67 | * Creates a new <code >Tag</code > with the specified <code>id< /code>; | |
68 | * <code>cau sesBreak</ code> and <code>isBl ock</code> are defin ed | |
69 | * by the us er. | |
70 | * | |
71 | * @param id the id of the new t ag | |
72 | * @param ca usesBreak <code>tru e</code> i f this tag | |
73 | * causes a break t o the flow of data | |
74 | * @param is Block <cod e>true</co de> if the tag is us ed | |
75 | * to add structure to a docu ment | |
76 | * / | |
77 | pr otected Ta g(String i d, boolean causesBre ak, boolea n isBlock) { | |
78 | name = i d; | |
79 | this.bre akTag = ca usesBreak; | |
80 | this.blo ckTag = is Block; | |
81 | } | |
82 | ||
83 | /* * | |
84 | * Returns < code>true< /code> if this tag i s a block | |
85 | * tag, whic h is a tag used to a dd structu re to a | |
86 | * document. | |
87 | * | |
88 | * @return < code>true< /code> if this tag i s a block | |
89 | * tag, ot herwise re turns <cod e>false</c ode> | |
90 | * / | |
91 | pu blic boole an isBlock () { | |
92 | return b lockTag; | |
93 | } | |
94 | ||
95 | /* * | |
96 | * Returns < code>true< /code> if this tag c auses a | |
97 | * line brea k to the f low of dat a, otherwi se returns | |
98 | * <code>fal se</code>. | |
99 | * | |
100 | * @return < code>true< /code> if this tag c auses a | |
101 | * line br eak to the flow of d ata, other wise retur ns | |
102 | * <code>f alse</code > | |
103 | * / | |
104 | pu blic boole an breaksF low() { | |
105 | return b reakTag; | |
106 | } | |
107 | ||
108 | /* * | |
109 | * Returns < code>true< /code> if this tag i s pre-form atted, | |
110 | * which is true if th e tag is e ither <cod e>PRE</cod e> or | |
111 | * <code>TEX TAREA</cod e>. | |
112 | * | |
113 | * @return < code>true< /code> if this tag i s pre-form atted, | |
114 | * otherwi se returns <code>fal se</code> | |
115 | * / | |
116 | pu blic boole an isPrefo rmatted() { | |
117 | return ( this == PR E || this == TEXTARE A); | |
118 | } | |
119 | ||
120 | /* * | |
121 | * Returns t he string representa tion of th e | |
122 | * tag. | |
123 | * | |
124 | * @return t he <code>S tring</cod e> represe ntation of the tag | |
125 | * / | |
126 | pu blic Strin g toString () { | |
127 | return n ame; | |
128 | } | |
129 | ||
130 | /* * | |
131 | * Returns < code>true< /code> if this tag i s consider ed to be a paragraph | |
132 | * in the in ternal HTM L model. < code>false </code> - otherwise. | |
133 | * | |
134 | * @return < code>true< /code> if this tag i s consider ed to be a paragraph | |
135 | * i n the inte rnal HTML model. <co de>false</ code> - ot herwise. | |
136 | * @see HTML Document.H TMLReader. ParagraphA ction | |
137 | * / | |
138 | bo olean isPa ragraph() { | |
139 | return ( | |
140 | this == P | |
141 | | | this == IMPLIED | |
142 | | | this == DT | |
143 | | | this == H1 | |
144 | | | this == H2 | |
145 | | | this == H3 | |
146 | | | this == H4 | |
147 | | | this == H5 | |
148 | | | this == H6 | |
149 | ); | |
150 | } | |
151 | ||
152 | bo olean bloc kTag; | |
153 | bo olean brea kTag; | |
154 | St ring name; | |
155 | bo olean unkn own; | |
156 | ||
157 | // --- Tag N ames ----- ---------- ---------- ---------- | |
158 | ||
159 | pu blic stati c final Ta g A = new Tag("a"); | |
160 | pu blic stati c final Ta g ADDRESS = new Tag( "address") ; | |
161 | pu blic stati c final Ta g APPLET = new Tag(" applet"); | |
162 | pu blic stati c final Ta g AREA = n ew Tag("ar ea"); | |
163 | pu blic stati c final Ta g B = new Tag("b"); | |
164 | pu blic stati c final Ta g BASE = n ew Tag("ba se"); | |
165 | pu blic stati c final Ta g BASEFONT = new Tag ("basefont "); | |
166 | pu blic stati c final Ta g BIG = ne w Tag("big "); | |
167 | pu blic stati c final Ta g BLOCKQUO TE = new T ag("blockq uote", tru e, true); | |
168 | pu blic stati c final Ta g BODY = n ew Tag("bo dy", true, true); | |
169 | pu blic stati c final Ta g BR = new Tag("br", true, fal se); | |
170 | pu blic stati c final Ta g CAPTION = new Tag( "caption") ; | |
171 | pu blic stati c final Ta g CENTER = new Tag(" center", t rue, false ); | |
172 | pu blic stati c final Ta g CITE = n ew Tag("ci te"); | |
173 | pu blic stati c final Ta g CODE = n ew Tag("co de"); | |
174 | pu blic stati c final Ta g DD = new Tag("dd", true, tru e); | |
175 | pu blic stati c final Ta g DFN = ne w Tag("dfn "); | |
176 | pu blic stati c final Ta g DIR = ne w Tag("dir ", true, t rue); | |
177 | pu blic stati c final Ta g DIV = ne w Tag("div ", true, t rue); | |
178 | pu blic stati c final Ta g DL = new Tag("dl", true, tru e); | |
179 | pu blic stati c final Ta g DT = new Tag("dt", true, tru e); | |
180 | pu blic stati c final Ta g EM = new Tag("em") ; | |
181 | pu blic stati c final Ta g FONT = n ew Tag("fo nt"); | |
182 | pu blic stati c final Ta g FORM = n ew Tag("fo rm", true, false); | |
183 | pu blic stati c final Ta g FRAME = new Tag("f rame"); | |
184 | pu blic stati c final Ta g FRAMESET = new Tag ("frameset "); | |
185 | pu blic stati c final Ta g H1 = new Tag("h1", true, tru e); | |
186 | pu blic stati c final Ta g H2 = new Tag("h2", true, tru e); | |
187 | pu blic stati c final Ta g H3 = new Tag("h3", true, tru e); | |
188 | pu blic stati c final Ta g H4 = new Tag("h4", true, tru e); | |
189 | pu blic stati c final Ta g H5 = new Tag("h5", true, tru e); | |
190 | pu blic stati c final Ta g H6 = new Tag("h6", true, tru e); | |
191 | pu blic stati c final Ta g HEAD = n ew Tag("he ad", true, true); | |
192 | pu blic stati c final Ta g HR = new Tag("hr", true, fal se); | |
193 | pu blic stati c final Ta g HTML = n ew Tag("ht ml", true, false); | |
194 | pu blic stati c final Ta g I = new Tag("i"); | |
195 | pu blic stati c final Ta g IMG = ne w Tag("img "); | |
196 | pu blic stati c final Ta g INPUT = new Tag("i nput"); | |
197 | pu blic stati c final Ta g ISINDEX = new Tag( "isindex", true, fal se); | |
198 | pu blic stati c final Ta g KBD = ne w Tag("kbd "); | |
199 | pu blic stati c final Ta g LI = new Tag("li", true, tru e); | |
200 | pu blic stati c final Ta g LINK = n ew Tag("li nk"); | |
201 | pu blic stati c final Ta g MAP = ne w Tag("map "); | |
202 | pu blic stati c final Ta g MENU = n ew Tag("me nu", true, true); | |
203 | pu blic stati c final Ta g META = n ew Tag("me ta"); | |
204 | /* public*/ s tatic fina l Tag NOBR = new Tag ("nobr"); | |
205 | pu blic stati c final Ta g NOFRAMES = new Tag ("noframes ", true, t rue); | |
206 | pu blic stati c final Ta g OBJECT = new Tag(" object"); | |
207 | pu blic stati c final Ta g OL = new Tag("ol", true, tru e); | |
208 | pu blic stati c final Ta g OPTION = new Tag(" option"); | |
209 | pu blic stati c final Ta g P = new Tag("p", t rue, true) ; | |
210 | pu blic stati c final Ta g PARAM = new Tag("p aram"); | |
211 | pu blic stati c final Ta g PRE = ne w Tag("pre ", true, t rue); | |
212 | pu blic stati c final Ta g SAMP = n ew Tag("sa mp"); | |
213 | pu blic stati c final Ta g SCRIPT = new Tag(" script"); | |
214 | pu blic stati c final Ta g SELECT = new Tag(" select"); | |
215 | pu blic stati c final Ta g SMALL = new Tag("s mall"); | |
216 | pu blic stati c final Ta g SPAN = n ew Tag("sp an"); | |
217 | pu blic stati c final Ta g STRIKE = new Tag(" strike"); | |
218 | pu blic stati c final Ta g S = new Tag("s"); | |
219 | pu blic stati c final Ta g STRONG = new Tag(" strong"); | |
220 | pu blic stati c final Ta g STYLE = new Tag("s tyle"); | |
221 | pu blic stati c final Ta g SUB = ne w Tag("sub "); | |
222 | pu blic stati c final Ta g SUP = ne w Tag("sup "); | |
223 | pu blic stati c final Ta g TABLE = new Tag("t able", fal se, true); | |
224 | pu blic stati c final Ta g TD = new Tag("td", true, tru e); | |
225 | pu blic stati c final Ta g TEXTAREA = new Tag ("textarea "); | |
226 | pu blic stati c final Ta g TH = new Tag("th", true, tru e); | |
227 | pu blic stati c final Ta g TITLE = new Tag("t itle", tru e, true); | |
228 | pu blic stati c final Ta g TR = new Tag("tr", false, tr ue); | |
229 | pu blic stati c final Ta g TT = new Tag("tt") ; | |
230 | pu blic stati c final Ta g U = new Tag("u"); | |
231 | pu blic stati c final Ta g UL = new Tag("ul", true, tru e); | |
232 | pu blic stati c final Ta g VAR = ne w Tag("var "); | |
233 | ||
234 | /* * | |
235 | * All text content mu st be in a paragraph element. | |
236 | * If a para graph didn 't exist w hen conten t was | |
237 | * encounter ed, a para graph is m anufacture d. | |
238 | * <p> | |
239 | * This is a tag synth esized by the HTML r eader. | |
240 | * Since ele ments are identified by their tag type, | |
241 | * we create a some fa ke tag typ es to mark the eleme nts | |
242 | * that were manufactu red. | |
243 | * / | |
244 | pu blic stati c final Ta g IMPLIED = new Tag( "p-implied "); | |
245 | ||
246 | /* * | |
247 | * All text content is labeled w ith this t ag. | |
248 | * <p> | |
249 | * This is a tag synth esized by the HTML r eader. | |
250 | * Since ele ments are identified by their tag type, | |
251 | * we create a some fa ke tag typ es to mark the eleme nts | |
252 | * that were manufactu red. | |
253 | * / | |
254 | pu blic stati c final Ta g CONTENT = new Tag( "content") ; | |
255 | ||
256 | /* * | |
257 | * All comme nts are la beled with this tag. | |
258 | * <p> | |
259 | * This is a tag synth esized by the HTML r eader. | |
260 | * Since ele ments are identified by their tag type, | |
261 | * we create a some fa ke tag typ es to mark the eleme nts | |
262 | * that were manufactu red. | |
263 | * / | |
264 | pu blic stati c final Ta g COMMENT = new Tag( "comment") ; | |
265 | ||
266 | st atic final Tag allTa gs[] = { | |
267 | A, ADDRE SS, APPLET , AREA, B, BASE, BAS EFONT, BIG , | |
268 | BLOCKQUO TE, BODY, BR, CAPTIO N, CENTER, CITE, COD E, | |
269 | DD, DFN, DIR, DIV, DL, DT, E M, FONT, F ORM, FRAME , | |
270 | FRAMESET , H1, H2, H3, H4, H5 , H6, HEAD , HR, HTML , | |
271 | I, IMG, INPUT, ISI NDEX, KBD, LI, LINK, MAP, MENU , | |
272 | META, NO BR, NOFRAM ES, OBJECT , OL, OPTI ON, P, PAR AM, | |
273 | PRE, SAM P, SCRIPT, SELECT, S MALL, SPAN , STRIKE, S, | |
274 | STRONG, STYLE, SUB , SUP, TAB LE, TD, TE XTAREA, | |
275 | TH, TITL E, TR, TT, U, UL, VA R | |
276 | }; | |
277 | ||
278 | st atic { | |
279 | // Force HTMLs sta tic initia lize to be loaded. | |
280 | getTag(" html"); | |
281 | } | |
282 | } | |
283 | ||
284 | // The re is no u nique inst ance of Un knownTag, so we allo w it to be | |
285 | // Ser ializable. | |
286 | public static cl ass Unknow nTag exten ds Tag imp lements Se rializable { | |
287 | ||
288 | /* * | |
289 | * Creates a new <code >UnknownTa g</code> w ith the sp ecified | |
290 | * <code>id< /code>. | |
291 | * @param id the id of the new t ag | |
292 | * / | |
293 | pu blic Unkno wnTag(Stri ng id) { | |
294 | super(id ); | |
295 | } | |
296 | ||
297 | /* * | |
298 | * Returns t he hash co de which c orresponds to the st ring | |
299 | * for this tag. | |
300 | * / | |
301 | pu blic int h ashCode() { | |
302 | return t oString(). hashCode() ; | |
303 | } | |
304 | ||
305 | /* * | |
306 | * Compares this objec t to the s pecified o bject. | |
307 | * The resul t is <code >true</cod e> if and only if th e argument is not | |
308 | * <code>nul l</code> a nd is an < code>Unkno wnTag</cod e> object | |
309 | * with the same name. | |
310 | * | |
311 | * @param obj th e object t o compare this tag w ith | |
312 | * @return <code>tr ue</code> if the obj ects are e qual; | |
313 | * <code>fa lse</code> otherwise | |
314 | * / | |
315 | pu blic boole an equals( Object obj ) { | |
316 | if (obj instanceof UnknownTa g) { | |
317 | retu rn toStrin g().equals (obj.toStr ing()); | |
318 | } | |
319 | return f alse; | |
320 | } | |
321 | ||
322 | pr ivate void writeObje ct(java.io .ObjectOut putStream s) | |
323 | throws IO Exception { | |
324 | s.defaul tWriteObje ct(); | |
325 | s.writeB oolean(blo ckTag); | |
326 | s.writeB oolean(bre akTag); | |
327 | s.writeB oolean(unk nown); | |
328 | s.writeO bject(name ); | |
329 | } | |
330 | ||
331 | pr ivate void readObjec t(ObjectIn putStream s) | |
332 | throws C lassNotFou ndExceptio n, IOExcep tion { | |
333 | s.defaul tReadObjec t(); | |
334 | blockTag = s.readB oolean(); | |
335 | breakTag = s.readB oolean(); | |
336 | unknown = s.readBo olean(); | |
337 | name = ( String)s.r eadObject( ); | |
338 | } | |
339 | } | |
340 | ||
341 | /** | |
342 | * Typ esafe enum eration re presenting an HTML | |
343 | * att ribute. | |
344 | */ | |
345 | public static fi nal class Attribute { | |
346 | ||
347 | /* * | |
348 | * Creates a new <code >Attribute </code> wi th the spe cified | |
349 | * <code>id< /code>. | |
350 | * | |
351 | * @param id the id of the new < code>Attri bute</code > | |
352 | * / | |
353 | At tribute(St ring id) { | |
354 | name = i d; | |
355 | } | |
356 | ||
357 | /* * | |
358 | * Returns t he string representa tion of th is attribu te. | |
359 | * @return t he string representa tion of th is attribu te | |
360 | * / | |
361 | pu blic Strin g toString () { | |
362 | return n ame; | |
363 | } | |
364 | ||
365 | pr ivate Stri ng name; | |
366 | ||
367 | pu blic stati c final At tribute SI ZE = new A ttribute(" size"); | |
368 | pu blic stati c final At tribute CO LOR = new Attribute( "color"); | |
369 | pu blic stati c final At tribute CL EAR = new Attribute( "clear"); | |
370 | pu blic stati c final At tribute BA CKGROUND = new Attri bute("back ground"); | |
371 | pu blic stati c final At tribute BG COLOR = ne w Attribut e("bgcolor "); | |
372 | pu blic stati c final At tribute TE XT = new A ttribute(" text"); | |
373 | pu blic stati c final At tribute LI NK = new A ttribute(" link"); | |
374 | pu blic stati c final At tribute VL INK = new Attribute( "vlink"); | |
375 | pu blic stati c final At tribute AL INK = new Attribute( "alink"); | |
376 | pu blic stati c final At tribute WI DTH = new Attribute( "width"); | |
377 | pu blic stati c final At tribute HE IGHT = new Attribute ("height") ; | |
378 | pu blic stati c final At tribute AL IGN = new Attribute( "align"); | |
379 | pu blic stati c final At tribute NA ME = new A ttribute(" name"); | |
380 | pu blic stati c final At tribute HR EF = new A ttribute(" href"); | |
381 | pu blic stati c final At tribute RE L = new At tribute("r el"); | |
382 | pu blic stati c final At tribute RE V = new At tribute("r ev"); | |
383 | pu blic stati c final At tribute TI TLE = new Attribute( "title"); | |
384 | pu blic stati c final At tribute TA RGET = new Attribute ("target") ; | |
385 | pu blic stati c final At tribute SH APE = new Attribute( "shape"); | |
386 | pu blic stati c final At tribute CO ORDS = new Attribute ("coords") ; | |
387 | pu blic stati c final At tribute IS MAP = new Attribute( "ismap"); | |
388 | pu blic stati c final At tribute NO HREF = new Attribute ("nohref") ; | |
389 | pu blic stati c final At tribute AL T = new At tribute("a lt"); | |
390 | pu blic stati c final At tribute ID = new Att ribute("id "); | |
391 | pu blic stati c final At tribute SR C = new At tribute("s rc"); | |
392 | pu blic stati c final At tribute HS PACE = new Attribute ("hspace") ; | |
393 | pu blic stati c final At tribute VS PACE = new Attribute ("vspace") ; | |
394 | pu blic stati c final At tribute US EMAP = new Attribute ("usemap") ; | |
395 | pu blic stati c final At tribute LO WSRC = new Attribute ("lowsrc") ; | |
396 | pu blic stati c final At tribute CO DEBASE = n ew Attribu te("codeba se"); | |
397 | pu blic stati c final At tribute CO DE = new A ttribute(" code"); | |
398 | pu blic stati c final At tribute AR CHIVE = ne w Attribut e("archive "); | |
399 | pu blic stati c final At tribute VA LUE = new Attribute( "value"); | |
400 | pu blic stati c final At tribute VA LUETYPE = new Attrib ute("value type"); | |
401 | pu blic stati c final At tribute TY PE = new A ttribute(" type"); | |
402 | pu blic stati c final At tribute CL ASS = new Attribute( "class"); | |
403 | pu blic stati c final At tribute ST YLE = new Attribute( "style"); | |
404 | pu blic stati c final At tribute LA NG = new A ttribute(" lang"); | |
405 | pu blic stati c final At tribute FA CE = new A ttribute(" face"); | |
406 | pu blic stati c final At tribute DI R = new At tribute("d ir"); | |
407 | pu blic stati c final At tribute DE CLARE = ne w Attribut e("declare "); | |
408 | pu blic stati c final At tribute CL ASSID = ne w Attribut e("classid "); | |
409 | pu blic stati c final At tribute DA TA = new A ttribute(" data"); | |
410 | pu blic stati c final At tribute CO DETYPE = n ew Attribu te("codety pe"); | |
411 | pu blic stati c final At tribute ST ANDBY = ne w Attribut e("standby "); | |
412 | pu blic stati c final At tribute BO RDER = new Attribute ("border") ; | |
413 | pu blic stati c final At tribute SH APES = new Attribute ("shapes") ; | |
414 | pu blic stati c final At tribute NO SHADE = ne w Attribut e("noshade "); | |
415 | pu blic stati c final At tribute CO MPACT = ne w Attribut e("compact "); | |
416 | pu blic stati c final At tribute ST ART = new Attribute( "start"); | |
417 | pu blic stati c final At tribute AC TION = new Attribute ("action") ; | |
418 | pu blic stati c final At tribute ME THOD = new Attribute ("method") ; | |
419 | pu blic stati c final At tribute EN CTYPE = ne w Attribut e("enctype "); | |
420 | pu blic stati c final At tribute CH ECKED = ne w Attribut e("checked "); | |
421 | pu blic stati c final At tribute MA XLENGTH = new Attrib ute("maxle ngth"); | |
422 | pu blic stati c final At tribute MU LTIPLE = n ew Attribu te("multip le"); | |
423 | pu blic stati c final At tribute SE LECTED = n ew Attribu te("select ed"); | |
424 | pu blic stati c final At tribute RO WS = new A ttribute(" rows"); | |
425 | pu blic stati c final At tribute CO LS = new A ttribute(" cols"); | |
426 | pu blic stati c final At tribute DU MMY = new Attribute( "dummy"); | |
427 | pu blic stati c final At tribute CE LLSPACING = new Attr ibute("cel lspacing") ; | |
428 | pu blic stati c final At tribute CE LLPADDING = new Attr ibute("cel lpadding") ; | |
429 | pu blic stati c final At tribute VA LIGN = new Attribute ("valign") ; | |
430 | pu blic stati c final At tribute HA LIGN = new Attribute ("halign") ; | |
431 | pu blic stati c final At tribute NO WRAP = new Attribute ("nowrap") ; | |
432 | pu blic stati c final At tribute RO WSPAN = ne w Attribut e("rowspan "); | |
433 | pu blic stati c final At tribute CO LSPAN = ne w Attribut e("colspan "); | |
434 | pu blic stati c final At tribute PR OMPT = new Attribute ("prompt") ; | |
435 | pu blic stati c final At tribute HT TPEQUIV = new Attrib ute("http- equiv"); | |
436 | pu blic stati c final At tribute CO NTENT = ne w Attribut e("content "); | |
437 | pu blic stati c final At tribute LA NGUAGE = n ew Attribu te("langua ge"); | |
438 | pu blic stati c final At tribute VE RSION = ne w Attribut e("version "); | |
439 | pu blic stati c final At tribute N = new Attr ibute("n") ; | |
440 | pu blic stati c final At tribute FR AMEBORDER = new Attr ibute("fra meborder") ; | |
441 | pu blic stati c final At tribute MA RGINWIDTH = new Attr ibute("mar ginwidth") ; | |
442 | pu blic stati c final At tribute MA RGINHEIGHT = new Att ribute("ma rginheight "); | |
443 | pu blic stati c final At tribute SC ROLLING = new Attrib ute("scrol ling"); | |
444 | pu blic stati c final At tribute NO RESIZE = n ew Attribu te("noresi ze"); | |
445 | pu blic stati c final At tribute EN DTAG = new Attribute ("endtag") ; | |
446 | pu blic stati c final At tribute CO MMENT = ne w Attribut e("comment "); | |
447 | st atic final Attribute MEDIA = n ew Attribu te("media" ); | |
448 | ||
449 | st atic final Attribute allAttrib utes[] = { | |
450 | FACE, | |
451 | COMMENT, | |
452 | SIZE, | |
453 | COLOR, | |
454 | CLEAR, | |
455 | BACKGROU ND, | |
456 | BGCOLOR, | |
457 | TEXT, | |
458 | LINK, | |
459 | VLINK, | |
460 | ALINK, | |
461 | WIDTH, | |
462 | HEIGHT, | |
463 | ALIGN, | |
464 | NAME, | |
465 | HREF, | |
466 | REL, | |
467 | REV, | |
468 | TITLE, | |
469 | TARGET, | |
470 | SHAPE, | |
471 | COORDS, | |
472 | ISMAP, | |
473 | NOHREF, | |
474 | ALT, | |
475 | ID, | |
476 | SRC, | |
477 | HSPACE, | |
478 | VSPACE, | |
479 | USEMAP, | |
480 | LOWSRC, | |
481 | CODEBASE , | |
482 | CODE, | |
483 | ARCHIVE, | |
484 | VALUE, | |
485 | VALUETYP E, | |
486 | TYPE, | |
487 | CLASS, | |
488 | STYLE, | |
489 | LANG, | |
490 | DIR, | |
491 | DECLARE, | |
492 | CLASSID, | |
493 | DATA, | |
494 | CODETYPE , | |
495 | STANDBY, | |
496 | BORDER, | |
497 | SHAPES, | |
498 | NOSHADE, | |
499 | COMPACT, | |
500 | START, | |
501 | ACTION, | |
502 | METHOD, | |
503 | ENCTYPE, | |
504 | CHECKED, | |
505 | MAXLENGT H, | |
506 | MULTIPLE , | |
507 | SELECTED , | |
508 | ROWS, | |
509 | COLS, | |
510 | DUMMY, | |
511 | CELLSPAC ING, | |
512 | CELLPADD ING, | |
513 | VALIGN, | |
514 | HALIGN, | |
515 | NOWRAP, | |
516 | ROWSPAN, | |
517 | COLSPAN, | |
518 | PROMPT, | |
519 | HTTPEQUI V, | |
520 | CONTENT, | |
521 | LANGUAGE , | |
522 | VERSION, | |
523 | N, | |
524 | FRAMEBOR DER, | |
525 | MARGINWI DTH, | |
526 | MARGINHE IGHT, | |
527 | SCROLLIN G, | |
528 | NORESIZE , | |
529 | MEDIA, | |
530 | ENDTAG | |
531 | }; | |
532 | } | |
533 | ||
534 | // The PW to 73, is that, give n that the Hashtable contents | |
535 | // nev er change once the s tatic init ialization happens, the initia l size | |
536 | // tha t the hash table grew to was de termined, and then t hat very s ize | |
537 | // is used. | |
538 | // | |
539 | privat e static f inal Hasht able<Strin g, Tag> ta gHashtable = new Has htable<Str ing, Tag>( 73); | |
540 | ||
541 | /** Ma ps from St yleConstan t key to H TML.Tag. * / | |
542 | privat e static f inal Hasht able<Objec t, Tag> sc Mapping = new Hashta ble<Object , Tag>(8); | |
543 | ||
544 | static { | |
545 | ||
546 | fo r (int i = 0; i < Ta g.allTags. length; i+ + ) { | |
547 | tagHasht able.put(T ag.allTags [i].toStri ng(), Tag. allTags[i] ); | |
548 | StyleCon text.regis terStaticA ttributeKe y(Tag.allT ags[i]); | |
549 | } | |
550 | St yleContext .registerS taticAttri buteKey(Ta g.IMPLIED) ; | |
551 | St yleContext .registerS taticAttri buteKey(Ta g.CONTENT) ; | |
552 | St yleContext .registerS taticAttri buteKey(Ta g.COMMENT) ; | |
553 | fo r (int i = 0; i < At tribute.al lAttribute s.length; i++) { | |
554 | StyleCon text.regis terStaticA ttributeKe y(Attribut e. | |
555 | allAttri butes[i]); | |
556 | } | |
557 | St yleContext .registerS taticAttri buteKey(HT ML.NULL_AT TRIBUTE_VA LUE); | |
558 | sc Mapping.pu t(StyleCon stants.Bol d, Tag.B); | |
559 | sc Mapping.pu t(StyleCon stants.Ita lic, Tag.I ); | |
560 | sc Mapping.pu t(StyleCon stants.Und erline, Ta g.U); | |
561 | sc Mapping.pu t(StyleCon stants.Str ikeThrough , Tag.STRI KE); | |
562 | sc Mapping.pu t(StyleCon stants.Sup erscript, Tag.SUP); | |
563 | sc Mapping.pu t(StyleCon stants.Sub script, Ta g.SUB); | |
564 | sc Mapping.pu t(StyleCon stants.Fon tFamily, T ag.FONT); | |
565 | sc Mapping.pu t(StyleCon stants.Fon tSize, Tag .FONT); | |
566 | } | |
567 | ||
568 | /** | |
569 | * Ret urns the s et of actu al HTML ta gs that | |
570 | * are recognize d by the d efault HTM L reader. | |
571 | * Thi s set does not inclu de tags th at are | |
572 | * man ufactured by the rea der. | |
573 | */ | |
574 | public static Ta g[] getAll Tags() { | |
575 | Ta g[] tags = new Tag[T ag.allTags .length]; | |
576 | Sy stem.array copy(Tag.a llTags, 0, tags, 0, Tag.allTag s.length); | |
577 | re turn tags; | |
578 | } | |
579 | ||
580 | /** | |
581 | * Fet ches a tag constant for a well -known tag name (i.e . one of | |
582 | * the tags in t he set {A, ADDRESS, APPLET, AR EA, B, | |
583 | * BAS E, BASEFON T, BIG, | |
584 | * BLO CKQUOTE, B ODY, BR, C APTION, CE NTER, CITE , CODE, | |
585 | * DD, DFN, DIR, DIV, DL, DT, EM, FO NT, FORM, FRAME, | |
586 | * FRA MESET, H1, H2, H3, H 4, H5, H6, HEAD, HR, HTML, | |
587 | * I, IMG, INPUT , ISINDEX, KBD, LI, LINK, MAP, MENU, | |
588 | * MET A, NOBR, N OFRAMES, O BJECT, OL, OPTION, P , PARAM, | |
589 | * PRE , SAMP, SC RIPT, SELE CT, SMALL, SPAN, STR IKE, S, | |
590 | * STR ONG, STYLE , SUB, SUP , TABLE, T D, TEXTARE A, | |
591 | * TH, TITLE, TR , TT, U, U L, VAR}. If the giv en | |
592 | * nam e does not represent one of th e well-kno wn tags, t hen | |
593 | * <co de>null</c ode> will be returne d. | |
594 | * | |
595 | * @pa ram tagNam e the <cod e>String</ code> name requested | |
596 | * @re turn a tag constant correspond ing to the <code>tag Name</code >, | |
597 | * or <code>n ull</code> if not fo und | |
598 | */ | |
599 | public static Ta g getTag(S tring tagN ame) { | |
600 | ||
601 | Ta g t = tag Hashtable. get(tagNam e); | |
602 | re turn (t == null ? nu ll : t); | |
603 | } | |
604 | ||
605 | /** | |
606 | * Ret urns the H TML <code> Tag</code> associate d with the | |
607 | * <co de>StyleCo nstants</c ode> key < code>sc</c ode>. | |
608 | * If no matchin g <code>Ta g</code> i s found, r eturns | |
609 | * <co de>null</c ode>. | |
610 | * | |
611 | * @pa ram sc the <code>Sty leConstant s</code> k ey | |
612 | * @re turn tag w hich corre sponds to <code>sc</ code>, or | |
613 | * < code>null< /code> if not found | |
614 | */ | |
615 | static Tag getTa gForStyleC onstantsKe y(StyleCon stants sc) { | |
616 | re turn scMap ping.get(s c); | |
617 | } | |
618 | ||
619 | /** | |
620 | * Fet ches an in teger attr ibute valu e. Attrib ute values | |
621 | * are stored as a string, and this is a conve nience met hod | |
622 | * to convert to an actual integer. | |
623 | * | |
624 | * @pa ram attr t he set of attributes to use to try to fe tch a valu e | |
625 | * @pa ram key th e key to u se to fetc h the valu e | |
626 | * @pa ram def th e default value to u se if the attribute isn't | |
627 | * de fined or t here is an error con verting to an intege r | |
628 | */ | |
629 | public static in t getInteg erAttribut eValue(Att ributeSet attr, | |
630 | Att ribute key , int def) { | |
631 | in t value = def; | |
632 | St ring istr = (String) attr.getA ttribute(k ey); | |
633 | if (istr != null) { | |
634 | try { | |
635 | valu e = Intege r.valueOf( istr).intV alue(); | |
636 | } catch (NumberFor matExcepti on e) { | |
637 | valu e = def; | |
638 | } | |
639 | } | |
640 | re turn value ; | |
641 | } | |
642 | ||
643 | // Th is is used in cases where the value for the attrib ute has no t | |
644 | // be en specifi ed. | |
645 | // | |
646 | public static fi nal String NULL_ATTR IBUTE_VALU E = "#DEFA ULT"; | |
647 | ||
648 | // siz e determin ed similar to size o f tagHasht able | |
649 | privat e static f inal Hasht able<Strin g, Attribu te> attHas htable = n ew Hashtab le<String, Attribute >(77); | |
650 | ||
651 | static { | |
652 | ||
653 | fo r (int i = 0; i < At tribute.al lAttribute s.length; i++ ) { | |
654 | attHasht able.put(A ttribute.a llAttribut es[i].toSt ring(), At tribute.al lAttribute s[i]); | |
655 | } | |
656 | } | |
657 | ||
658 | /** | |
659 | * Ret urns the s et of HTML attribute s recogniz ed. | |
660 | * @re turn the s et of HTML attribute s recogniz ed | |
661 | */ | |
662 | public static At tribute[] getAllAttr ibuteKeys( ) { | |
663 | At tribute[] attributes = new Att ribute[Att ribute.all Attributes .length]; | |
664 | Sy stem.array copy(Attri bute.allAt tributes, 0, | |
665 | attri butes, 0, Attribute. allAttribu tes.length ); | |
666 | re turn attri butes; | |
667 | } | |
668 | ||
669 | /** | |
670 | * Fet ches an at tribute co nstant for a well-kn own attrib ute name | |
671 | * (i. e. one of the attrib utes in th e set {FAC E, COMMENT , SIZE, | |
672 | * COL OR, CLEAR, BACKGROUN D, BGCOLOR , TEXT, LI NK, VLINK, ALINK, | |
673 | * WID TH, HEIGHT , ALIGN, N AME, HREF, REL, REV, TITLE, TA RGET, | |
674 | * SHA PE, COORDS , ISMAP, N OHREF, ALT , ID, SRC, HSPACE, V SPACE, | |
675 | * USE MAP, LOWSR C, CODEBAS E, CODE, A RCHIVE, VA LUE, VALUE TYPE, | |
676 | * TYP E, CLASS, STYLE, LAN G, DIR, DE CLARE, CLA SSID, DATA , CODETYPE , | |
677 | * STA NDBY, BORD ER, SHAPES , NOSHADE, COMPACT, START, ACT ION, METHO D, | |
678 | * ENC TYPE, CHEC KED, MAXLE NGTH, MULT IPLE, SELE CTED, ROWS , COLS, | |
679 | * DUM MY, CELLSP ACING, CEL LPADDING, VALIGN, HA LIGN, NOWR AP, ROWSPA N, | |
680 | * COL SPAN, PROM PT, HTTPEQ UIV, CONTE NT, LANGUA GE, VERSIO N, N, | |
681 | * FRA MEBORDER, MARGINWIDT H, MARGINH EIGHT, SCR OLLING, NO RESIZE, | |
682 | * MED IA, ENDTAG }). | |
683 | * If the given name does not repres ent one of the well- known attr ibutes, | |
684 | * the n <code>nu ll</code> will be re turned. | |
685 | * | |
686 | * @pa ram attNam e the <cod e>String</ code> requ ested | |
687 | * @re turn the < code>Attri bute</code > correspo nding to < code>attNa me</code> | |
688 | */ | |
689 | public static At tribute ge tAttribute Key(String attName) { | |
690 | At tribute a = attHasht able.get(a ttName); | |
691 | if (a == nul l) { | |
692 | return nul l; | |
693 | } | |
694 | re turn a; | |
695 | } | |
696 | ||
697 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.