Package nu.lazy8.util.gen

Examples of nu.lazy8.util.gen.WorkingDialog


      //mckoi requires some sort of password
      stringUser = "PasswordIsPass";
      stringPass = "Pass"; // FIXME: stringPass is never used
    }

    WorkingDialog workDialog = new WorkingDialog(null);
    workDialog.setVisible(true);
    workDialog.SetProgress(0);
    DatabaseSystem system = new DatabaseSystem();
    // Create a default configuration
    DefaultDBConfig config = new DefaultDBConfig();
    File ff;
    try {
      ff = Fileio.getFile("data", "data", false, false);
    } catch (Exception ee) {
      SystemLog.ErrorPrint("Cant find db.conf : " + ee.getMessage());
      workDialog.dispose();
      return;
    }
    config.setDatabasePath(ff.getAbsolutePath());
    config.setMinimumDebugLevel(Integer.MAX_VALUE);
    // Set up the log file
    system.setDebugLevel(Integer.MAX_VALUE);
    // Initialize the DatabaseSystem,
    // -----------------------------
    // This will throw an Error exception if the database system has already
    // been initialized.
    system.init(config);
    // Note, currently we only register one database, and it is named
    //   'DefaultDatabase'.
    Database database = new Database(system, "DefaultDatabase");
    boolean success = false;
    try {
      // Convert to the current version.
      success = database.convertToCurrent(System.out, stringUser);
    } catch (IOException e) {
      System.out.println("IO Error: " + e.getMessage());
      e.printStackTrace(System.out);
    }

    if (success) {
      System.out.println("-- Convert Successful --");
    } else {
      if (stringDriver.compareTo(DataConnection.MCKOI_DRIVER) != 0 &&
          stringUser.compareTo("PasswordIsPass") != 0) {
        //they are using another database, try again.
        try {
          // Convert to the current version.
          success = database.convertToCurrent(System.out, "PasswordIsPass");
        } catch (IOException e) {
          System.out.println("IO Error: " + e.getMessage());
          e.printStackTrace(System.out);
        }
      }
      if (success) {
        System.out.println("-- Convert Successful --");
      } else {
        System.out.println("-- Convert Failed --");
      }
    }

    SetupInfo.setBoolProperty(SetupInfo.IS_DATBASE_94_UPGRADE_DONE, success);
    SetupInfo.store();
    if (success) {
      UpgradeAccounts(workDialog);
      Upgrade20Dialogs up = new Upgrade20Dialogs(null, true, true,
          Translator.getTranslation("Upgrade to Lazy 8 Ledger 2.0."), 0);
    }
    workDialog.dispose();
  }//}}}
View Full Code Here


     
      //{{{ Update to 2.20
      if (SetupInfo.getProperty("lazy8ledger.lastRunVersion").compareTo("2.20") < 0) {
        //lots of database changes to make
        //need a connection to the database
        WorkingDialog workDialog = new WorkingDialog(null);
        workDialog.setVisible(true);
        try {
          DataConnection dc = new DataConnection(null);
          if (dc == null || !dc.bIsConnectionMade) {
            JOptionPane.showMessageDialog(null,
                Translator.getTranslation("Could not connect to the database.  Do not attempt to continue."),
                Translator.getTranslation("Must restart"),
                JOptionPane.PLAIN_MESSAGE);
            isInStart=true;
            return;
          }
          //copy old Activity table into new Activity2 table
          //UniqNumGenerator uniqnum = new UniqNumGenerator(); // commented out since never used
          Statement st = dc.con.createStatement();
          ResultSet rsOldTrans = st.executeQuery(dc.filterSQL(
              "SELECT CompId,Act_id,RegDate,InvDate,Notes,FileInfo FROM Activity ORDER BY CompId,Act_id"));
          rsOldTrans.last();
          int numRecs=rsOldTrans.getRow();
          rsOldTrans.beforeFirst();
          while (rsOldTrans.next()) {
            PreparedStatement prepSt = dc.con.prepareStatement(
              "INSERT INTO Activity2 (CompId,Act_id,PeriodId,RegDate,InvDate,Notes,FileInfo) VALUES (?,?,?,?,?,?,?)");
            prepSt.setInt(1,rsOldTrans.getInt(1));
            prepSt.setInt(2, rsOldTrans.getInt(2));
            prepSt.setInt(3, 0);
            prepSt.setDate(4, rsOldTrans.getDate(3));
            prepSt.setDate(5, rsOldTrans.getDate(4));
            prepSt.setString(6, rsOldTrans.getString(5));
            prepSt.setString(7, rsOldTrans.getString(6));
            prepSt.executeUpdate();
            workDialog.SetProgress((rsOldTrans.getRow() * 100) / (numRecs));
          }
          //delete the old Activity table
          st = dc.con.createStatement();
          st.executeUpdate("DROP TABLE Activity");
          SystemLog.ErrorPrintln("Dropped old table Activity");
        } catch (Exception e) {
          e.printStackTrace();
          //we need to continue because otherwise this is a lock stoping proper usage of lazy8ledger forever
          //return;
        }
        workDialog.dispose();
        AdjustAllPeriodIds(0);
      }//}}}

      SetupInfo.setProperty("lazy8ledger.lastRunVersion",
          jEdit.getProperty("plugin.lazy8ledger.Lazy8LedgerPlugin.version"));
