if (res == JOptionPane.OK_OPTION) {
if (tfName.getText().isEmpty()) {
MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
return;
} else {
ClassificationFarmDetails details = new ClassificationFarmDetails();
details.title = tfName.getText();
details.parentItem = selected.getID();
newItem = new DirectoryVidalFarmItem(details);
selected.getItems().append(newItem);
}
}
} else {
tfName.setText("");
int res = JOptionPane.showConfirmDialog(null, pnlNewNode, "Заполните поля", JOptionPane.OK_CANCEL_OPTION, -1);
if (res == JOptionPane.OK_OPTION) {
if (tfName.getText().isEmpty()) {
MessageBox.showWarning(MessageBox.W_INCORRECT_DATA);
return;
} else {
ClassificationFarmDetails details = new ClassificationFarmDetails();
details.title = tfName.getText();
newItem = new DirectoryVidalFarmItem(details);
directoryVidalFarm.getItems().append(newItem);
}
}