private void select_official_schedule_types() {
    int row = tbl_official_schedule_types.getSelectedRow();
    if (row < 0) {
      return;
    }
    int col = tbl_official_schedule_types.getSelectedColumn();
    final to_official_schedule_types to =
        (to_official_schedule_types) tbl_official_schedule_types_ALM.get(row);
    if (col == 1) {
      jTextField1.setText(to.schedule_type);
    }
    if (col == 2) {
      Window p = (Window) this;
      Dlg_confirm_action nd = Dlg_confirm_action.create(p, true);
      nd.setTitle("");

      nd.setCallback(
          new Dlg_confirm_action.Callback() {

            @Override
            public void ok(CloseDialog closeDialog, Dlg_confirm_action.OutputData data) {
              closeDialog.ok();
              Official_schedule_types.delete_data(to);
              ret_official_schedule_types();
              Alert.set(3, "");
            }
          });
      nd.setLocationRelativeTo(this);
      nd.setVisible(true);
    }
  }
 private void save_official_schedule_types() {
   int row = tbl_official_schedule_types.getSelectedRow();
   if (row < 0) {
     int id = 0;
     String created_at = DateType.now();
     String updated_at = DateType.now();
     String created_by = Res.getUser_id();
     String updated_by = Res.getUser_id();
     int status = 1;
     String schedule_type = jTextField1.getText();
     to_official_schedule_types type =
         new to_official_schedule_types(
             id, created_at, updated_at, created_by, updated_by, status, schedule_type);
     Official_schedule_types.add_data(type);
     ret_official_schedule_types();
     Alert.set(1, "");
   } else {
     to_official_schedule_types to =
         (to_official_schedule_types) tbl_official_schedule_types_ALM.get(row);
     int id = to.id;
     String created_at = to.created_at;
     String updated_at = DateType.now();
     String created_by = to.created_by;
     String updated_by = Res.getUser_id();
     int status = 1;
     String schedule_type = jTextField1.getText();
     to_official_schedule_types type =
         new to_official_schedule_types(
             id, created_at, updated_at, created_by, updated_by, status, schedule_type);
     Official_schedule_types.update_data(type);
     ret_official_schedule_types();
     Alert.set(2, "");
   }
 }
  private void select_disbursement_categories() {

    int row = tbl_disbursement_categories.getSelectedRow();
    if (row < 0) {
      return;
    }
    to_disbursement_categories to =
        (to_disbursement_categories) tbl_disbursement_categories_ALM.get(row);
    tf_category_name.setText(to.category_name);
  }
 private void select_delivery_trucks() {
   int row = tbl_delivery_trucks.getSelectedRow();
   if (row < 0) {
     return;
   }
   to_delivery_trucks to =
       (to_delivery_trucks)
           tbl_delivery_trucks_ALM.get(tbl_delivery_trucks.convertRowIndexToModel(row));
   tf_description.setText(to.description);
   tf_plate_no.setText(to.plate_no);
 }
 private void delete_delivery_trucks() {
   int row = tbl_delivery_trucks.getSelectedRow();
   if (row < 0) {
     return;
   }
   to_delivery_trucks to =
       (to_delivery_trucks)
           tbl_delivery_trucks_ALM.get(tbl_delivery_trucks.convertRowIndexToModel(row));
   S1_delivery_trucks.delete_delivery_trucks(to);
   data_cols();
   clear_delivery_trucks();
 }
 private void delete_disbursement_categories() {
   int row = tbl_disbursement_categories.getSelectedRow();
   if (row < 0) {
     return;
   }
   to_disbursement_categories to =
       (to_disbursement_categories) tbl_disbursement_categories_ALM.get(row);
   S1_disbursement_categories.delete_data(to);
   tf_category_name.setText("");
   data_disbursement_categories();
   tf_category_name.grabFocus();
 }
  private void delete_branch_locations() {
    int row = tbl_branch_locations.getSelectedRow();
    if (row < 0) {
      return;
    }
    final to_branch_locations to =
        (to_branch_locations)
            tbl_branch_locations_ALM.get(tbl_branch_locations.convertRowIndexToModel(row));
    if (to.status == 1) {
      Alert.set(0, "Cannot Delete Default Location");
      return;
    }
    Window p = (Window) this;
    Dlg_auth nd = Dlg_auth.create(p, true);
    nd.setTitle("");
    nd.setCallback(
        new Dlg_auth.Callback() {

          @Override
          public void ok(CloseDialog closeDialog, Dlg_auth.OutputData data) {
            closeDialog.ok();
            jProgressBar1.setString("Loading...Please wait...");
            jProgressBar1.setIndeterminate(true);
            btn_new.setEnabled(false);
            btn_add.setEnabled(false);
            btn_edit.setEnabled(false);
            btn_delete.setEnabled(false);
            Thread t =
                new Thread(
                    new Runnable() {
                      @Override
                      public void run() {
                        S1_branch_locations.delete_branch_locations(to);
                        data_cols();
                        clear_branch_locations();
                        Alert.set(3, "");
                        jProgressBar1.setString("Finished...");
                        jProgressBar1.setIndeterminate(false);
                        btn_new.setEnabled(true);
                        btn_add.setEnabled(true);
                        btn_edit.setEnabled(true);
                        btn_delete.setEnabled(true);
                      }
                    });
            t.start();
          }
        });
    nd.setLocationRelativeTo(jScrollPane2);
    nd.setVisible(true);
  }
 private void edit_delivery_trucks() {
   int row = tbl_delivery_trucks.getSelectedRow();
   if (row < 0) {
     return;
   }
   to_delivery_trucks to =
       (to_delivery_trucks)
           tbl_delivery_trucks_ALM.get(tbl_delivery_trucks.convertRowIndexToModel(row));
   int id = to.id;
   String description = tf_description.getText();
   String plate_no = tf_plate_no.getText();
   to_delivery_trucks to1 = new to_delivery_trucks(id, description, plate_no);
   S1_delivery_trucks.edit_delivery_trucks(to1);
   data_cols();
   clear_delivery_trucks();
 }
  private void update_disbursement_categories() {

    int row = tbl_disbursement_categories.getSelectedRow();
    if (row < 0) {
      return;
    }
    to_disbursement_categories to =
        (to_disbursement_categories) tbl_disbursement_categories_ALM.get(row);
    int id = to.id;
    String category_name = tf_category_name.getText();

    to_disbursement_categories to1 = new to_disbursement_categories(id, category_name);
    S1_disbursement_categories.update_data(to1);
    tf_category_name.setText("");
    data_disbursement_categories();
    tf_category_name.grabFocus();
  }
