Control.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package ui.controller;
  2. import ui.model.Category;
  3. import ui.model.CpsObject;
  4. import ui.model.IdCounter;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import java.util.LinkedList;
  8. import Interfaces.CategoryListener;
  9. import ui.model.Model;
  10. import ui.view.GUI;
  11. public class Control {
  12. public enum command {
  13. CATEGORY, OBJECT
  14. }
  15. private IdCounter iD;
  16. private Model model;
  17. private ActionListener actionListener;
  18. private final CategoryController categoryController;
  19. public Control(Model model, IdCounter id){
  20. this.model = model;
  21. this.iD = id;
  22. this.categoryController = new CategoryController(model, id);
  23. }
  24. ////////// Operations for Categories and Objects ///////////
  25. public void addNewCategory(String catName){
  26. categoryController.addNewCategory(catName);
  27. }
  28. public void addNewObject(Category cat, String name){
  29. categoryController.addNewHolonObject(cat, name);
  30. }
  31. public void addNewTransformer(Category cat, String name){
  32. categoryController.addNewHolonTransformer(cat, name);
  33. }
  34. public void addNewSwitch(Category cat, String name){
  35. categoryController.addNewHolonSwitch(cat, name);
  36. }
  37. public Category searchCategory(String name) {
  38. return categoryController.searchNode(name);
  39. }
  40. public void initListener(CategoryListener catLis) {
  41. categoryController.addCatListener(catLis);
  42. }
  43. ////////// etc
  44. /**
  45. * Getter for Model
  46. * @return
  47. */
  48. public Model getModel() {
  49. return model;
  50. }
  51. }