Mercurial > projects > dwt-addons
diff dwtx/ui/internal/forms/widgets/FormTextModel.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 | 7ffeace6c47f |
children | 0ea0c9f9008f |
line wrap: on
line diff
--- a/dwtx/ui/internal/forms/widgets/FormTextModel.d Sun Aug 03 17:01:51 2008 +0200 +++ b/dwtx/ui/internal/forms/widgets/FormTextModel.d Thu Aug 07 15:01:33 2008 +0200 @@ -26,11 +26,11 @@ import dwt.dwthelper.utils; import dwt.dwthelper.InputStream; +import dwtx.dwtxhelper.Collection; static import tango.text.xml.Document; static import tango.io.Buffer; -import tango.util.collection.ArraySeq; public class FormTextModel { // private static const DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory // .newInstance(); @@ -40,8 +40,7 @@ private bool whitespaceNormalized = true; - private alias ArraySeq!(Paragraph) TArraySeqParagraph; - private TArraySeqParagraph paragraphs; + private Vector paragraphs; private IFocusSelectable[] selectableSegments; @@ -69,8 +68,8 @@ public Paragraph[] getParagraphs() { if (paragraphs is null) return new Paragraph[0]; - return paragraphs - .toArray(); + return arraycast!(Paragraph)(paragraphs + .toArray()); } public String getAccessibleText() { @@ -143,7 +142,7 @@ // processSubnodes(paragraphs, children, expandURLs); // } -/+ private void processSubnodes(TArraySeqParagraph plist, NodeList children, bool expandURLs) { +/+ private void processSubnodes(Vector plist, NodeList children, bool expandURLs) { //o for (int i = 0; i < children.getLength(); i++) { //o Node child = children.item(i); foreach( child; children ){ @@ -544,14 +543,14 @@ regularText = getNormalizedText(regularText); Paragraph p = new Paragraph(true); - paragraphs.append(p); + paragraphs.add(p); int pstart = 0; for (int i = 0; i < regularText.length; i++) { char c = regularText.charAt(i); if (p is null) { p = new Paragraph(true); - paragraphs.append(p); + paragraphs.add(p); } if (c is '\n') { String text = regularText.substring(pstart, i); @@ -581,7 +580,7 @@ private void reset() { if (paragraphs is null) - paragraphs = new TArraySeqParagraph; + paragraphs = new Vector; paragraphs.clear(); selectedSegmentIndex = -1; savedSelectedLinkIndex = -1; @@ -591,16 +590,16 @@ IFocusSelectable[] getFocusSelectableSegments() { if (selectableSegments !is null || paragraphs is null) return selectableSegments; - IFocusSelectable[] result; + Vector result = new Vector(); for (int i = 0; i < paragraphs.size(); i++) { Paragraph p = cast(Paragraph) paragraphs.get(i); ParagraphSegment[] segments = p.getSegments(); for (int j = 0; j < segments.length; j++) { if (null !is cast(IFocusSelectable)segments[j] ) - result ~= cast(IFocusSelectable)segments[j]; + result.add(segments[j]); } } - selectableSegments = result; + selectableSegments = arraycast!(IFocusSelectable)(result.toArray()); return selectableSegments; }