private void select_branch_locations() { 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(); int row = tbl_branch_locations.getSelectedRow(); if (row < 0) { return; } to_branch_locations to = (to_branch_locations) tbl_branch_locations_ALM.get(tbl_branch_locations.convertRowIndexToModel(row)); int col = tbl_branch_locations.getSelectedColumn(); if (col == 2) { S1_branch_locations.change_default_location(to); data_cols(); } else { tf_branch.setText(to.branch); tf_branch_id.setText(to.branch_id); tf_location.setText(to.location); } } }); nd.setLocationRelativeTo(this); nd.setVisible(true); }
private void add_branch_locations() { if (tf_branch.getText().isEmpty()) { return; } 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(); 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() { int id = -1; String branch = tf_branch.getText(); String branch_id = tf_branch_id.getText(); String code = ""; String location = tf_location.getText(); String type = "USER"; int status = 0; to_branch_locations to = new to_branch_locations( id, branch, branch_id, code, location, type, status); S1_branch_locations.add_branch_locations(to); data_cols(); clear_branch_locations(); Alert.set(1, ""); 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(this); nd.setVisible(true); }