Example usage for org.joda.time LocalDateTime withMillisOfSecond

List of usage examples for org.joda.time LocalDateTime withMillisOfSecond

Introduction

In this page you can find the example usage for org.joda.time LocalDateTime withMillisOfSecond.

Prototype

public LocalDateTime withMillisOfSecond(int millis) 

Source Link

Document

Returns a copy of this datetime with the millis of second field updated.

Usage

From source file:view.schema.AssignedAllRoomsRow.java

public AssignedAllRoomsRow(String shiftName, LocalDateTime startTime, ArrayList<TimeInvestment> shifts,
        int startHour, int startMinute, int periodLengthHour, int periodLengthMinute) {

    this.shifts = shifts;
    this.startTime = startTime;
    shiftTypeLabel = new RoomTile(shiftName);

    this.setOrientation(Orientation.HORIZONTAL);

    this.getChildren().add(shiftTypeLabel);

    //Tilfj vagter til dagene p ugen. i0 = mandag, i4 = fredag.
    for (int i = 0; i < 5; i++) {
        LocalDateTime date = startTime.plusDays(i);
        date = date.withField(DateTimeFieldType.hourOfDay(), startHour);
        date = date.withField(DateTimeFieldType.minuteOfHour(), startMinute);
        //Nulstil sekunder og millisekunder (vigtigt).
        date = date.withSecondOfMinute(0);
        date = date.withMillisOfSecond(0);

        LocalDateTime endDate = new LocalDateTime(date);
        endDate = endDate.plusHours(periodLengthHour).plusMinutes(periodLengthMinute);

        ShiftTile shiftTile = new ShiftTile(
                Xray.getInstance().getTimeInvestmentControl().getShiftsInPeriod(shifts, date, endDate));
        this.getChildren().add(shiftTile);

    }/*from  w  w  w. j  a v  a 2 s  .  c o  m*/
}

From source file:view.schema.AssignedRoomRow.java

public AssignedRoomRow(Room room, ArrayList<TimeInvestment> shifts, LocalDateTime startTime, int startHour,
        int startMinute, int periodLengthHour, int periodLengthMinute) {
    this.startTime = startTime;
    this.room = room;
    this.shifts = shifts;

    roomLabel = new RoomTile(room.getRoomName());

    //Tilfj rumnavn til venstre.
    this.getChildren().add(roomLabel);

    //Tilfj vagter til dagene p ugen. i0 = mandag, i4 = fredag.
    for (int i = 0; i < 5; i++) {
        LocalDateTime date = startTime.plusDays(i);
        date = date.withField(DateTimeFieldType.hourOfDay(), startHour);
        date = date.withField(DateTimeFieldType.minuteOfHour(), startMinute);
        //Nulstil sekunder og millisekunder (vigtigt).
        date = date.withSecondOfMinute(0);
        date = date.withMillisOfSecond(0);

        LocalDateTime endDate = new LocalDateTime(date);
        endDate = endDate.plusHours(periodLengthHour).plusMinutes(periodLengthMinute);

        ShiftTile shiftTile = new ShiftTile(
                Xray.getInstance().getTimeInvestmentControl().getShiftsInPeriod(shifts, date, endDate));

        this.getChildren().add(shiftTile);
    }//from   www.  j  a  va2s  .c o m

}