Ejemplo n.º 1
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;
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
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();
 }
Ejemplo n.º 4
0
 @Override
 public void requestDefaultFocus() {
   nama.requestFocus();
 }
Ejemplo n.º 5
0
  public void setColorView() {

    code.setBackground(App.whiteSmoke);
    username.setBackground(App.whiteSmoke);
    grp.setBackground(App.whiteSmoke);
    nama.setBackground(App.whiteSmoke);
    alamat.setBackground(App.whiteSmoke);
    salamat.setBackground(App.whiteSmoke);

    kota.setBackground(App.whiteSmoke);
    noIdentitas.setBackground(App.whiteSmoke);
    jenisIdentitas.setBackground(App.whiteSmoke);
    kotaLahir.setBackground(App.whiteSmoke);
    tglLahir.setBackground(App.whiteSmoke);
    jenisKelamin.setBackground(App.whiteSmoke);
    noTelp.setBackground(App.whiteSmoke);
    noHp1.setBackground(App.whiteSmoke);
    noHp2.setBackground(App.whiteSmoke);
    pinBb.setBackground(App.whiteSmoke);
    tglMasuk.setBackground(App.whiteSmoke);
    gaji.setBackground(App.whiteSmoke);
    jenisPekerjaan.setBackground(App.whiteSmoke);
    pendidikanTerakhir.setBackground(App.whiteSmoke);
    status.setBackground(App.whiteSmoke);
  }
Ejemplo n.º 6
0
  public void resetContentComponent() {
    code.setText("");
    username.setText("");
    grp.setText("");
    nama.setText("");
    alamat.setText("");

    kota.setText("");
    noIdentitas.setText("");
    jenisIdentitas.setText("");
    kotaLahir.setText("");
    tglLahir.setText("");
    jenisKelamin.setText("");
    noTelp.setText("");
    noHp1.setText("");
    noHp2.setText("");
    pinBb.setText("");
    tglMasuk.setText("");
    gaji.setText("");
    jenisPekerjaan.setText("");
    pendidikanTerakhir.setText("");
    status.setText("");
  }
Ejemplo n.º 7
0
 public void requestDefaultFocus() {
   code.requestFocus();
 }
Ejemplo n.º 8
0
  public void setContentComponent(ODocument o) {
    if (o != null && modelIsTrue(o)) {
      UsrDao d = App.getUsrDao();
      code.setText(d.getCode(o));

      username.setText(d.getUsername(o));
      //				grp.setText(model.field(Usr.)+"");
      nama.setText(d.getNama(o));
      alamat.setText(d.getAlamat(o));

      kota.setText(d.getKota(o));
      noIdentitas.setText(d.getNoIdentitas(o));
      jenisIdentitas.setText(d.getJenisIdentitas(o));
      kotaLahir.setText(d.getKotaLahir(o));
      tglLahir.setText(d.tglLahirToString(o));
      jenisKelamin.setText(d.jenisKelaminToString(o));
      noTelp.setText(d.getNoTelp(o));
      noHp1.setText(d.getNoHp1(o));
      noHp2.setText(d.getNoHp2(o));
      pinBb.setText(d.getPinBb(o));
      tglMasuk.setText(d.tglMasukToString(o));
      gaji.setText(d.gajiToString(o));
      //				jenisPekerjaan.setText(model.field(Usr.JENIS_PEKERJAAN)+"");
      pendidikanTerakhir.setText(d.getPendidikanTerakhir(o));
      status.setText(d.statusToString(o));

    } else if (o != null && o.field("@class").equals(Grp.TABLE)) {
      grp.setText(o.field(Grp.NAME) + "");
    } else if (o != null && o.field("@class").equals(JenisPekerjaan.TABLE)) {
      jenisPekerjaan.setText(o.field(JenisPekerjaan.NAMA) + "");
    }
  }
Ejemplo n.º 9
0
  public void setEditable(boolean isEdit) {

    code.setEditable(isEdit);
    username.setEditable(isEdit);
    grp.setEditable(isEdit);
    nama.setEditable(isEdit);
    alamat.setEditable(isEdit);

    kota.setEditable(isEdit);
    noIdentitas.setEditable(isEdit);
    jenisIdentitas.setEditable(isEdit);
    kotaLahir.setEditable(isEdit);
    tglLahir.setEditable(isEdit);
    jenisKelamin.setEditable(isEdit);
    noTelp.setEditable(isEdit);
    noHp1.setEditable(isEdit);
    noHp2.setEditable(isEdit);
    pinBb.setEditable(isEdit);
    tglMasuk.setEditable(isEdit);
    gaji.setEditable(isEdit);
    jenisPekerjaan.setEditable(isEdit);
    pendidikanTerakhir.setEditable(isEdit);
    status.setEditable(isEdit);
  }