1
|
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
|
18
|
|
|
19
|
|
|
20
|
|
import javax.swing.JPanel;
|
21
|
|
import javax.swing.JLabel;
|
22
|
|
import javax.swing.JList;
|
23
|
|
import javax.swing.ListSelectionModel;
|
24
|
|
import javax.swing.JScrollPane;
|
25
|
|
import javax.swing.JTextField;
|
26
|
|
import javax.swing.event.ListSelectionListener;
|
27
|
|
import javax.swing.event.ListSelectionEvent;
|
28
|
|
import javax.swing.ListModel;
|
29
|
|
import javax.swing.JButton;
|
30
|
|
import javax.swing.text.StyleConstants;
|
31
|
|
import java.awt.Frame;
|
32
|
|
import java.awt.GraphicsEnvironment;
|
33
|
|
import java.awt.Dimension;
|
34
|
|
import java.awt.GridLayout;
|
35
|
|
import java.awt.BorderLayout;
|
36
|
|
import java.awt.FlowLayout;
|
37
|
|
import java.awt.Component;
|
38
|
|
import javax.swing.SwingConstants;
|
39
|
|
import javax.swing.border.TitledBorder;
|
40
|
|
import javax.swing.border.EtchedBorder;
|
41
|
|
import javax.swing.text.AttributeSet;
|
42
|
|
import javax.swing.text.SimpleAttributeSet;
|
43
|
|
import java.awt.Font;
|
44
|
|
import java.awt.Color;
|
45
|
|
import java.awt.event.ActionListener;
|
46
|
|
import java.awt.event.ActionEvent;
|
47
|
|
import javax.swing.UIManager;
|
48
|
|
import java.util.ResourceBundle;
|
49
|
|
import javax.swing.text.html.CSS;
|
50
|
|
import javax.swing.text.html.StyleSheet;
|
51
|
|
import javax.swing.text.MutableAttributeSet;
|
52
|
|
import java.util.Vector;
|
53
|
|
import java.util.Enumeration;
|
54
|
|
|
55
|
|
|
56
|
|
|
57
|
|
|
58
|
|
|
59
|
|
|
60
|
|
|
61
|
|
|
62
|
|
|
63
|
|
|
64
|
|
|
65
|
|
|
66
|
|
|
67
|
|
|
68
|
|
|
69
|
|
|
70
|
|
|
71
|
|
|
72
|
|
|
73
|
|
|
74
|
|
public class FontPanel extends JPanel implements TitledPickList.TitledPickListListener,
|
75
|
|
ColorPanel.ColorPanelListener
|
76
|
|
{
|
77
|
|
|
78
|
|
|
79
|
|
JTextField sample = new JTextField();
|
80
|
|
|
81
|
|
|
82
|
|
private Vector fontComponents = new Vector(0);
|
83
|
|
|
84
|
4
|
public FontPanel() {
|
85
|
4
|
setLayout(new BorderLayout(5,5));
|
86
|
|
|
87
|
|
|
88
|
4
|
sample.setText("");
|
89
|
4
|
sample.setEditable(false);
|
90
|
4
|
sample.setPreferredSize(new Dimension(200, 50));
|
91
|
4
|
sample.setHorizontalAlignment(SwingConstants.CENTER);
|
92
|
4
|
sample.setText(FrmMain.dynRes.getResourceString(FrmMain.resources, "previewText"));
|
93
|
4
|
JPanel previewPanel = new JPanel(new BorderLayout());
|
94
|
4
|
previewPanel.add(sample, BorderLayout.CENTER);
|
95
|
4
|
previewPanel.setBorder(new TitledBorder(new EtchedBorder(
|
96
|
|
EtchedBorder.LOWERED), FrmMain.dynRes.getResourceString(FrmMain.resources, "previewLabel")));
|
97
|
|
|
98
|
|
|
99
|
|
|
100
|
|
|
101
|
|
|
102
|
4
|
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
103
|
4
|
FamilyPickList family = new FamilyPickList(ge.getAvailableFontFamilyNames(),
|
104
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "familyLabel"));
|
105
|
4
|
family.addTitledPickListListener(this);
|
106
|
4
|
fontComponents.add(family);
|
107
|
|
|
108
|
|
|
109
|
4
|
String[] fontSizes = new String[] {"8", "10", "12", "14", "18", "24"};
|
110
|
4
|
SizePickList size = new SizePickList(fontSizes,
|
111
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "sizeLabel"), CSS.Attribute.FONT_SIZE);
|
112
|
4
|
size.addTitledPickListListener(this);
|
113
|
4
|
fontComponents.add(size);
|
114
|
|
|
115
|
|
|
116
|
4
|
JPanel familySizePanel = new JPanel(new BorderLayout(5,5));
|
117
|
4
|
familySizePanel.add(family, BorderLayout.CENTER);
|
118
|
4
|
familySizePanel.add(size, BorderLayout.EAST);
|
119
|
|
|
120
|
|
|
121
|
4
|
JPanel fontPartsPanel = new JPanel(new BorderLayout(5,5));
|
122
|
4
|
fontPartsPanel.add(familySizePanel, BorderLayout.CENTER);
|
123
|
4
|
String[] fontStyles = new String[] {
|
124
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "plainName"),
|
125
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "boldName"),
|
126
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "italicName"),
|
127
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "boldItalicName")};
|
128
|
4
|
StylePickList style = new StylePickList(
|
129
|
|
fontStyles,
|
130
|
|
FrmMain.dynRes.getResourceString(FrmMain.resources, "styleLabel"));
|
131
|
4
|
style.addTitledPickListListener(this);
|
132
|
4
|
fontPartsPanel.add(style, BorderLayout.EAST);
|
133
|
4
|
fontComponents.add(style);
|
134
|
|
|
135
|
|
|
136
|
4
|
EffectPanel linePanel = new EffectPanel();
|
137
|
4
|
fontComponents.add(linePanel);
|
138
|
|
|
139
|
|
|
140
|
4
|
JPanel colorPanel = new JPanel(new GridLayout(2,1,3,3));
|
141
|
4
|
colorPanel.setBorder(new TitledBorder(new EtchedBorder(
|
142
|
|
EtchedBorder.LOWERED), FrmMain.dynRes.getResourceString(FrmMain.resources, "colorLabel")));
|
143
|
4
|
ColorPanel fCol = new ColorPanel(FrmMain.dynRes.getResourceString(FrmMain.resources, "foregroundLabel"),
|
144
|
|
Color.black, CSS.Attribute.COLOR);
|
145
|
4
|
fCol.addColorPanelListener(this);
|
146
|
4
|
fontComponents.add(fCol);
|
147
|
4
|
ColorPanel bCol = new ColorPanel(FrmMain.dynRes.getResourceString(FrmMain.resources, "backgroundLabel"),
|
148
|
|
Color.white, CSS.Attribute.BACKGROUND_COLOR);
|
149
|
4
|
bCol.addColorPanelListener(this);
|
150
|
4
|
fontComponents.add(bCol);
|
151
|
4
|
colorPanel.add(fCol);
|
152
|
4
|
colorPanel.add(bCol);
|
153
|
|
|
154
|
4
|
sample.setForeground(Color.black);
|
155
|
4
|
sample.setBackground(Color.white);
|
156
|
|
|
157
|
|
|
158
|
4
|
JPanel eastPanel = new JPanel(new BorderLayout());
|
159
|
4
|
eastPanel.add(linePanel, BorderLayout.NORTH);
|
160
|
4
|
eastPanel.add(colorPanel, BorderLayout.SOUTH);
|
161
|
|
|
162
|
|
|
163
|
4
|
add(fontPartsPanel, BorderLayout.CENTER);
|
164
|
4
|
add(eastPanel, BorderLayout.EAST);
|
165
|
4
|
add(previewPanel, BorderLayout.SOUTH);
|
166
|
4
|
add(new JPanel(), BorderLayout.NORTH);
|
167
|
4
|
add(new JPanel(), BorderLayout.WEST);
|
168
|
|
}
|
169
|
|
|
170
|
|
|
171
|
|
|
172
|
|
|
173
|
|
|
174
|
|
|
175
|
|
|
176
|
2
|
public FontPanel(AttributeSet a) {
|
177
|
2
|
this();
|
178
|
|
|
179
|
|
|
180
|
2
|
setAttributes(a);
|
181
|
|
}
|
182
|
|
|
183
|
|
|
184
|
|
|
185
|
|
|
186
|
|
|
187
|
|
|
188
|
8
|
public void colorChanged(ColorPanel.ColorPanelEvent e) {
|
189
|
8
|
ColorPanel source = (ColorPanel) e.getSource();
|
190
|
8
|
if(source.getAttributeKey() == CSS.Attribute.COLOR) {
|
191
|
4
|
sample.setForeground(source.getColor());
|
192
|
|
}
|
193
|
4
|
else if(source.getAttributeKey() == CSS.Attribute.BACKGROUND_COLOR) {
|
194
|
4
|
sample.setBackground(source.getColor());
|
195
|
|
}
|
196
|
|
}
|
197
|
|
|
198
|
|
|
199
|
|
|
200
|
|
|
201
|
|
|
202
|
|
|
203
|
|
|
204
|
4
|
public void setAttributes(AttributeSet a) {
|
205
|
4
|
Enumeration components = fontComponents.elements();
|
206
|
4
|
while(components.hasMoreElements()) {
|
207
|
24
|
((AttributeComponent) components.nextElement()).setValue(a);
|
208
|
|
}
|
209
|
|
}
|
210
|
|
|
211
|
|
|
212
|
|
|
213
|
|
|
214
|
|
|
215
|
|
|
216
|
|
|
217
|
3
|
public AttributeSet getAttributes() {
|
218
|
3
|
SimpleAttributeSet attributes = new SimpleAttributeSet();
|
219
|
3
|
Enumeration components = fontComponents.elements();
|
220
|
3
|
while(components.hasMoreElements()) {
|
221
|
18
|
attributes.addAttributes(
|
222
|
|
((AttributeComponent) components.nextElement()).getValue());
|
223
|
|
}
|
224
|
3
|
return attributes;
|
225
|
|
}
|
226
|
|
|
227
|
0
|
public AttributeSet getAttributes(boolean includeUnchanged) {
|
228
|
0
|
if(includeUnchanged) {
|
229
|
0
|
SimpleAttributeSet attributes = new SimpleAttributeSet();
|
230
|
0
|
Enumeration components = fontComponents.elements();
|
231
|
0
|
while(components.hasMoreElements()) {
|
232
|
0
|
attributes.addAttributes(
|
233
|
|
((AttributeComponent) components.nextElement()).getValue(includeUnchanged));
|
234
|
|
}
|
235
|
0
|
return attributes;
|
236
|
|
}
|
237
|
|
else {
|
238
|
0
|
return getAttributes();
|
239
|
|
}
|
240
|
|
}
|
241
|
|
|
242
|
0
|
public void reset() {
|
243
|
0
|
Object c;
|
244
|
0
|
for(int i = 0; i < fontComponents.size(); i++) {
|
245
|
0
|
c = fontComponents.get(i);
|
246
|
0
|
if(c instanceof FamilyPickList) {
|
247
|
0
|
((FamilyPickList) c).reset();
|
248
|
|
}
|
249
|
0
|
else if(c instanceof SizePickList) {
|
250
|
0
|
((SizePickList) c).reset();
|
251
|
|
}
|
252
|
0
|
else if(c instanceof StylePickList) {
|
253
|
0
|
((StylePickList) c).reset();
|
254
|
|
}
|
255
|
|
}
|
256
|
|
}
|
257
|
|
|
258
|
|
|
259
|
|
|
260
|
|
|
261
|
|
|
262
|
16
|
public void valueChanged(TitledPickList.TitledPickListEvent e) {
|
263
|
16
|
Object source = e.getSource();
|
264
|
16
|
Font saveFont = sample.getFont();
|
265
|
16
|
if(source instanceof FamilyPickList) {
|
266
|
4
|
sample.setFont(new Font( ((FamilyPickList) source).getFamily(),
|
267
|
|
saveFont.getStyle(),
|
268
|
|
saveFont.getSize()));
|
269
|
|
}
|
270
|
12
|
else if(source instanceof SizePickList) {
|
271
|
8
|
sample.setFont(new Font( saveFont.getFamily(),
|
272
|
|
saveFont.getStyle(),
|
273
|
|
Integer.parseInt((String) ((SizePickList) source).getSelection())));
|
274
|
|
|
275
|
|
}
|
276
|
4
|
else if(source instanceof StylePickList) {
|
277
|
4
|
sample.setFont(new Font( saveFont.getFamily(),
|
278
|
|
((StylePickList) source).getFontStyle(),
|
279
|
|
saveFont.getSize()));
|
280
|
|
}
|
281
|
|
}
|
282
|
|
|
283
|
|
|
284
|
|
|
285
|
|
|
286
|
|
|
287
|
0
|
private int adjustFontSize(int size) {
|
288
|
0
|
return (int) (((float) size) * 1.3f);
|
289
|
|
}
|
290
|
|
|
291
|
|
|
292
|
|
|
293
|
|
|
294
|
|
|
295
|
|
class FamilyPickList extends TitledPickList implements AttributeComponent {
|
296
|
|
|
297
|
|
private int setValCount = 0;
|
298
|
|
private Object originalValue;
|
299
|
|
|
300
|
|
|
301
|
|
|
302
|
|
|
303
|
|
|
304
|
|
|
305
|
|
|
306
|
4
|
FamilyPickList(String[] options, String titleText) {
|
307
|
4
|
super(options, titleText);
|
308
|
|
}
|
309
|
|
|
310
|
|
|
311
|
|
|
312
|
|
|
313
|
|
|
314
|
|
|
315
|
|
|
316
|
|
|
317
|
|
|
318
|
|
|
319
|
4
|
public boolean setValue(AttributeSet a) {
|
320
|
4
|
boolean success = false;
|
321
|
4
|
ignoreTextChanges = true;
|
322
|
4
|
Object newSelection;
|
323
|
4
|
if(a.isDefined(CSS.Attribute.FONT_FAMILY)) {
|
324
|
3
|
newSelection = a.getAttribute(CSS.Attribute.FONT_FAMILY);
|
325
|
3
|
setSelection(a.getAttribute(CSS.Attribute.FONT_FAMILY));
|
326
|
3
|
success = true;
|
327
|
|
}
|
328
|
|
else {
|
329
|
1
|
newSelection = (Object) "SansSerif";
|
330
|
1
|
setSelection(newSelection);
|
331
|
|
}
|
332
|
4
|
ignoreTextChanges = false;
|
333
|
4
|
if(++setValCount < 2) {
|
334
|
4
|
originalValue = newSelection;
|
335
|
|
}
|
336
|
4
|
return success;
|
337
|
|
}
|
338
|
|
|
339
|
3
|
public AttributeSet getValue() {
|
340
|
3
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
341
|
3
|
Object value = getSelection();
|
342
|
|
|
343
|
|
|
344
|
3
|
if(((originalValue == null) && (value != null)) ||
|
345
|
|
((originalValue != null) && (value != null) && (!originalValue.toString().equalsIgnoreCase(value.toString()))))
|
346
|
|
{
|
347
|
0
|
Util.styleSheet().addCSSAttribute(set,
|
348
|
|
CSS.Attribute.FONT_FAMILY, value.toString());
|
349
|
|
}
|
350
|
3
|
return set;
|
351
|
|
}
|
352
|
|
|
353
|
0
|
public AttributeSet getValue(boolean includeUnchanged) {
|
354
|
0
|
if(includeUnchanged) {
|
355
|
0
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
356
|
0
|
Object value = getSelection();
|
357
|
|
|
358
|
|
|
359
|
0
|
Util.styleSheet().addCSSAttribute(set,
|
360
|
|
CSS.Attribute.FONT_FAMILY, value.toString());
|
361
|
0
|
return set;
|
362
|
|
}
|
363
|
|
else {
|
364
|
0
|
return getValue();
|
365
|
|
}
|
366
|
|
}
|
367
|
|
|
368
|
4
|
public String getFamily() {
|
369
|
4
|
return (String) getSelection();
|
370
|
|
}
|
371
|
|
|
372
|
0
|
public void reset() {
|
373
|
0
|
setValCount = 0;
|
374
|
0
|
originalValue = null;
|
375
|
|
}
|
376
|
|
}
|
377
|
|
|
378
|
|
|
379
|
|
|
380
|
|
|
381
|
|
|
382
|
|
class SizePickList extends TitledPickList implements AttributeComponent {
|
383
|
|
|
384
|
|
private Object key;
|
385
|
|
private int setValCount = 0;
|
386
|
|
private String originalValue;
|
387
|
|
|
388
|
|
|
389
|
|
|
390
|
|
|
391
|
|
|
392
|
|
|
393
|
|
|
394
|
4
|
SizePickList(String[] options, String titleText, Object key) {
|
395
|
4
|
super(options, titleText);
|
396
|
4
|
this.key = key;
|
397
|
|
}
|
398
|
|
|
399
|
|
|
400
|
|
|
401
|
|
|
402
|
|
|
403
|
|
|
404
|
|
|
405
|
|
|
406
|
|
|
407
|
|
|
408
|
4
|
public boolean setValue(AttributeSet a) {
|
409
|
4
|
ignoreTextChanges = true;
|
410
|
4
|
boolean success = false;
|
411
|
4
|
Object attr = a.getAttribute(key);
|
412
|
4
|
String newSelection;
|
413
|
4
|
if(attr != null) {
|
414
|
|
|
415
|
|
|
416
|
3
|
int val = (int) Util.getAttrValue(a.getAttribute(key));
|
417
|
3
|
if(val > 0) {
|
418
|
3
|
success = true;
|
419
|
3
|
newSelection = new Integer(val).toString();
|
420
|
3
|
setSelection(newSelection);
|
421
|
|
}
|
422
|
|
else {
|
423
|
0
|
newSelection = "12";
|
424
|
0
|
setSelection(newSelection);
|
425
|
|
}
|
426
|
|
}
|
427
|
|
else {
|
428
|
1
|
newSelection = "12";
|
429
|
1
|
setSelection(newSelection);
|
430
|
|
}
|
431
|
4
|
ignoreTextChanges = false;
|
432
|
4
|
if(++setValCount < 2) {
|
433
|
4
|
originalValue = newSelection;
|
434
|
|
}
|
435
|
4
|
return success;
|
436
|
|
}
|
437
|
|
|
438
|
3
|
public AttributeSet getValue() {
|
439
|
3
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
440
|
3
|
String value = (String) getSelection();
|
441
|
3
|
if(((originalValue == null) && (value != null)) ||
|
442
|
|
((originalValue != null) && (!originalValue.equalsIgnoreCase(value)))) {
|
443
|
2
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_SIZE,
|
444
|
|
(String) getSelection() );
|
445
|
|
}
|
446
|
3
|
return set;
|
447
|
|
}
|
448
|
|
|
449
|
0
|
public AttributeSet getValue(boolean includeUnchanged) {
|
450
|
0
|
if(includeUnchanged) {
|
451
|
0
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
452
|
0
|
String value = (String) getSelection();
|
453
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_SIZE,
|
454
|
|
(String) getSelection() );
|
455
|
0
|
return set;
|
456
|
|
}
|
457
|
|
else {
|
458
|
0
|
return getValue();
|
459
|
|
}
|
460
|
|
}
|
461
|
|
|
462
|
0
|
public void reset() {
|
463
|
0
|
setValCount = 0;
|
464
|
0
|
originalValue = null;
|
465
|
|
}
|
466
|
|
}
|
467
|
|
|
468
|
|
|
469
|
|
|
470
|
|
|
471
|
|
|
472
|
|
class StylePickList extends TitledPickList implements AttributeComponent {
|
473
|
|
|
474
|
|
private int originalValue;
|
475
|
|
private int setValCount = 0;
|
476
|
|
|
477
|
|
|
478
|
|
|
479
|
|
|
480
|
|
|
481
|
|
|
482
|
|
|
483
|
4
|
StylePickList(String[] options, String titleText) {
|
484
|
4
|
super(options, titleText);
|
485
|
|
}
|
486
|
|
|
487
|
|
|
488
|
|
|
489
|
|
|
490
|
|
|
491
|
|
|
492
|
|
|
493
|
|
|
494
|
|
|
495
|
|
|
496
|
4
|
public boolean setValue(AttributeSet a) {
|
497
|
4
|
ignoreTextChanges = true;
|
498
|
4
|
boolean success = false;
|
499
|
4
|
int styleNo = 0;
|
500
|
4
|
String value;
|
501
|
4
|
if(a.isDefined(CSS.Attribute.FONT_WEIGHT)) {
|
502
|
3
|
value = a.getAttribute(CSS.Attribute.FONT_WEIGHT).toString();
|
503
|
3
|
if(value.equalsIgnoreCase(StyleConstants.Bold.toString())) {
|
504
|
0
|
styleNo++;
|
505
|
|
}
|
506
|
|
}
|
507
|
4
|
if(a.isDefined(CSS.Attribute.FONT_STYLE)) {
|
508
|
0
|
value = a.getAttribute(CSS.Attribute.FONT_STYLE).toString();
|
509
|
0
|
if(value.equalsIgnoreCase(StyleConstants.Italic.toString())) {
|
510
|
0
|
styleNo += 2;
|
511
|
|
}
|
512
|
|
}
|
513
|
4
|
setSelection(styleNo);
|
514
|
4
|
if(++setValCount < 2) {
|
515
|
4
|
originalValue = styleNo;
|
516
|
|
}
|
517
|
4
|
ignoreTextChanges = false;
|
518
|
4
|
return success;
|
519
|
|
}
|
520
|
|
|
521
|
3
|
public AttributeSet getValue() {
|
522
|
3
|
String value = Util.CSS_ATTRIBUTE_NORMAL;
|
523
|
3
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
524
|
3
|
int styleNo = getIndex();
|
525
|
3
|
switch(styleNo) {
|
526
|
3
|
case 0:
|
527
|
3
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_STYLE, value);
|
528
|
3
|
break;
|
529
|
0
|
case 1:
|
530
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_WEIGHT,
|
531
|
|
StyleConstants.Bold.toString());
|
532
|
0
|
break;
|
533
|
0
|
case 2:
|
534
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_STYLE,
|
535
|
|
StyleConstants.Italic.toString());
|
536
|
0
|
break;
|
537
|
0
|
case 3:
|
538
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_WEIGHT,
|
539
|
|
StyleConstants.Bold.toString());
|
540
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_STYLE,
|
541
|
|
StyleConstants.Italic.toString());
|
542
|
0
|
break;
|
543
|
|
}
|
544
|
3
|
return set;
|
545
|
|
}
|
546
|
|
|
547
|
0
|
public AttributeSet getValue(boolean includeUnchanged) {
|
548
|
0
|
if(includeUnchanged) {
|
549
|
0
|
String value = Util.CSS_ATTRIBUTE_NORMAL;
|
550
|
0
|
SimpleAttributeSet set = new SimpleAttributeSet();
|
551
|
0
|
int styleNo = getIndex();
|
552
|
0
|
switch(styleNo) {
|
553
|
0
|
case 0:
|
554
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_STYLE, value);
|
555
|
0
|
break;
|
556
|
0
|
case 1:
|
557
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_WEIGHT,
|
558
|
|
StyleConstants.Bold.toString());
|
559
|
0
|
break;
|
560
|
0
|
case 2:
|
561
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_STYLE,
|
562
|
|
StyleConstants.Italic.toString());
|
563
|
0
|
break;
|
564
|
0
|
case 3:
|
565
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_WEIGHT,
|
566
|
|
StyleConstants.Bold.toString());
|
567
|
0
|
Util.styleSheet().addCSSAttribute(set, CSS.Attribute.FONT_STYLE,
|
568
|
|
StyleConstants.Italic.toString());
|
569
|
0
|
break;
|
570
|
|
}
|
571
|
0
|
return set;
|
572
|
|
}
|
573
|
|
else {
|
574
|
0
|
return getValue();
|
575
|
|
}
|
576
|
|
}
|
577
|
|
|
578
|
4
|
public int getFontStyle() {
|
579
|
4
|
int fontStyle = 0;
|
580
|
4
|
switch(getIndex()) {
|
581
|
4
|
case 0:
|
582
|
4
|
fontStyle = Font.PLAIN;
|
583
|
4
|
break;
|
584
|
0
|
case 1:
|
585
|
0
|
fontStyle = Font.BOLD;
|
586
|
0
|
break;
|
587
|
0
|
case 2:
|
588
|
0
|
fontStyle = Font.ITALIC;
|
589
|
0
|
break;
|
590
|
0
|
case 3:
|
591
|
0
|
fontStyle = Font.BOLD | Font.ITALIC;
|
592
|
0
|
break;
|
593
|
|
}
|
594
|
4
|
return fontStyle;
|
595
|
|
}
|
596
|
|
|
597
|
0
|
public void reset() {
|
598
|
0
|
setValCount = 0;
|
599
|
0
|
originalValue = -2;
|
600
|
|
}
|
601
|
|
}
|
602
|
|
}
|