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