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()); } }