|
@@ -8,6 +8,7 @@ import javax.swing.JFrame;
|
|
import javax.swing.JMenuBar;
|
|
import javax.swing.JMenuBar;
|
|
import javax.swing.JMenu;
|
|
import javax.swing.JMenu;
|
|
import javax.swing.JMenuItem;
|
|
import javax.swing.JMenuItem;
|
|
|
|
+import javax.swing.JOptionPane;
|
|
import javax.swing.UIManager;
|
|
import javax.swing.UIManager;
|
|
import javax.swing.UnsupportedLookAndFeelException;
|
|
import javax.swing.UnsupportedLookAndFeelException;
|
|
import javax.swing.JTree;
|
|
import javax.swing.JTree;
|
|
@@ -198,14 +199,13 @@ public class GUI implements CategoryListener {
|
|
Object nodeInfo = tree.getLastSelectedPathComponent();
|
|
Object nodeInfo = tree.getLastSelectedPathComponent();
|
|
String selected = comboBox.getSelectedItem().toString();
|
|
String selected = comboBox.getSelectedItem().toString();
|
|
String text = textField.getText();
|
|
String text = textField.getText();
|
|
-
|
|
|
|
- if (selected.equals("Category") && !text.isEmpty()) {
|
|
|
|
- controller.addNewCategory(textField.getText());
|
|
|
|
-
|
|
|
|
- } else if (text.isEmpty() || nodeInfo.toString().isEmpty()) {
|
|
|
|
- // throw EmptyField or NoSelectedNode Exception
|
|
|
|
-
|
|
|
|
- } else if (selected.equals("Object")) {
|
|
|
|
|
|
+ if(selected.toString() == "Category"){
|
|
|
|
+ String catName = JOptionPane.showInputDialog("Please enter the Name for Category ");
|
|
|
|
+ if(catName != ""){
|
|
|
|
+ controller.addNewCategory(catName);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (selected.equals("Object")) {
|
|
selectedNode = controller.searchCategory(nodeInfo.toString());
|
|
selectedNode = controller.searchCategory(nodeInfo.toString());
|
|
controller.addNewObject(selectedNode, textField.getText());
|
|
controller.addNewObject(selectedNode, textField.getText());
|
|
|
|
|