}//GEN-LAST:event_btDeleteVidalActionPerformed
private void btAddAtcNodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAddAtcNodeActionPerformed
try {
Object value = treeVidalAtc.getLastSelectedPathComponent();
DirectoryVidalAtcItem newItem = null;
if (value instanceof DirectoryVidalAtcItem) {
DirectoryVidalAtcItem selected = (DirectoryVidalAtcItem) value;
tfGroupCodePref.setText(selected.getGroupCode());
tfName.setText("");
tfGroupCode.setText("");
int res = JOptionPane.showConfirmDialog(null, pnlNewNode, "Заполните поля", JOptionPane.OK_CANCEL_OPTION, -1);
if (res == JOptionPane.OK_OPTION) {
if (tfName.getText().isEmpty() || tfGroupCode.getText().isEmpty()) {
MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
return;
} else {
ClassificationAtcDetails details = new ClassificationAtcDetails();
details.title = tfName.getText();
details.groupCode = tfGroupCode.getText();
details.parentItem = selected.getID();
newItem = new DirectoryVidalAtcItem(details);
selected.getItems().append(newItem);
}
}
} else {
tfGroupCodePref.setText("");
tfName.setText("");
tfGroupCode.setText("");
int res = JOptionPane.showConfirmDialog(null, pnlNewNode, "Заполните поля", JOptionPane.OK_CANCEL_OPTION, -1);
if (res == JOptionPane.OK_OPTION) {
if (tfName.getText().isEmpty() || tfGroupCode.getText().isEmpty()) {
MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
return;
} else {
ClassificationAtcDetails details = new ClassificationAtcDetails();
details.title = tfName.getText();
details.groupCode = tfGroupCode.getText();
newItem = new DirectoryVidalAtcItem(details);
directoryVidalAtc.getItems().append(newItem);
}
}
}
updateTree();