home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 183 / dpcs0503.iso / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / WizardViewFinish.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  4.9 KB  |  122 lines

  1. package asp.wizard;
  2.  
  3. import asp.netobjects.nfx.wizard.WizardPage;
  4. import asp.util.ResourceUtil;
  5. import asp.wizard.def.DefAbstract;
  6. import asp.wizard.def.DefCollection;
  7. import asp.wizard.def.DefPage;
  8. import java.util.Enumeration;
  9.  
  10. public class WizardViewFinish extends WizardViewAbstract {
  11.    private static WizardViewAbstract _instance = null;
  12.    private static WVPanelFinish _mainPanel = null;
  13.    private static final String ID_LBL_CREATE_PREFIX = "label.createprefix";
  14.    private static final String ID_LBL_CREATE_SUFFIX = "label.createsuffix";
  15.    // $FF: synthetic field
  16.    static Class class$asp$wizard$WVPanelFinish;
  17.    // $FF: synthetic field
  18.    static Class class$asp$wizard$def$DefDynaField;
  19.  
  20.    public static WizardViewAbstract getInstance() {
  21.       if (_instance == null) {
  22.          _instance = new WizardViewFinish();
  23.       }
  24.  
  25.       return _instance;
  26.    }
  27.  
  28.    protected void createMainPanel() {
  29.       _mainPanel = new WVPanelFinish();
  30.    }
  31.  
  32.    public WVPanelBase getMainPanel() {
  33.       return _mainPanel;
  34.    }
  35.  
  36.    public void setModel(WizardPage model) {
  37.       super.setModel(model);
  38.       DefPage defPage = ((WizardModelAbstract)model).getWizardManager().getFirstDefPage();
  39.       _mainPanel._txaReport.setText(this.getMainText(defPage));
  40.    }
  41.  
  42.    public String getMainText(DefPage defPage) {
  43.       String result = "";
  44.       result = result + this.getPageText(defPage) + "\n";
  45.       result = result + this.getChildText(defPage) + "\n";
  46.       return result;
  47.    }
  48.  
  49.    public String getChildText(DefPage defPage) {
  50.       String result = "";
  51.       DefCollection defCollection = defPage.getChildPages();
  52.  
  53.       for(Enumeration e = defCollection.getElements(); e.hasMoreElements(); result = result + this.getChildText(defPage)) {
  54.          defPage = (DefPage)e.nextElement();
  55.          result = result + this.getPageText(defPage) + "\n";
  56.       }
  57.  
  58.       return result;
  59.    }
  60.  
  61.    public String getPageText(DefPage defPage) {
  62.       String sCreatePrefix = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelFinish != null ? class$asp$wizard$WVPanelFinish : (class$asp$wizard$WVPanelFinish = class$("asp.wizard.WVPanelFinish")), "label.createprefix");
  63.       String sCreateSuffix = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelFinish != null ? class$asp$wizard$WVPanelFinish : (class$asp$wizard$WVPanelFinish = class$("asp.wizard.WVPanelFinish")), "label.createsuffix");
  64.       String result = "";
  65.       result = "\n" + sCreatePrefix + " " + ((DefAbstract)defPage).getName() + " " + sCreateSuffix + "\n";
  66.       Enumeration e = ((DefCollection)defPage).getElements();
  67.       boolean hasDynafields = false;
  68.       int cnt = 0;
  69.  
  70.       while(e.hasMoreElements()) {
  71.          Object el = e.nextElement();
  72.          if (!(class$asp$wizard$def$DefDynaField != null ? class$asp$wizard$def$DefDynaField : (class$asp$wizard$def$DefDynaField = class$("asp.wizard.def.DefDynaField"))).isInstance(el) || !hasDynafields) {
  73.             if (cnt == 0) {
  74.                result = result + "     ";
  75.             } else {
  76.                result = result + ", ";
  77.             }
  78.  
  79.             result = result + this.getGenericClassName(el.getClass().toString());
  80.             ++cnt;
  81.          }
  82.  
  83.          if ((class$asp$wizard$def$DefDynaField != null ? class$asp$wizard$def$DefDynaField : (class$asp$wizard$def$DefDynaField = class$("asp.wizard.def.DefDynaField"))).isInstance(el)) {
  84.             hasDynafields = true;
  85.          }
  86.       }
  87.  
  88.       return result;
  89.    }
  90.  
  91.    public String getGenericClassName(String wholeName) {
  92.       String result = "";
  93.       String key = "";
  94.       if (wholeName.compareTo("class asp.wizard.def.DefConnection") == 0) {
  95.          key = "label.connectionname";
  96.       } else if (wholeName.compareTo("class asp.wizard.def.DefQuery") == 0) {
  97.          key = "label.queryname";
  98.       } else if (wholeName.compareTo("class asp.wizard.def.DefList") == 0) {
  99.          key = "label.listname";
  100.       } else if (wholeName.compareTo("class asp.wizard.def.DefPage") == 0) {
  101.          key = "label.pagename";
  102.       } else {
  103.          key = "label.dynafieldsname";
  104.       }
  105.  
  106.       if (key.length() > 0) {
  107.          result = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelFinish != null ? class$asp$wizard$WVPanelFinish : (class$asp$wizard$WVPanelFinish = class$("asp.wizard.WVPanelFinish")), key);
  108.       }
  109.  
  110.       return result;
  111.    }
  112.  
  113.    // $FF: synthetic method
  114.    static Class class$(String class$) {
  115.       try {
  116.          return Class.forName(class$);
  117.       } catch (ClassNotFoundException forName) {
  118.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  119.       }
  120.    }
  121. }
  122.