Esempio n. 1
0
 /**
  * Gets the start time represented in the view object
  *
  * @return the start time represented in the view object
  */
 public Timestamp getStartTime() {
   Calendar date = Calendar.getInstance();
   date.setTimeInMillis(time.getStartDate().getTime());
   date.set(Calendar.HOUR_OF_DAY, time.getStartHour());
   date.set(Calendar.MINUTE, time.getStartMinute());
   return new Timestamp(date.getTimeInMillis());
 }
Esempio n. 2
0
  /** Refreshes the textfields in the view object with current data */
  @Override
  public void refreshViewObject() {
    lblDate.setText(
        date.get(Calendar.DAY_OF_MONTH)
            + "/"
            + (date.get(Calendar.MONTH) + 1)
            + "-"
            + date.get(Calendar.YEAR));

    lblTimeEnd.setText(MyUtil.p0(time.getEndHour()) + ":" + MyUtil.p0(time.getEndMinute()));
    lblTimeStart.setText(MyUtil.p0(time.getStartHour()) + ":" + MyUtil.p0(time.getStartMinute()));
  }
Esempio n. 3
0
 /**
  * Refreshes the viewobject with new times
  *
  * @param inTime the times you want the viewObject to show
  */
 @Override
 public void timeChanged(MyTime inTime) {
   time = inTime;
   date.setTimeInMillis(inTime.getStartDate().getTime());
   lblDate.setText(
       date.get(Calendar.DAY_OF_MONTH)
           + "/"
           + (date.get(Calendar.MONTH) + 1)
           + "-"
           + date.get(Calendar.YEAR));
   lblTimeStart.setText(MyUtil.p0(time.getStartHour()) + ":" + MyUtil.p0(time.getStartMinute()));
   lblTimeEnd.setText(MyUtil.p0(time.getEndHour()) + ":" + MyUtil.p0(time.getEndMinute()));
   repaint();
 }
Esempio n. 4
0
 /**
  * Gets the end time represented in the view object
  *
  * @return the end time represented in the view object
  */
 public Timestamp getEndTime() {
   Calendar date = Calendar.getInstance();
   date.setTimeInMillis(time.getStartDate().getTime());
   if (time.getEndHour() < time.getStartHour()
       || (time.getEndHour() == time.getStartHour()
           && time.getEndMinute() < time.getStartMinute())) {
     date.set(Calendar.DAY_OF_YEAR, date.get(Calendar.DAY_OF_YEAR) + 1);
   }
   date.set(Calendar.HOUR_OF_DAY, time.getEndHour());
   date.set(Calendar.MINUTE, time.getEndMinute());
   return new Timestamp(date.getTimeInMillis());
 }
Esempio n. 5
0
  /**
   * Creates a new ViewObjectTime
   *
   * @param time the time represented in the view object
   */
  protected ViewObjectTime(MyTime time) {
    super(time);
    this.date = Calendar.getInstance();
    this.date.setTimeInMillis(time.getAlarmStartDate().getTime());
    endDate = Calendar.getInstance();

    this.time = time;
    fillData();
  }
Esempio n. 6
0
  /** fills the viewobject with nessesary data */
  protected void fillData() {
    setLayout(new BorderLayout());
    topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout());
    Font topFont = new Font("Verdana", Font.PLAIN, 50);
    JLabel lblDateString = new JLabel("Dato: ");
    lblDateString.setFont(topFont);
    lblDate =
        new JLabel(
            date.get(Calendar.DAY_OF_MONTH)
                + "/"
                + (date.get(Calendar.MONTH) + 1)
                + "-"
                + date.get(Calendar.YEAR));
    lblDate.setFont(topFont);
    topPanel.add(lblDateString);
    topPanel.add(lblDate);
    add(topPanel, BorderLayout.NORTH);

    buttomPanel = new JPanel();
    buttomPanel.setLayout(new FlowLayout());
    Font buttomFont = new Font("Verdana", Font.PLAIN, 30);

    JLabel lblStringInit = new JLabel("Fra kl ");
    lblStringInit.setFont(buttomFont);

    lblTimeStart =
        new JLabel(MyUtil.p0(time.getStartHour()) + ":" + MyUtil.p0(time.getStartMinute()));
    lblTimeStart.setFont(buttomFont);

    JLabel lblStringDevider = new JLabel(" til ");
    lblStringDevider.setFont(buttomFont);

    lblTimeEnd = new JLabel(MyUtil.p0(time.getEndHour()) + ":" + MyUtil.p0(time.getEndMinute()));
    lblTimeEnd.setFont(buttomFont);

    buttomPanel.add(lblStringInit);
    buttomPanel.add(lblTimeStart);
    buttomPanel.add(lblStringDevider);
    buttomPanel.add(lblTimeEnd);

    add(buttomPanel, BorderLayout.CENTER);
  }