Exemplo n.º 1
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());
 }
Exemplo 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()));
  }
Exemplo 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();
 }
Exemplo n.º 4
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);
  }