private boolean validateInput(EventWindow view) {
    String eventName = view.getEventNameField().getText();
    String eventDescription = view.getEventDescriptionArea().getText();

    view.getEventNameField().setBackground(eventName == null ? Singleton.RED : Singleton.GREEN);
    view.getEventDescriptionArea()
        .setBackground(eventDescription == null ? Singleton.RED : Singleton.GREEN);

    return eventName != null && eventDescription != null;
  }
  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);
    }
  }
 private void updateViews() {
   for (EventWindow view : eventViews.values()) {
     view.getEventNameField().setText(getTitle());
     view.getEventNameField().setBackground(Singleton.BACKGROUND);
     view.getEventDescriptionArea().setText(getDescription());
     view.getEventDescriptionArea().setBackground(Singleton.BACKGROUND);
     view.setParticipants(getParticipants());
     view.getStartTime().setValue(getStartDate());
     view.getStartDate().setValue(DateManagement.stripClock(getStartDate()));
     view.getDuration().setSelectedItem(getDuration());
     view.getRoomNumberField().setText(getRoom() == null ? "" : getRoom().getName());
     view.getAlert().setSelected(getAlert());
     if (getCreator() != null) view.getCreatorField().setText(getCreator().toString());
   }
 }
 private void hideAllBut(ViewType type) {
   for (EventWindow view : eventViews.values()) {
     if (view.getViewType() != type) view.setVisible(false);
   }
 }
 public void removeEvent(EventWindow view) {
   event.setState(CalEventType.DELETE);
   event.setSender(Singleton.getInstance().getSelf());
   view.setVisible(false);
   fireNetworkEvent(event);
 }
 public void updateRoom() {
   for (EventWindow view : eventViews.values())
     view.getRoomNumberField().setText(getRoom() == null ? "" : getRoom().getName());
 }
 public void updatePerticipants() {
   for (EventWindow view : eventViews.values()) {
     view.setParticipants(getParticipants());
   }
 }