public SelectedController(SelectedDatesPanel view) {
    this.view = view;

    // sorter and model
    this.tableModel = new SelectedDatesTableModel();
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
    this.view.selectedDatesTablePanel.table.setModel(tableModel);
    this.view.selectedDatesTablePanel.table.setRowSorter(sorter);
    // end of sorter and table model

    selectedActor =
        this.getContext()
            .actorOf(
                new Props(
                    new UntypedActorFactory() {
                      private static final long serialVersionUID = 1L;

                      @Override
                      public Actor create() {
                        return new SelectedDatesContainerActor();
                      }
                    }),
                "selecteddatescontaineractor");

    // add the date action listiners
    for (SelectorComponent comp : this.view.selector_components.values()) {
      comp.addSelectedDatesBtnListiner(new SelectedDatesBtnListiner(comp.getComponentName()));
      comp.addRemoveSelectedDateListiner(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              if (e instanceof RemoveDateActionEvent) {
                RemoveDateActionEvent rdae = (RemoveDateActionEvent) e;
                self().tell(rdae);
              }
            }
          });
    }

    // add the controller as a listiner
    AddSelectedDatesListinerActorMessage asdlam =
        new AddSelectedDatesListinerActorMessage(getSelf());
    selectedActor.tell(asdlam);

    // schedule view updates

    /**
     * this.getContext() .system() .scheduler() .schedule(Duration.Zero(), Duration.create(2,
     * TimeUnit.SECONDS), new Runnable() { @Override public void run() { self().tell(new
     * UPDATEUI()); } });
     */

    // add the button listiner
    this.view.selectedDatesTablePanel.btnSendToMaster.addActionListener(
        new CreateTasksActionListiner());
  }
  @Override
  public void onReceive(Object msg) throws Exception {

    if (msg instanceof UpdateAllGUI) {
      updateAllGui(getSelectedDates());
    }

    if (msg instanceof AddSelectedDatesRequest) {
      AddSelectedDatesRequest gsdr = (AddSelectedDatesRequest) msg;

      SelectorComponent component = this.view.selector_components.get(gsdr.message);
      Collection<SelectedDate> dates = component.getSelectedDates();
      selectedActor.tell(new AddDatesMessage(dates));

      updateAllGui(getSelectedDates());
    }

    if (msg instanceof SetVisibleMessage) {
      javax.swing.SwingUtilities.invokeLater(
          new Runnable() {

            @Override
            public void run() {
              GUITest.showComponent(view);
            }
          });
    }

    if (msg instanceof RemoveDateActionEvent) {
      RemoveDateActionEvent rdae = (RemoveDateActionEvent) msg;

      List<SelectedDate> l = new ArrayList<SelectedDate>();
      l.add(rdae.date);
      RemoveSelectedDatesMessage rsdm = new RemoveSelectedDatesMessage(l);
      selectedActor.tell(rsdm);

      // update the componentes
      updateAllGui(getSelectedDates());
    }

    if (msg instanceof UPDATEUI) {
      // trick to get the stupid view to refresh
      Dimension size = this.view.getSize();
      size.height += 1;
      this.view.setSize(size);
      size.height -= 1;
      this.view.setSize(size);
      System.out.println("revalidate");
    }

    if (msg instanceof RemoveAllDates) {
      @SuppressWarnings("unused")
      RemoveAllDates rdae = (RemoveAllDates) msg;
      selectedActor.tell(new RemoveAllDates());
      updateAllGui(new ArrayList<SelectedDate>());
    }

    if (msg instanceof RemoveSelectedDatesMessage) {
      System.out.println("messaged was told");
      selectedActor.tell(msg);
      updateAllGui(this.getSelectedDates());
    }

    if (msg instanceof SetMaster) {
      this.master = ((SetMaster) msg).ref;
    }
  }