Ejemplo n.º 1
0
  // End of variables declaration//GEN-END:variables
  @Override
  public boolean save() {

    try {
      if (!updateModel()) return false;

      Tax tax = (Tax) getBean();
      TaxDAO dao = new TaxDAO();
      dao.saveOrUpdate(tax);
    } catch (Exception e) {
      MessageDialog.showError(e);
      return false;
    }

    return true;
  }
Ejemplo n.º 2
0
  private void initData() {
    List<Tax> taxes = TaxDAO.getInstance().findAll();
    cbTax.setModel(new ComboBoxModel(taxes));

    int defaultTaxId = TerminalConfig.getMiscItemDefaultTaxId();
    if (defaultTaxId != -1) {
      for (int i = 0; i < taxes.size(); i++) {
        Tax tax = taxes.get(i);
        if (tax.getId() == defaultTaxId) {
          cbTax.setSelectedIndex(i);
          break;
        }
      }
    }

    List<PrinterGroup> printerGroups = PrinterGroupDAO.getInstance().findAll();
    cbPrinterGroup.setModel(new ComboBoxModel(printerGroups));
  }