home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / WizardModelIntro.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  4.1 KB  |  95 lines

  1. package asp.wizard;
  2.  
  3. import asp.netobjects.nfx.util.ExceptionHandler;
  4. import asp.netobjects.nfx.util.ExternalError;
  5. import asp.netobjects.nfx.util.InternalError;
  6. import asp.netobjects.nfx.wizard.Wizard;
  7. import asp.netobjects.nfx.wizard.WizardPage;
  8. import asp.netobjects.nfx.wizard.WizardPageView;
  9. import asp.util.ResourceUtil;
  10. import asp.wizard.def.DefPage;
  11. import com.sun.java.swing.ImageIcon;
  12. import java.net.URL;
  13.  
  14. public class WizardModelIntro extends WizardModelAbstract {
  15.    private int _currentTemplateId = 0;
  16.    // $FF: synthetic field
  17.    static Class class$asp$wizard$WVPanelIntro;
  18.  
  19.    public WizardModelIntro(Wizard wizard, String bullet, String info, ImageIcon icon, ExceptionHandler handler) {
  20.       super(wizard, bullet, info, icon, handler);
  21.       this.initImgLeft();
  22.    }
  23.  
  24.    private void initImgLeft() {
  25.       String imgFile = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelIntro != null ? class$asp$wizard$WVPanelIntro : (class$asp$wizard$WVPanelIntro = class$("asp.wizard.WVPanelIntro")), "image.pageimage");
  26.       if (imgFile != null && !imgFile.equals("")) {
  27.          URL url = this.getClass().getResource("image/" + imgFile);
  28.          if (url != null) {
  29.             super.dmIcon = new ImageIcon(url);
  30.          }
  31.       } else {
  32.          super.dmIcon = null;
  33.       }
  34.  
  35.    }
  36.  
  37.    public boolean isValid() {
  38.       return true;
  39.    }
  40.  
  41.    protected WizardPageView getViewSingleInstance() {
  42.       return WizardViewIntro.getInstance();
  43.    }
  44.  
  45.    private int getSeqTemplateId() {
  46.       WizardViewIntro wv = (WizardViewIntro)((WizardPage)this).getView();
  47.       return wv.getSeqTemplateId();
  48.    }
  49.  
  50.    public WizardPage getNext() throws InternalError, ExternalError {
  51.       WizardPage next = super.getNext();
  52.       WizardManager wm = ((WizardModelAbstract)this).getWizardManager();
  53.       int nextSeqTemplateId = this.getSeqTemplateId();
  54.       DefPage firstPage = null;
  55.       if (next != null && ((WizardModelAbstract)next).getTemplateId() != nextSeqTemplateId) {
  56.          wm.removeSequence(next);
  57.          next = null;
  58.       }
  59.  
  60.       if (next == null) {
  61.          firstPage = wm.createDefPage(this, nextSeqTemplateId);
  62.          wm.addSequence(this, this, firstPage, this.getSeqTemplateId(), (DefPage)null);
  63.          wm.setFirstDefPage(firstPage);
  64.          wm.updateNextDefPageId(this, nextSeqTemplateId);
  65.          next = super.getNext();
  66.       }
  67.  
  68.       return next;
  69.    }
  70.  
  71.    public void validate() throws InternalError, ExternalError {
  72.       super.validate();
  73.       if (this.getSeqTemplateId() == -1) {
  74.          throw new ExternalError("Please specify your choice");
  75.       }
  76.    }
  77.  
  78.    public void commit() throws InternalError, ExternalError {
  79.       this._currentTemplateId = this.getSeqTemplateId();
  80.    }
  81.  
  82.    public void loadView() {
  83.       ((WizardViewIntro)((WizardPage)this).getView()).setSeqTemplateId(this._currentTemplateId);
  84.    }
  85.  
  86.    // $FF: synthetic method
  87.    static Class class$(String class$) {
  88.       try {
  89.          return Class.forName(class$);
  90.       } catch (ClassNotFoundException forName) {
  91.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  92.       }
  93.    }
  94. }
  95.