|
@@ -55,14 +55,22 @@ public class CreateTemplatePopUp extends JDialog {
|
|
|
|
|
|
//PopUp Parts
|
|
//PopUp Parts
|
|
private Control controller;
|
|
private Control controller;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Category Selection
|
|
|
|
+ */
|
|
|
|
+ Choice choice;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* name textfield
|
|
* name textfield
|
|
*/
|
|
*/
|
|
private JTextField textField_name;
|
|
private JTextField textField_name;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* textField for path
|
|
* textField for path
|
|
*/
|
|
*/
|
|
private JTextField textField_imagePath;
|
|
private JTextField textField_imagePath;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Image Preview
|
|
* Image Preview
|
|
*/
|
|
*/
|
|
@@ -122,7 +130,7 @@ public class CreateTemplatePopUp extends JDialog {
|
|
/**
|
|
/**
|
|
* Category Choice
|
|
* Category Choice
|
|
*/
|
|
*/
|
|
- Choice choice = new Choice();
|
|
|
|
|
|
+ choice = new Choice();
|
|
choice.setBounds(86, 13, 172, 22);
|
|
choice.setBounds(86, 13, 172, 22);
|
|
contentPanel.add(choice);
|
|
contentPanel.add(choice);
|
|
//add categories
|
|
//add categories
|
|
@@ -275,7 +283,15 @@ public class CreateTemplatePopUp extends JDialog {
|
|
}
|
|
}
|
|
|
|
|
|
private void createTemplate(){
|
|
private void createTemplate(){
|
|
- System.out.println("Create "+category+" "+template.toString());
|
|
|
|
|
|
+ template.setName(textField_name.getText());
|
|
|
|
+ template.setImage(textField_imagePath.getText());
|
|
|
|
+ try {
|
|
|
|
+ controller.addObject(controller.searchCategory(choice.getItem(choice.getSelectedIndex())), template.getName(), template.getElements(), template.getImage());
|
|
|
|
+ this.dispose();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ System.out.println("Could not create Template: Category not found!");
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void addElement(){
|
|
private void addElement(){
|