@Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(new Color(RGBBGColor[0], RGBBGColor[1], RGBBGColor[2]));
    g.fillRect(0, 0, getWidth(), getHeight());

    g.setColor(new Color(RGBColor[0], RGBColor[1], RGBColor[2]));
    g.fillRect(
        borderWidth, borderWidth, getWidth() - 2 * borderWidth, getHeight() - 2 * borderWidth);

    g.setColor(Color.BLACK);
    g.drawString(event.getDescription(), 2, 10);
  }
Esempio n. 2
0
  private Event makeEvent(Properties p, boolean fetchAlarm) {
    Event event = null;
    String id = p.getProperty("eventID");
    String start = p.getProperty("startDateTime");
    String end = p.getProperty("endDateTime");
    String location = p.getProperty("location");
    String description = p.getProperty("description");
    String isMeeting = p.getProperty("isMeeting");

    if (isMeeting.equals(BIT_FALSE)) {
      event = new Appointment();
    } else if (isMeeting.equals(BIT_TRUE)) {
      event = new Meeting();
    }
    event.setId(Integer.parseInt(id));
    event.setStartDateTime(start);
    event.setEndDateTime(end);
    event.setLocation(location);
    event.setDescription(description);
    if (fetchAlarm) {
      event.setAlarm(queryAlarm(currentUser, Integer.parseInt(id)));
    }
    event.setRoom(queryReservedRoom(Integer.parseInt(id)));
    if (event instanceof Appointment) {
      ((Appointment) event).setOwner(queryOwner(Integer.parseInt(id)));
    } else if (event instanceof Meeting) {
      ((Meeting) event).setLeader(queryOwner(Integer.parseInt(id)));
      ArrayList<User> invited = queryParticipants(Integer.parseInt(id), PARTICIPANT_STATUS_INVITED);
      ArrayList<User> accepted =
          queryParticipants(Integer.parseInt(id), PARTICIPANT_STATUS_ACCEPTED);
      ArrayList<User> declined =
          queryParticipants(Integer.parseInt(id), PARTICIPANT_STATUS_DECLINED);
      ((Meeting) event).setUsersInvited(invited);
      ((Meeting) event).setUsersAccepted(accepted);
      ((Meeting) event).setUsersDeclined(declined);
    }
    return event;
  }