示例#1
0
  public void doIt() {
    // CellPanel [] p = addToolbar();
    Global.mainForm = this;
    // this.title = "CacheWolf " + Version.getRelease();
    this.exitSystemOnClose = true;
    this.resizable = true;
    this.moveable = true;
    this.windowFlagsToSet = WindowConstants.FLAG_MAXIMIZE_ON_PDA;
    // Rect screen = ((ewe.fx.Rect)
    // (Window.getGuiInfo(WindowConstants.INFO_SCREEN_RECT,null,new
    // ewe.fx.Rect(),0)));
    // if ( screen.height >= 600 && screen.width >= 800)
    // this.setPreferredSize(800, 600);
    this.resizeOnSIP = true;
    InfoBox infB = null;
    try {
      pref.readPrefFile();
      if (MyLocale.initErrors.length() != 0) {
        new MessageBox("Error", MyLocale.initErrors, FormBase.OKB).execute();
      }
      if (Vm.isMobile() == true) {
        // this.windowFlagsToSet |=Window.FLAG_FULL_SCREEN;
        this.resizable = false;
        this.moveable = false;
      } else {
        int h, w;
        h = pref.myAppHeight;
        if (h > MyLocale.getScreenHeight()) h = MyLocale.getScreenHeight();
        w = pref.myAppWidth;
        if (w > MyLocale.getScreenWidth()) w = MyLocale.getScreenWidth();
        this.setPreferredSize(w, h);
      }
      addGuiFont();
      if (!pref.selectProfile(profile, Preferences.PROFILE_SELECTOR_ONOROFF, true))
        ewe.sys.Vm.exit(0); // User MUST select or create a profile
      Vm.showWait(true);

      // Replace buildt-in symbols with customized images
      GuiImageBroker.customizedSymbols();

      // Load CacheList
      infB = new InfoBox("CacheHound", MyLocale.getMsg(5000, "Loading Cache-List"));
      infB.exec();
      infB.waitUntilPainted(100);
      profile.readIndex(infB);
      pref.setCurCenter(new CWPoint(profile.getCenter()));
      profile.updateBearingDistance();
      setTitle("CacheHound " + Version.getRelease() + " - " + profile.name);
    } catch (Exception e) {
      if (pref.debug == true) Vm.debug("MainForm:: Exception:: " + e.toString());
    }

    if (pref.showStatus) statBar = new StatusBar(pref, profile.cacheDB);
    mMenu = new MainMenu(this);
    mTab = new MainTab(mMenu, statBar);
    split = new SplittablePanel(PanelSplitter.HORIZONTAL);
    split.theSplitter.thickness = 0;
    split.theSplitter.modify(Invisible, 0);
    CellPanel pnlCacheList = split.getNextPanel();
    CellPanel pnlMainTab = split.getNextPanel();
    split.setSplitter(
        PanelSplitter.MIN_SIZE | PanelSplitter.BEFORE,
        PanelSplitter.HIDDEN | PanelSplitter.BEFORE,
        PanelSplitter.CLOSED);
    pnlCacheList.addLast(cacheList = new CacheList(), STRETCH, FILL);
    pnlMainTab.addLast(mTab, STRETCH, FILL);

    mTab.dontAutoScroll = true;

    this.addLast(split, STRETCH, FILL);
    /*
     * if (pref.menuAtTop) { this.addLast(mMenu,CellConstants.DONTSTRETCH,
     * CellConstants.FILL); this.addLast(split,STRETCH,FILL); } else {
     * this.addLast(split,STRETCH,FILL);
     * this.addLast(mMenu,CellConstants.DONTSTRETCH, CellConstants.FILL); }
     */
    mMenu.setTablePanel(mTab.getTablePanel());
    if (infB != null) infB.close(0);
    mTab.tbP.refreshTable();
    mTab.tbP.selectFirstRow();
    // mTab.tbP.tc.paintSelection();
    Vm.showWait(false);
  }