Example usage for org.joda.time LocalDateTime getMonthOfYear

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

Introduction

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

Prototype

public int getMonthOfYear() 

Source Link

Document

Get the month of year field value.

Usage

From source file:view.popups.AssignRoomsPopup.java

@Override
public void display(String title) {
    cBDateTimeStart = new ComboBox();
    cBDateTimeEnd = new ComboBox();
    assignRooms = new PopupMenuButton("Tilfj inaktive rum i tidsperioden");
    localDateTimeObject = LocalDateTime.now();

    Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() {
        @Override//from  ww w . j a va 2  s. c  o  m
        public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) {

            return new ListCell<LocalDateTime>() {
                @Override
                public void updateItem(LocalDateTime item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!empty) {

                        String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1];
                        value = value.replaceFirst(value.substring(1, value.length()),
                                value.substring(1, value.length()).toLowerCase());

                        setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/"
                                + item.getMonthOfYear() + " - " + value);
                    }
                }

            };
        }
    };

    cBDateTimeStart.setButtonCell(cellFactory.call(null));
    cBDateTimeStart.setCellFactory(cellFactory);

    Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory2 = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() {
        @Override
        public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) {

            return new ListCell<LocalDateTime>() {
                @Override
                public void updateItem(LocalDateTime item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!empty) {
                        String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1];
                        value = value.replaceFirst(value.substring(1, value.length()),
                                value.substring(1, value.length()).toLowerCase());
                        setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/"
                                + item.getMonthOfYear() + " - " + value);
                    }
                }

            };
        }
    };

    cBDateTimeEnd.setButtonCell(cellFactory2.call(null));
    cBDateTimeEnd.setCellFactory(cellFactory2);

    setBottomHBoxPadding(15, 15, 15, 15);
    cBContainer = new VBox(20);
    cBContainer.setAlignment(Pos.CENTER);
    cBContainer.setPadding(new Insets(15, 15, 15, 15));
    super.addToCenter(cBContainer);
    cBContainer.getChildren().addAll(cBDateTimeStart, cBDateTimeEnd);
    super.getBottomHBox().getChildren().add(0, assignRooms);

    assignRooms.setOnAction(e -> {

    });
}

From source file:view.popups.shift.ShiftManualPopup.java

private void initComboboxes() {
    cWeek = new ComboBox();
    cWeek.setPrefWidth(170);//from   w  ww  .jav  a 2s.c  om

    ArrayList<LocalDateTime> mondays = getTwelveMondays();
    for (int i = 0; i < mondays.size(); i++) {
        cWeek.getItems().add(mondays.get(i));
    }

    Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() {
        @Override
        public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) {

            return new ListCell<LocalDateTime>() {
                @Override
                public void updateItem(LocalDateTime item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!empty) {
                        String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1];
                        value = value.replaceFirst(value.substring(1, value.length()),
                                value.substring(1, value.length()).toLowerCase());
                        setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/"
                                + item.getMonthOfYear() + " - " + value);
                    }
                }

            };
        }
    };

    cWeek.setButtonCell(cellFactory.call(null));
    cWeek.setCellFactory(cellFactory);

    cEmployee = new ComboBox();
    cEmployee.setPrefWidth(170);
    cEmployee.setDisable(true);

    cRoom = new ComboBox();
    cRoom.setPrefWidth(170);
    cRoom.setDisable(true);

}

From source file:view.popups.shift.ShiftPopup.java

private void initComboboxes() {

    cDate = new ComboBox();
    cDate.setPrefWidth(170);/*from ww w .j a v a 2 s. c o m*/

    LocalDateTime now = new LocalDateTime();
    now = now.withHourOfDay(0);
    now = now.withMinuteOfHour(0);
    LocalDateTime currentWeek = now;

    LocalDateTime threeMonthsForward = now.plusMonths(3);
    ArrayList<LocalDateTime> startDates = Xray.getInstance().getDatesInPeriod(currentWeek, threeMonthsForward);
    for (int i = 0; i < startDates.size(); i++) {
        if (startDates.get(i).getDayOfWeek() == 1) {
            cDate.getItems().add(startDates.get(i));
        }
    }

    Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>> cellFactory = new Callback<ListView<LocalDateTime>, ListCell<LocalDateTime>>() {
        @Override
        public ListCell<LocalDateTime> call(ListView<LocalDateTime> param) {

            return new ListCell<LocalDateTime>() {
                @Override
                public void updateItem(LocalDateTime item, boolean empty) {
                    super.updateItem(item, empty);
                    if (!empty) {
                        String value = ScheduleHeader.WEEK_DAY_NAMES[item.getDayOfWeek() - 1];
                        value = value.replaceFirst(value.substring(1, value.length()),
                                value.substring(1, value.length()).toLowerCase());
                        setText("Uge " + item.getWeekOfWeekyear() + " den " + item.getDayOfMonth() + "/"
                                + item.getMonthOfYear() + " - " + value);
                    }
                }

            };
        }
    };

    cDate.setButtonCell(cellFactory.call(null));
    cDate.setCellFactory(cellFactory);

    cEmployee = new ComboBox();
    cEmployee.setPrefWidth(170);
    cEmployee.setDisable(true);

}