コード例 #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
 private void hideAllBut(ViewType type) {
   for (EventWindow view : eventViews.values()) {
     if (view.getViewType() != type) view.setVisible(false);
   }
 }