Mercurial > projects > dwt-addons
comparison dwtx/ui/internal/forms/widgets/Paragraph.d @ 104:04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 15:01:33 +0200 |
parents | 1088ca33d3e0 |
children |
comparison
equal
deleted
inserted
replaced
103:2d6540440fe6 | 104:04b47443bb01 |
---|---|
22 import dwt.graphics.GC; | 22 import dwt.graphics.GC; |
23 import dwt.graphics.Rectangle; | 23 import dwt.graphics.Rectangle; |
24 import dwtx.ui.forms.HyperlinkSettings; | 24 import dwtx.ui.forms.HyperlinkSettings; |
25 | 25 |
26 import dwt.dwthelper.utils; | 26 import dwt.dwthelper.utils; |
27 import tango.util.collection.ArraySeq; | 27 import dwtx.dwtxhelper.Collection; |
28 import tango.util.collection.HashMap; | |
29 import tango.io.model.IFile; | 28 import tango.io.model.IFile; |
30 | 29 |
31 import tango.text.Text; | 30 import tango.text.Text; |
32 | 31 |
33 /** | 32 /** |
35 * @author | 34 * @author |
36 */ | 35 */ |
37 public class Paragraph { | 36 public class Paragraph { |
38 public static const String HTTP = "http://"; //$NON-NLS-1$ | 37 public static const String HTTP = "http://"; //$NON-NLS-1$ |
39 | 38 |
40 alias ArraySeq!(ParagraphSegment) TArraySeqParagraphSegment; | 39 private Vector segments; |
41 alias HashMap!(String,Object) Hashtable; | |
42 | |
43 private TArraySeqParagraphSegment segments; | |
44 | 40 |
45 private bool addVerticalSpace = true; | 41 private bool addVerticalSpace = true; |
46 | 42 |
47 public this(bool addVerticalSpace) { | 43 public this(bool addVerticalSpace) { |
48 this.addVerticalSpace = addVerticalSpace; | 44 this.addVerticalSpace = addVerticalSpace; |
60 * @see IParagraph#getSegments() | 56 * @see IParagraph#getSegments() |
61 */ | 57 */ |
62 public ParagraphSegment[] getSegments() { | 58 public ParagraphSegment[] getSegments() { |
63 if (segments is null) | 59 if (segments is null) |
64 return null; | 60 return null; |
65 return segments | 61 return arraycast!(ParagraphSegment)(segments |
66 .toArray(); | 62 .toArray()); |
67 } | 63 } |
68 | 64 |
69 public void addSegment(ParagraphSegment segment) { | 65 public void addSegment(ParagraphSegment segment) { |
70 if (segments is null) | 66 if (segments is null) |
71 segments = new TArraySeqParagraphSegment; | 67 segments = new Vector; |
72 segments.append(segment); | 68 segments.add(segment); |
73 } | 69 } |
74 | 70 |
75 public void parseRegularText(String text, bool expandURLs, bool wrapAllowed, | 71 public void parseRegularText(String text, bool expandURLs, bool wrapAllowed, |
76 HyperlinkSettings settings, String fontId) { | 72 HyperlinkSettings settings, String fontId) { |
77 parseRegularText(text, expandURLs, wrapAllowed, settings, fontId, null); | 73 parseRegularText(text, expandURLs, wrapAllowed, settings, fontId, null); |
131 protected void computeRowHeights(GC gc, int width, Locator loc, | 127 protected void computeRowHeights(GC gc, int width, Locator loc, |
132 int lineHeight, Hashtable resourceTable) { | 128 int lineHeight, Hashtable resourceTable) { |
133 ParagraphSegment[] segments = getSegments(); | 129 ParagraphSegment[] segments = getSegments(); |
134 // compute heights | 130 // compute heights |
135 Locator hloc = loc.create(); | 131 Locator hloc = loc.create(); |
136 ArraySeq!(ArrayWrapperInt) heights = new ArraySeq!(ArrayWrapperInt); | 132 ArrayList heights = new ArrayList(); |
137 hloc.heights = heights; | 133 hloc.heights = heights; |
138 hloc.rowCounter = 0; | 134 hloc.rowCounter = 0; |
139 int innerWidth = width - loc.marginWidth*2; | 135 int innerWidth = width - loc.marginWidth*2; |
140 for (int j = 0; j < segments.length; j++) { | 136 for (int j = 0; j < segments.length; j++) { |
141 ParagraphSegment segment = segments[j]; | 137 ParagraphSegment segment = segments[j]; |