View Full Code Here

  /**
   *  Description of the Method
   * @param inCompId the company id
   */
  public static void AdjustAllPeriodIds(int inCompId) {
    WorkingDialog workDialog = new WorkingDialog(null);
    workDialog.setVisible(true);
    try {
      DataConnection dc = new DataConnection(null);
      if (dc == null || !dc.bIsConnectionMade) {
        return;
      }
      //get rid of all uniq num posts for period ids
      dc.con.createStatement().executeQuery(dc.filterSQL(
        "DELETE FROM UniqNum WHERE UniqName LIKE 'PeriodId=%'"));
      //adjust the periodid for each activity
      UniqNumGenerator uniqnum = new UniqNumGenerator();
      ResultSet rsPeriods=null;
      String select="SELECT CompId,Act_id,InvDate FROM Activity2 ";
      if (inCompId>0)
        select+=" WHERE CompId=" + inCompId;
      select+=" ORDER BY CompId,Act_id";
      ResultSet rsOldTrans = dc.con.createStatement().executeQuery(dc.filterSQL(select));
      int lastCompId=-1;
      rsOldTrans.last();
      int numRecs=rsOldTrans.getRow();
      rsOldTrans.beforeFirst();
      while (rsOldTrans.next()) {
        if (lastCompId!=rsOldTrans.getInt(1)){
          //get all the periods for the CompId
          lastCompId=rsOldTrans.getInt(1);
          rsPeriods=dc.con.createStatement().executeQuery(dc.filterSQL(
            "SELECT StartPeriod,EndPeriod FROM AccountingPeriods WHERE CompId=" + lastCompId));
        }
        Date invoiceDate=rsOldTrans.getDate(3);
        int periodId=0;
        rsPeriods.beforeFirst();
        //find the appropriate period if it exists.
        while (rsPeriods.next()) {
          if (invoiceDate.compareTo(rsPeriods.getDate(1))>=0 && invoiceDate.compareTo(rsPeriods.getDate(2))<=0){
            //increment period id counter
            periodId=uniqnum.GetUniqueNumber("PeriodId="+ rsPeriods.getDate(1) + "-"
              + rsPeriods.getDate(2), 1, 999999999,new Integer(lastCompId));
            break; //we found the period we need
          }
        }
        dc.con.createStatement().executeQuery(dc.filterSQL(
          "UPDATE Activity2 SET PeriodId=" + periodId + " WHERE CompId=" + lastCompId + " AND Act_id=" + rsOldTrans.getInt(2)));
        workDialog.SetProgress((rsOldTrans.getRow() * 100) / (numRecs));
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    workDialog.dispose();
  }//}}}
View Full Code Here

    getContentPane().add(ps, BorderLayout.CENTER);
    m_monitor.setText("");
    m_monitor.replaceSelection(Translator.getTranslation("Enter the accounting period you want to work with.  This is usually from the beginning of the year to the end of the year.") + "\n" +
        Translator.getTranslation("Press NEXT to continue."));

    dateField1 = new DateField("From", "periodform", frameParent);
    dateField2 = new DateField("To", "periodform", frameParent);

    rightButton = new JButton(Translator.getTranslation("Next"));

    rightButton.addActionListener(
      new java.awt.event.ActionListener() {
View Full Code Here

    jPanel1.add(textField4);

    jPanel1.add(new JLabel());

    button1 = new HelpedButton(Translator.getTranslation("Cancel"),
        "Cancel", "dataconn", view);

    button1.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          isAbort = true;
          DataConnectDialog.this.setVisible(false);
        }//}}}
      }
        );

    jPanel1.add(button1);

    JButton button4 = new HelpedButton(Translator.getTranslation("OK"),
        "ok", "dataconn", view);

    button4.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonOK();
        }//}}}
      }
        );
    jPanel1.add(button4);

    JButton button5 = new HelpedButton(Translator.getTranslation("Help"),
        "help", "dataconn", view);

    button5.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonHelp();
        }//}}}
