/**
   * determine if an appointment popup should be shown for an appointment that doesn't yet have a
   * popup associated with it
   *
   * @return true, if successful
   */
  @Override
  public boolean shouldBeShown() {

    if (appt == null) return false;

    // check if we should show it based on public/private
    // flags
    boolean showpub = Prefs.getBoolPref(PrefName.SHOWPUBLIC);

    boolean showpriv = Prefs.getBoolPref(PrefName.SHOWPRIVATE);

    if (appt.isPrivate()) {
      if (!showpriv) return false;
    } else {
      if (!showpub) return false;
    }

    // don't popup untimed appointments that are not todos
    if (isNote() && !isTodo()) return false;

    boolean expires = true; // true if the reminder eventually stops at some
    // point after the appt

    // todos never expire
    if (isTodo() && appt.getReminderTimes() != null && appt.getReminderTimes().indexOf('Y') != -1) {
      expires = false;
    }

    // a normal timed appt only gets a popup
    // if it's within its range of reminder times
    if (isOutsideOfReminderTimes(!expires)) return false;

    return true;
  }
Ejemplo n.º 2
0
  /**
   * complete the parts of the UI initialization that run after the splash screen has shown for a
   * while
   *
   * @param trayname name for the tray icon
   */
  private static void completeUIInitialization(String trayname) {

    // tray icon
    SunTrayIconProxy.startTrayIcon(trayname);

    // create reminder manager
    if (Prefs.getBoolPref(PrefName.REMINDERLIST)) ReminderListManager.getReference();
    else ReminderPopupManager.getReference();

    // create the main window
    MultiView mv = MultiView.getMainView();

    // load the UI modules into the main window
    mv.addModule(new MonthPanel());
    mv.addModule(new WeekPanel());
    mv.addModule(new DayPanel());
    mv.addModule(new YearPanel());
    mv.addModule(new AddrListView());
    mv.addModule(new TodoView());
    mv.addModule(new TaskModule());
    mv.addModule(new MemoPanel());
    mv.addModule(new CheckListPanel());
    mv.addModule(new SearchView());
    mv.addModule(
        new InfoView("/resource/RELEASE_NOTES.txt", Resource.getResourceString("rlsnotes")));
    mv.addModule(new InfoView("/resource/CHANGES.txt", Resource.getResourceString("viewchglog")));
    mv.addModule(new InfoView("/resource/license.htm", Resource.getResourceString("License")));

    if (Prefs.getBoolPref(PrefName.DYNAMIC_LOADING) == true) {
      addExternalModule("net.sf.borg.plugin.reports.ReportModule");
      addExternalModule("net.sf.borg.plugin.ical.IcalModule");
      addExternalModule("net.sf.borg.plugin.sync.SyncModule");
    }

    // make the main window visible
    if (!Prefs.getBoolPref(PrefName.BACKGSTART) || !SunTrayIconProxy.hasTrayIcon()) {
      mv.setVisible(true);

      // open all views that should be shown at startup
      mv.startupViews();
    }

    // destroy the splash screen
    if (splashScreen != null) {
      splashScreen.dispose();
      splashScreen = null;
    }
  }
Ejemplo n.º 3
0
  /**
   * Main UI initialization.
   *
   * @param trayname - name for the tray icon
   */
  public static void startUI(String trayname) {

    Errmsg.setErrorHandler(new UIErrorHandler());

    // check database timestamp
    try {
      JdbcDB.checkTimestamp();
    } catch (Warning e1) {
      Errmsg.getErrorHandler().notice(e1.getMessage());
    } catch (Exception e) {
      Errmsg.getErrorHandler().errmsg(e);
    }

    // default font
    String deffont = Prefs.getPref(PrefName.DEFFONT);
    if (!deffont.equals("")) {
      Font f = Font.decode(deffont);
      NwFontChooserS.setDefaultFont(f);
    }

    // set the look and feel
    String lnf = Prefs.getPref(PrefName.LNF);
    try {

      // set default jgoodies theme
      if (lnf.contains("jgoodies")) {
        String theme = System.getProperty("Plastic.defaultTheme");
        if (theme == null) {
          System.setProperty("Plastic.defaultTheme", Prefs.getPref(PrefName.GOODIESTHEME));
        }
      }

      UIManager.setLookAndFeel(lnf);
      UIManager.getLookAndFeelDefaults().put("ClassLoader", UIControl.class.getClassLoader());
    } catch (Exception e) {
      log.severe(e.toString());
    }

    // pop up the splash if the option is set
    if (Prefs.getBoolPref(PrefName.SPLASH)) {
      splashScreen = new SplashScreen();
      splashScreen.setText(Resource.getResourceString("Initializing"));
      splashScreen.setVisible(true);
      final String tn = trayname;

      /*
       * in order for the splash to be seen, we will complete
       * initialization later (in the swing thread).
       */
      Timer t =
          new Timer(
              3000,
              new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent arg0) {
                  completeUIInitialization(tn);
                }
              });
      t.setRepeats(false);
      t.start();
    } else completeUIInitialization(trayname);
  }