Bug fix Shortcut CTRL + T

pull/14/head
Ronaldo Christnawan 6 years ago
parent 3fc1451ac8
commit a08b2fe770

@ -168,6 +168,7 @@ public class FormUtamaController implements Initializable {
case FormConstanta.TRANSAKSI_TUNAI: case FormConstanta.TRANSAKSI_TUNAI:
if (notaContent.nodeTunai != null) { if (notaContent.nodeTunai != null) {
node = notaContent.nodeTunai; node = notaContent.nodeTunai;
notaContent.controllerTunai.initShortcuts();
} else { } else {
loader.setLocation(getClass().getResource("/fxml/FormTransaksiTunai.fxml")); loader.setLocation(getClass().getResource("/fxml/FormTransaksiTunai.fxml"));
node = loader.load(); node = loader.load();

@ -145,13 +145,12 @@ public class FormTransaksiTunaiController implements Initializable {
setTanggal(); setTanggal();
} }
private void initShortcuts() { public void initShortcuts() {
Map<KeyCombination, Runnable> listShortcuts = new HashMap<>(); Map<KeyCombination, Runnable> listShortcuts = new HashMap<>();
KeyCombination kcTundaNota = new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN); KeyCombination kcTundaNota = new KeyCodeCombination(KeyCode.T, KeyCombination.CONTROL_DOWN);
Runnable rnTundaNota = () -> { Runnable rnTundaNota = () -> {
List<DNotaTunai> daftarDNotaTunai = new ArrayList<>(); List<DNotaTunai> daftarDNotaTunai = new ArrayList<>();
if (noNota != null && !noNota.equals("")) { if (noNota != null && !noNota.equals("")) {
for (TabelBarangTunai tbt : daftarTabelTransaksi) { for (TabelBarangTunai tbt : daftarTabelTransaksi) {
tbt.getData().setNoNota(noNota); tbt.getData().setNoNota(noNota);
@ -196,7 +195,9 @@ public class FormTransaksiTunaiController implements Initializable {
}; };
listShortcuts.put(kcTundaNota, rnTundaNota); listShortcuts.put(kcTundaNota, rnTundaNota);
apMain.getScene().getAccelerators().putAll(listShortcuts); Platform.runLater(() -> {
apMain.getScene().getAccelerators().putAll(listShortcuts);
});
} }
public void setTanggal() { public void setTanggal() {
@ -638,12 +639,14 @@ public class FormTransaksiTunaiController implements Initializable {
@Override @Override
public void onComplete() { public void onComplete() {
if (parent != null) { Platform.runLater(() -> {
parent.notaContent.setControllerTunai(null); if (parent != null) {
parent.notaContent.setNodeTunai(null); parent.notaContent.setControllerTunai(null);
parent.notaContent.setNodeTunai(null);
parent.removeNota(parent.notaContent.getBtnTunai()); parent.removeNota(parent.notaContent.getBtnTunai());
} }
});
} }
}; };
} }

Loading…
Cancel
Save