diff dwtx/jface/wizard/Wizard.d @ 35:ef4534de0cf9

remaining files
author Frank Benoit <benoit@tionex.de>
date Sat, 05 Apr 2008 04:49:22 +0200
parents 6c14e54dfc11
children 04b47443bb01
line wrap: on
line diff
--- a/dwtx/jface/wizard/Wizard.d	Sat Apr 05 01:45:47 2008 +0200
+++ b/dwtx/jface/wizard/Wizard.d	Sat Apr 05 04:49:22 2008 +0200
@@ -12,14 +12,11 @@
  *******************************************************************************/
 module dwtx.jface.wizard.Wizard;
 
-import dwt.dwthelper.utils;
-pragma( msg, "FIXME dwtx.jface.wizard.Wizard");
-class Wizard {
-    public static final String DEFAULT_IMAGE = "dwtx.jface.wizard.Wizard.pageImage";//$NON-NLS-1$
-}
-/++
-import java.util.ArrayList;
-import java.util.List;
+import dwtx.jface.wizard.IWizard;
+import dwtx.jface.wizard.IWizardPage;
+import dwtx.jface.wizard.IWizardContainer;
+
+import tango.util.collection.ArraySeq;
 
 import dwt.graphics.Image;
 import dwt.graphics.RGB;
@@ -30,6 +27,8 @@
 import dwtx.jface.resource.ImageDescriptor;
 import dwtx.jface.resource.JFaceResources;
 
+import dwt.dwthelper.utils;
+
 /**
  * An abstract base implementation of a wizard. A typical client subclasses
  * <code>Wizard</code> to implement a particular wizard.
@@ -62,7 +61,7 @@
  * <code>IWizardPage</code>.
  * </p>
  */
-public abstract class Wizard implements IWizard {
+public abstract class Wizard : IWizard {
     /**
      * Image registry key of the default image for wizard pages (value
      * <code>"dwtx.jface.wizard.Wizard.pageImage"</code>).
@@ -77,12 +76,12 @@
     /**
      * This wizard's list of pages (element type: <code>IWizardPage</code>).
      */
-    private List pages = new ArrayList();
+    private ArraySeq!(Object) pages;
 
     /**
      * Indicates whether this wizard needs a progress monitor.
      */
-    private bool needsProgressMonitor = false;
+    private bool needsProgressMonitor_ = false;
 
     /**
      * Indicates whether this wizard needs previous and next buttons even if the
@@ -93,7 +92,7 @@
     /**
      * Indicates whether this wizard supports help.
      */
-    private bool isHelpAvailable = false;
+    private bool isHelpAvailable_ = false;
 
     /**
      * The default page image for pages without one of their one;
@@ -105,7 +104,7 @@
      * The default page image descriptor, used for creating a default page image
      * if required; <code>null</code> if none.
      */
-    private ImageDescriptor defaultImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE);
+    private ImageDescriptor defaultImageDescriptor;
 
     /**
      * The color of the wizard title bar; <code>null</code> if none.
@@ -125,8 +124,10 @@
     /**
      * Creates a new empty wizard.
      */
-    protected Wizard() {
-        super();
+    protected this() {
+        //super();
+        pages = new ArraySeq!(Object);
+        defaultImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE);
     }
 
     /**
@@ -137,7 +138,7 @@
      *            the new page
      */
     public void addPage(IWizardPage page) {
-        pages.add(page);
+        pages.append(cast(Object)page);
         page.setWizard(this);
     }
 
@@ -156,7 +157,7 @@
     public bool canFinish() {
         // Default implementation is to check if all pages are complete.
         for (int i = 0; i < pages.size(); i++) {
-            if (!((IWizardPage) pages.get(i)).isPageComplete()) {
+            if (!(cast(IWizardPage) pages.get(i)).isPageComplete()) {
                 return false;
             }
         }
@@ -174,7 +175,7 @@
     public void createPageControls(Composite pageContainer) {
         // the default behavior is to create all the pages controls
         for (int i = 0; i < pages.size(); i++) {
-            IWizardPage page = (IWizardPage) pages.get(i);
+            IWizardPage page = cast(IWizardPage) pages.get(i);
             page.createControl(pageContainer);
             // page is responsible for ensuring the created control is
             // accessable
@@ -193,7 +194,7 @@
     public void dispose() {
         // notify pages
         for (int i = 0; i < pages.size(); i++) {
-            ((IWizardPage) pages.get(i)).dispose();
+            (cast(IWizardPage) pages.get(i)).dispose();
         }
         // dispose of image
         if (defaultImage !is null) {
@@ -231,12 +232,12 @@
      * return the page that was added to this wizard after the given page.
      */
     public IWizardPage getNextPage(IWizardPage page) {
-        int index = pages.indexOf(page);
+        int index = seqIndexOf(pages,cast(Object)page );
         if (index is pages.size() - 1 || index is -1) {
             // last page or page not found
             return null;
         }
-        return (IWizardPage) pages.get(index + 1);
+        return cast(IWizardPage) pages.get(index + 1);
     }
 
     /*
@@ -244,7 +245,7 @@
      */
     public IWizardPage getPage(String name) {
         for (int i = 0; i < pages.size(); i++) {
-            IWizardPage page = (IWizardPage) pages.get(i);
+            IWizardPage page = cast(IWizardPage) pages.get(i);
             String pageName = page.getName();
             if (pageName.equals(name)) {
                 return page;
@@ -264,7 +265,7 @@
      * (non-Javadoc) Method declared on IWizard.
      */
     public IWizardPage[] getPages() {
-        return (IWizardPage[]) pages.toArray(new IWizardPage[pages.size()]);
+        return arraycast!(IWizardPage)( pages.toArray());
     }
 
     /*
@@ -272,12 +273,12 @@
      * return the page that was added to this wizard before the given page.
      */
     public IWizardPage getPreviousPage(IWizardPage page) {
-        int index = pages.indexOf(page);
+        int index = seqIndexOf(pages,cast(Object)page);
         if (index is 0 || index is -1) {
             // first page or page not found
             return null;
         }
-        return (IWizardPage) pages.get(index - 1);
+        return cast(IWizardPage) pages.get(index - 1);
     }
 
     /**
@@ -301,7 +302,7 @@
         if (pages.size() is 0) {
             return null;
         }
-        return (IWizardPage) pages.get(0);
+        return cast(IWizardPage) pages.get(0);
     }
 
     /*
@@ -322,7 +323,7 @@
      * (non-Javadoc) Method declared on IWizard.
      */
     public bool isHelpAvailable() {
-        return isHelpAvailable;
+        return isHelpAvailable_;
     }
 
     /*
@@ -336,7 +337,7 @@
      * (non-Javadoc) Method declared on IWizard.
      */
     public bool needsProgressMonitor() {
-        return needsProgressMonitor;
+        return needsProgressMonitor_;
     }
 
     /**
@@ -422,7 +423,7 @@
      * @see #isHelpAvailable()
      */
     public void setHelpAvailable(bool b) {
-        isHelpAvailable = b;
+        isHelpAvailable_ = b;
     }
 
     /**
@@ -434,7 +435,7 @@
      * @see #needsProgressMonitor()
      */
     public void setNeedsProgressMonitor(bool b) {
-        needsProgressMonitor = b;
+        needsProgressMonitor_ = b;
     }
 
     /**
@@ -461,4 +462,3 @@
         }
     }
 }
-++/
\ No newline at end of file