comparison dwtx/jface/wizard/Wizard.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 ef4534de0cf9
children
comparison
equal deleted inserted replaced
103:2d6540440fe6 104:04b47443bb01
14 14
15 import dwtx.jface.wizard.IWizard; 15 import dwtx.jface.wizard.IWizard;
16 import dwtx.jface.wizard.IWizardPage; 16 import dwtx.jface.wizard.IWizardPage;
17 import dwtx.jface.wizard.IWizardContainer; 17 import dwtx.jface.wizard.IWizardContainer;
18 18
19 import tango.util.collection.ArraySeq;
20 19
21 import dwt.graphics.Image; 20 import dwt.graphics.Image;
22 import dwt.graphics.RGB; 21 import dwt.graphics.RGB;
23 import dwt.widgets.Composite; 22 import dwt.widgets.Composite;
24 import dwt.widgets.Shell; 23 import dwt.widgets.Shell;
26 import dwtx.jface.dialogs.IDialogSettings; 25 import dwtx.jface.dialogs.IDialogSettings;
27 import dwtx.jface.resource.ImageDescriptor; 26 import dwtx.jface.resource.ImageDescriptor;
28 import dwtx.jface.resource.JFaceResources; 27 import dwtx.jface.resource.JFaceResources;
29 28
30 import dwt.dwthelper.utils; 29 import dwt.dwthelper.utils;
30 import dwtx.dwtxhelper.Collection;
31 31
32 /** 32 /**
33 * An abstract base implementation of a wizard. A typical client subclasses 33 * An abstract base implementation of a wizard. A typical client subclasses
34 * <code>Wizard</code> to implement a particular wizard. 34 * <code>Wizard</code> to implement a particular wizard.
35 * <p> 35 * <p>
74 private IWizardContainer container = null; 74 private IWizardContainer container = null;
75 75
76 /** 76 /**
77 * This wizard's list of pages (element type: <code>IWizardPage</code>). 77 * This wizard's list of pages (element type: <code>IWizardPage</code>).
78 */ 78 */
79 private ArraySeq!(Object) pages; 79 private List pages;
80 80
81 /** 81 /**
82 * Indicates whether this wizard needs a progress monitor. 82 * Indicates whether this wizard needs a progress monitor.
83 */ 83 */
84 private bool needsProgressMonitor_ = false; 84 private bool needsProgressMonitor_ = false;
124 /** 124 /**
125 * Creates a new empty wizard. 125 * Creates a new empty wizard.
126 */ 126 */
127 protected this() { 127 protected this() {
128 //super(); 128 //super();
129 pages = new ArraySeq!(Object); 129 pages = new ArrayList();
130 defaultImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE); 130 defaultImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE);
131 } 131 }
132 132
133 /** 133 /**
134 * Adds a new page to this wizard. The page is inserted at the end of the 134 * Adds a new page to this wizard. The page is inserted at the end of the
136 * 136 *
137 * @param page 137 * @param page
138 * the new page 138 * the new page
139 */ 139 */
140 public void addPage(IWizardPage page) { 140 public void addPage(IWizardPage page) {
141 pages.append(cast(Object)page); 141 pages.add(cast(Object)page);
142 page.setWizard(this); 142 page.setWizard(this);
143 } 143 }
144 144
145 /** 145 /**
146 * The <code>Wizard</code> implementation of this <code>IWizard</code> 146 * The <code>Wizard</code> implementation of this <code>IWizard</code>
230 /* 230 /*
231 * (non-Javadoc) Method declared on IWizard. The default behavior is to 231 * (non-Javadoc) Method declared on IWizard. The default behavior is to
232 * return the page that was added to this wizard after the given page. 232 * return the page that was added to this wizard after the given page.
233 */ 233 */
234 public IWizardPage getNextPage(IWizardPage page) { 234 public IWizardPage getNextPage(IWizardPage page) {
235 int index = seqIndexOf(pages,cast(Object)page ); 235 int index = pages.indexOf( cast(Object)page );
236 if (index is pages.size() - 1 || index is -1) { 236 if (index is pages.size() - 1 || index is -1) {
237 // last page or page not found 237 // last page or page not found
238 return null; 238 return null;
239 } 239 }
240 return cast(IWizardPage) pages.get(index + 1); 240 return cast(IWizardPage) pages.get(index + 1);
271 /* 271 /*
272 * (non-Javadoc) Method declared on IWizard. The default behavior is to 272 * (non-Javadoc) Method declared on IWizard. The default behavior is to
273 * return the page that was added to this wizard before the given page. 273 * return the page that was added to this wizard before the given page.
274 */ 274 */
275 public IWizardPage getPreviousPage(IWizardPage page) { 275 public IWizardPage getPreviousPage(IWizardPage page) {
276 int index = seqIndexOf(pages,cast(Object)page); 276 int index = pages.indexOf(cast(Object)page);
277 if (index is 0 || index is -1) { 277 if (index is 0 || index is -1) {
278 // first page or page not found 278 // first page or page not found
279 return null; 279 return null;
280 } 280 }
281 return cast(IWizardPage) pages.get(index - 1); 281 return cast(IWizardPage) pages.get(index - 1);