Пример #1
0
  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);
    }
  }
Пример #2
0
 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());
 }
Пример #3
0
 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());
 }
Пример #4
0
 public void removeEvent(EventWindow view) {
   event.setState(CalEventType.DELETE);
   event.setSender(Singleton.getInstance().getSelf());
   view.setVisible(false);
   fireNetworkEvent(event);
 }