コード例 #1
0
  @Override
  public void save() {
    Pegawai model = new Pegawai();
    model.setCode(code.getText().trim());
    model.setNama(nama.getText().trim());
    model.setUsername(username.getText().trim());
    UtilAccount u = new UtilAccount();
    String p;
    try {
      p = u.md5(new String(password.getPassword()));
      model.setPassword(p);
    } catch (Exception e) {
      App.printErr(e);
    }
    model.setJenisIdentitas(jenisIdentitas.getText().trim());
    model.setNoIdentitas(noIdentitas.getText().trim());
    model.setAlamat(alamat.getText().trim());
    model.setKota(kota.getText().trim());
    model.setHp(hp.getText().trim());
    model.setStatus(status.getSelectedIndex());
    try {
      HakAks h = (HakAks) hakAkses.getSelectedItem();
      model.setHakAks(h);
    } catch (Exception e) {
      App.printErr(e);
    }

    PegawaiDao d = App.getPegawaiDao();
    d.saveAutoCode(model);
    this.model = model;
  }
コード例 #2
0
 @Override
 public void actionReset() {
   code.setText("Auto");
   nama.setText("");
   username.setText("");
   password.setText("");
   ulang.setText("");
   jenisIdentitas.setText("");
   noIdentitas.setText("");
   alamat.setText("");
   kota.setText("");
   hp.setText("");
   status.setSelectedIndex(0);
   List<Object> os = App.getHakAks().getAll();
   os.add(0, App.getT("Pilih Hak Akses"));
   hakAksesModel = new DefaultComboBoxModel<Object>(os.toArray());
   hakAkses.setModel(hakAksesModel);
   hakAkses.setSelectedIndex(0);
   requestDefaultFocus();
 }
コード例 #3
0
  @Override
  public boolean validate() {
    PegawaiDao d = App.getPegawaiDao();
    if (code.getText().trim().equalsIgnoreCase("")) {
      App.showErrorFieldEmpty(LPegawai.CODE);
      return false;
    } else {
      long tmp = d.countByColumn("code", code.getText().trim());
      if (tmp > 0) {
        App.showErrorDataSudahAda(LPegawai.CODE);
        return false;
      }
    }

    if (nama.getText().trim().equalsIgnoreCase("")) {
      App.showErrorFieldEmpty(LPegawai.NAMA);
      return false;
    }

    if (username.getText().trim().equalsIgnoreCase("")) {
      App.showErrorFieldEmpty(LPegawai.USERNAME);
      return false;
    } else {
      long tmp = d.countByColumn("username", username.getText().trim());
      if (tmp > 0) {
        App.showErrorDataSudahAda(LPegawai.USERNAME);
        return false;
      }
    }

    if (password.getPassword().length > 0) {
      if (password.getPassword().length == ulang.getPassword().length
          && Arrays.equals(password.getPassword(), ulang.getPassword())) {

      } else {
        App.showErrorPasswordTidakSamadenganKonfirmasi();
        ulang.requestFocus();
        return false;
      }
    } else {
      App.showErrorFieldEmpty(LPegawai.PASSWORD);
      password.requestFocus();
      return false;
    }

    if (hakAkses.getSelectedIndex() == 0) {
      App.showErrorEmptySelect(LPegawai.HAK_AKSES);
      return false;
    }

    return true;
  }
コード例 #4
0
 public void initComponent() {
   code = new TextField();
   nama = new TextField();
   username = new TextField();
   password = new PasswordField();
   ulang = new PasswordField();
   jenisIdentitas = new TextField();
   noIdentitas = new TextField();
   alamat = new TextArea();
   salamat = new ScrollPane(alamat);
   kota = new TextField();
   hp = new TextField();
   status = new ComboBox(App.getPegawaiDao().getStatusData());
   List<Object> os = App.getHakAks().getAll();
   os.add(0, App.getT("Pilih Hak Akses"));
   hakAksesModel = new DefaultComboBoxModel<Object>(os.toArray());
   hakAkses = new ComboBox(hakAksesModel);
   hakAkses.setSelectedIndex(0);
 }