public void newCalEvent(EventWindow view) {
    creator = Singleton.getInstance().getSelf();
    creator.setStatus(Person.Status.ACCEPTED);
    title = view.getEventNameField().getText();
    description = view.getEventDescriptionArea().getText();
    duration = (int) view.getDuration().getSelectedItem();

    Date date = (Date) view.getStartDate().getValue();
    Date time = (Date) view.getStartTime().getValue();
    long clock = DateManagement.getClockInSeconds(time);

    startDate = new Date(date.getTime() + clock);

    if (view.getViewType() == ViewType.UPDATE || view.getViewType() == ViewType.PARTICIPANT) {
      event
          .update(title, startDate, duration, description, room)
          .setParticipants(getParticipants());
    } else
      event =
          new CalEvent(title, startDate, duration, creator, description, room)
              .addParticipants(getParticipants());
    event
        .getParticipants()
        .get(Singleton.getInstance().getSelf().getUsername())
        .setAlert(view.getAlert().isSelected());
    if (validateInput(view)) {
      fireNetworkEvent(event);
      view.setVisible(false);
    }
  }
 public void setCalEvent(CalEvent event) {
   this.event = event;
   setTitle(event.getTitle());
   setDescription(event.getDescription());
   try {
     setAlert(
         event.getParticipants().get(Singleton.getInstance().getSelf().getUsername()).getAlert());
   } catch (Exception e) {
   }
   setDuration(event.getDuration());
   setStartDate(event.getStart());
   setParticipants(event.getParticipants());
   setCreator(event.getCreator());
   setRoom(event.getRoom());
 }
 public void updateModel(EventWindow view) {
   setTitle(event.getTitle());
   setDescription(event.getDescription());
   setAlert(
       event.getParticipants().get(Singleton.getInstance().getSelf().getUsername()).getAlert());
   setDuration(event.getDuration());
   setStartDate(event.getStart());
   setParticipants(event.getParticipants());
 }
 public void removeEvent(EventWindow view) {
   event.setState(CalEventType.DELETE);
   event.setSender(Singleton.getInstance().getSelf());
   view.setVisible(false);
   fireNetworkEvent(event);
 }