Пример #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
  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) + "");
    }
  }
Пример #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);
 }
Пример #5
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();
 }
Пример #6
0
  public void init() {
    toolWindowManager = new MyDoggyToolWindowManager();
    ((MyDoggyToolWindowManager) toolWindowManager).getMainContainer().setBackground(Color.WHITE);

    frame = new JFrame();

    panelBottom = new PanelBottom();

    // aksi
    ExitAction exit = new ExitAction();
    App.getActions().put("exit", exit);

    //		masters=new ArrayList<>();
  }
Пример #7
0
  public void buildForm(ODatabaseDocumentTx db) {
    Double tmp = App.getW() * lebar;
    layout =
        new FormLayout(
            // "r:p,   	10px,   	f:max("+tmp.intValue()+"px;p):g,  10px,   	f:max(80px;p),  10px,
            //	f:max(80px;p),     	10px," +
            "r:p,3dlu,	f:max("
                + tmp.intValue()
                + "px;p):g,3dlu,	f:max("
                + tmp.intValue()
                + "px;p):g,3dlu,	10dlu,	r:p,3dlu,	f:max("
                + tmp.intValue()
                + "px;p):g,3dlu,	r:p,3dlu,	f:max("
                + tmp.intValue()
                + "px;p):g,3dlu,",
            "p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,  2dlu,   t:30dlu,3dlu,   p,3dlu,  p,3dlu,  p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,  p,3dlu,  p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,   p,3dlu,  p,3dlu,  p,3dlu ,10dlu");

    layout.setColumnGroups(new int[][] {{3, 5, 10, 14}});
    builder = new FormBuilder(layout, true);

    builder.append(LUsr.CODE, code, 1, 1, 1);
    builder.append(LUsr.USERNAME, username, 1, 3, 3);

    builder.append(LUsr.GRP, grp, 1, 5, 3);
    builder.append(LUsr.STATUS, status, 1, 7, 3);

    builder.append(LUsr.TGL_MASUK, tglMasuk, 1, 12, 3);
    builder.append(LUsr.GAJI, gaji, 1, 14, 3);
    builder.append(LUsr.JENIS_PEKERJAAN, jenisPekerjaan, 1, 16, 3);

    builder.append(LUsr.NAMA, nama, 8, 1, 5);
    builder.append(LUsr.JENIS_IDENTITAS, jenisIdentitas, 8, 3, 1);
    builder.append(LUsr.NO_IDENTITAS, noIdentitas, 12, 3, 1);
    builder.append(LUsr.KOTA_LAHIR, kotaLahir, 8, 5, 1);
    builder.append(LUsr.TGL_LAHIR, tglLahir, 12, 5, 1);
    builder.append(LUsr.JENIS_KELAMIN, jenisKelamin, 8, 7, 1);
    builder.appendTa(LUsr.ALAMAT, salamat, 8, 9, 5, 4);
    builder.append(LUsr.KOTA, kota, 8, 14, 5);
    builder.append(LUsr.NO_TELP, noTelp, 8, 16, 1);
    builder.append(LUsr.PIN_BB, pinBb, 12, 16, 1);
    builder.append(LUsr.NO_HP1, noHp1, 8, 18, 1);
    builder.append(LUsr.NO_HP2, noHp2, 12, 18, 1);
    builder.append(LUsr.PENDIDIKAN_TERAKHIR, pendidikanTerakhir, 8, 20, 5);
  }
Пример #8
0
  public void build(ODatabaseDocumentTx db) {

    menu.build(db);
    toolbar.build(db);
    panelBottom.build();

    // toolWindowManager
    for (ToolWindow window : toolWindowManager.getToolWindows()) {
      window.setAvailable(true);
    }

    toolWindowManager
        .getContentManager()
        .addContentManagerListener(
            new ContentManagerListener() {

              @Override
              public void contentSelected(ContentManagerEvent arg0) {
                idMasterOpen = arg0.getContent().getId();
                if (masterOpen != null) {
                  masterOpen.requestDefaultSelected();
                }
              }

              @Override
              public void contentRemoved(ContentManagerEvent arg0) {
                if (arg0.getContent().getId().equals(idMasterOpen)) {
                  idMasterOpen = "";
                }
                if (toolWindowManager.getContentManager().getContentCount() == 0) {
                  App.getActions().get(LApp.SHOW_WELCOME).actionPerformed(null);
                }
              }

              @Override
              public void contentAdded(ContentManagerEvent arg0) {
                idMasterOpen = arg0.getContent().getId();
                masterOpen = mapMaster.get(idMasterOpen);
                System.out.println(idMasterOpen);
                if (toolWindowManager.getContentManager().getContentCount() > 1) {
                  try {
                    Content c =
                        toolWindowManager
                            .getContentManager()
                            .getContentByComponent(welcomeComponent);
                    toolWindowManager.getContentManager().removeContent(c);
                  } catch (Exception e) {
                    App.printErr(e);
                  }
                }
              }
            });

    // frame
    frame.setTitle(LWindow.TITLE);
    frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    frame.setIconImage(App.getImage(LApp.iconApp16).getImage());
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setJMenuBar(menu.getMenuBar());

    // build tool window manager
    JPanel p = new JPanel();
    p.setLayout(new ExtendedTableLayout(new double[][] {{0, -1, 0}, {0, -1, 0}}));
    p.add((Component) toolWindowManager, "1,1,");

    frame.add(p, BorderLayout.CENTER);

    // frame.getContentPane().add(toolbar.getPanel(), BorderLayout.SOUTH);
    JPanel p2 = new JPanel(new BorderLayout());
    p2.add(new JSeparator(), BorderLayout.NORTH);
    p2.add(panelBottom.getPanel(), BorderLayout.CENTER);
    frame.getContentPane().add(p2, BorderLayout.SOUTH);
  }
Пример #9
0
 public void init(ODatabaseDocumentTx db) {
   lebar = 0.002;
   dao = App.getUsrDao();
   initComponent(db);
 }