View Full Code Here

    j1.add(listPanel);
    if (StandardAccountsDialog.existsStandard()) {
      //create a get standard button
      JPanel jPanel1 = new JPanel();
      jPanel1.setLayout(new GridLayout(3, 1));
      JButton button1 = new HelpedButton(
          Translator.getTranslation("Get predefined standard account"),
          "predefined", "account", view);
      button1.addActionListener(
        new java.awt.event.ActionListener() {
          //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            StandardAccountsDialog sad = new StandardAccountsDialog((View) view);
            if (sad.selNumber != 0) {
View Full Code Here

      DataExchangeForm formDataExchangein, boolean bAddOnly, JFrame view) {
    this.view = view;
    dataAccess = dataAccessin;
    formDataExchange = formDataExchangein;

    butAdd = new HelpedButton(Translator.getTranslation("Add"),
        "add", "datamove", view);
    buttonDelete = new HelpedButton(Translator.getTranslation("Delete"),
        "delete", "datamove", view);
    buttonChange = new HelpedButton(Translator.getTranslation("Change"),
        "change", "datamove", view);
    buttonGetNext = new HelpedButton(Translator.getTranslation("Next"),
        "next", "datamove", view);
    buttonGetFirst = new HelpedButton(Translator.getTranslation("First"),
        "first", "datamove", view);
    buttonClear = new HelpedButton(Translator.getTranslation("Clear"),
        "clear", "datamove", view);
    buttonSeek = new HelpedButton(Translator.getTranslation("Find"),
        "find", "datamove", view);
    buttonExit = new HelpedButton(Translator.getTranslation("Exit"),
        "exit", "datamove", view);
    buttonHelp = new HelpedButton(Translator.getTranslation("Help"),
        "help", "datamove", view);
    buttonSeekList = new HelpedButton(Translator.getTranslation("Find list"),
        "findlist", "datamove", view);

    if (bAddOnly) {
      add(butAdd);
      add(buttonExit);
View Full Code Here

    jpButtons.setLayout(new GridLayout(1, 3));
    add(jpButtons, BorderLayout.SOUTH);
    //save button
    //cancel button
    //help button
    JButton b11 = new HelpedButton(Translator.getTranslation("Save"), "Save", "translator", view);
    jpButtons.add(b11);
    b11.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonSave();
        }//}}}
      }
        );
    JButton b12 = new HelpedButton(Translator.getTranslation("Cancel"), "Cancel", "translator", view);
    jpButtons.add(b12);
    b12.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonCancel();
        }//}}}
      }
        );
    JButton b13 = new HelpedButton(Translator.getTranslation("Help"), "Help", "translator", view);
    jpButtons.add(b13);
    b13.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonHelp();
        }//}}}
View Full Code Here

      jLanguageBox = new JComboBox();
      arrayLanguages = new ArrayList();

      jp.add(jLanguageBox);

      JButton b11 = new HelpedButton(Translator.getTranslation("New"), "New", "translator", view);
      jp.add(b11);
      b11.addActionListener(
        new java.awt.event.ActionListener() {
          //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonNew();
          }//}}}
        }
          );
      JButton b12 = new HelpedButton(Translator.getTranslation("Load"), "Load", "translator", view);
      jp.add(b12);
      b12.addActionListener(
        new java.awt.event.ActionListener() {
          //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonLoad();
          }//}}}
View Full Code Here

   *  Description of the Method
   *
   * @param  jAddhere  Description of the Parameter
   */
  protected void AddButtonComponents(JPanel jAddhere) {
    JButton pdfReportBut = new HelpedButton(Translator.getTranslation("Get report"), "GetReportPDF", "allreports", view);
    jAddhere.add(pdfReportBut);
    pdfReportBut.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonGetJFreeReportPreperation();
        }//}}}
      }
        );

    JButton b10 = new HelpedButton(Translator.getTranslation("Get text only report"), "GetReport", "allreports", view);
    jAddhere.add(b10);
    b10.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonGetReportPreperation(false);
        }//}}}
      }
        );

    jAddhere.add(b10);

    JButton b11 = new HelpedButton(Translator.getTranslation("Exit"), "Exit", "allreports", view);
    jAddhere.add(b11);
    b11.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonExit();
        }//}}}
      }
        );
    JButton b12 = new HelpedButton(Translator.getTranslation("Help"), "Help", "allreports", view);
    jAddhere.add(b12);
    b12.addActionListener(
      new java.awt.event.ActionListener() {
        //{{{ +actionPerformed(java.awt.event.ActionEvent) : void
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          buttonHelp();
        }//}}}
View Full Code Here

TOP

Related Classes of nu.lazy8.util.gen.WorkingDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.