Esempio n. 10
0
 @Override
 public void setValueAt(Object aValue, int rowIndex, int columnIndex)
     throws NumberFormatException {
   logger.debug("MachineTableModel setValue {} {} {}", aValue, rowIndex, columnIndex);
   Machine machine = (Machine) listModel.get(rowIndex);
   if (columnIndex == Machine.Column.PART_NO.getIndex()) {
     machine.getMold().setPartNo((String) aValue);
   } else if (columnIndex == Machine.Column.TARGET.getIndex()) {
     machine.setTarget((Integer) aValue);
   } else if (columnIndex == Machine.Column.ACTUAL.getIndex()) {
     machine.setActual((Integer) aValue);
   } else if (columnIndex == Machine.Column.MULTIPLY.getIndex()) {
     machine.getMold().setMultiply((Integer) aValue);
   } else if (columnIndex == Machine.Column.STATUS.getIndex()) {
     machine.setStatus((Status) aValue);
   } else {
     throw new IllegalArgumentException("Invalid column index:" + columnIndex);
   }
 }
Esempio n. 11
0
 @Override
 public Object getValueAt(int rowIndex, int columnIndex) {
   Machine machine = ((Machine) listModel.get(rowIndex));
   if (columnIndex == Machine.Column.NO.getIndex()) {
     return machine.getMachineNo();
   } else if (columnIndex == Machine.Column.PART_NO.getIndex()) {
     return machine.getMold().getPartNo();
   } else if (columnIndex == Machine.Column.TARGET.getIndex()) {
     return machine.getTarget();
   } else if (columnIndex == Machine.Column.ACTUAL.getIndex()) {
     return machine.getActual();
   } else if (columnIndex == Machine.Column.MULTIPLY.getIndex()) {
     return machine.getMold().getMultiply();
   } else if (columnIndex == Machine.Column.STATUS.getIndex()) {
     return machine.getStatus();
   } else {
     return "NULL";
   }
 }