equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 |
26 |
27 import java.util.ArrayList; |
27 import java.util.ArrayList; |
28 |
28 |
29 /** |
29 /** |
30 * CharacterIteratorFieldDelegate combines the notifications from a Format |
30 * CharacterIteratorFieldDelegate combines the notifications from a Format |
31 * into a resulting <code>AttributedCharacterIterator</code>. The resulting |
31 * into a resulting {@code AttributedCharacterIterator}. The resulting |
32 * <code>AttributedCharacterIterator</code> can be retrieved by way of |
32 * {@code AttributedCharacterIterator} can be retrieved by way of |
33 * the <code>getIterator</code> method. |
33 * the {@code getIterator} method. |
34 * |
34 * |
35 */ |
35 */ |
36 class CharacterIteratorFieldDelegate implements Format.FieldDelegate { |
36 class CharacterIteratorFieldDelegate implements Format.FieldDelegate { |
37 /** |
37 /** |
38 * Array of AttributeStrings. Whenever <code>formatted</code> is invoked |
38 * Array of AttributeStrings. Whenever {@code formatted} is invoked |
39 * for a region > size, a new instance of AttributedString is added to |
39 * for a region > size, a new instance of AttributedString is added to |
40 * attributedStrings. Subsequent invocations of <code>formatted</code> |
40 * attributedStrings. Subsequent invocations of {@code formatted} |
41 * for existing regions result in invoking addAttribute on the existing |
41 * for existing regions result in invoking addAttribute on the existing |
42 * AttributedStrings. |
42 * AttributedStrings. |
43 */ |
43 */ |
44 private ArrayList<AttributedString> attributedStrings; |
44 private ArrayList<AttributedString> attributedStrings; |
45 /** |
45 /** |
96 int start, int end, StringBuffer buffer) { |
96 int start, int end, StringBuffer buffer) { |
97 formatted(attr, value, start, end, buffer); |
97 formatted(attr, value, start, end, buffer); |
98 } |
98 } |
99 |
99 |
100 /** |
100 /** |
101 * Returns an <code>AttributedCharacterIterator</code> that can be used |
101 * Returns an {@code AttributedCharacterIterator} that can be used |
102 * to iterate over the resulting formatted String. |
102 * to iterate over the resulting formatted String. |
103 * |
103 * |
104 * @pararm string Result of formatting. |
104 * @pararm string Result of formatting. |
105 */ |
105 */ |
106 public AttributedCharacterIterator getIterator(String string) { |
106 public AttributedCharacterIterator getIterator(String string) { |