Example usage for org.joda.time LocalDate toDateTimeAtStartOfDay

List of usage examples for org.joda.time LocalDate toDateTimeAtStartOfDay

Introduction

In this page you can find the example usage for org.joda.time LocalDate toDateTimeAtStartOfDay.

Prototype

public DateTime toDateTimeAtStartOfDay() 

Source Link

Document

Converts this LocalDate to a full datetime at the earliest valid time for the date using the default time zone.

Usage

From source file:org.libreplan.web.orders.ProjectDetailsController.java

License:Open Source License

private void calculateProjectDates(OrderTemplate template) {
    LocalDate initLocalDate = new LocalDate().plusDays(template.getStartAsDaysFromBeginning());
    Date initDate = initLocalDate.toDateTimeAtStartOfDay().toDate();
    getOrder().setInitDate(initDate);//from w  ww  .j a va 2 s .  c o  m
    this.initDate.setValue(initDate);

    if (template.getDeadlineAsDaysFromBeginning() != null) {
        LocalDate deadlineLocalDate = initLocalDate.plusDays(template.getDeadlineAsDaysFromBeginning());
        Date deadline = deadlineLocalDate.toDateTimeAtStartOfDay().toDate();
        getOrder().setDeadline(deadline);
        this.deadline.setValue(deadline);
    } else {
        getOrder().setDeadline(null);
        this.deadline.setValue(null);
    }

}

From source file:org.libreplan.web.planner.chart.ChartFiller.java

License:Open Source License

protected TimeGeometry getTimeGeometry(Interval interval) {
    LocalDate start = new LocalDate(interval.getStart());
    LocalDate finish = new LocalDate(interval.getFinish());

    TimeGeometry timeGeometry = new DefaultTimeGeometry();

    if (!isZoomByDayOrWeek()) {
        start = getThursdayOfThisWeek(start);
        finish = getThursdayOfThisWeek(finish);
    }//from   w  w w .j av a 2s  . c o  m

    timeGeometry.setMin(start.toDateTimeAtStartOfDay().toDate());
    timeGeometry.setMax(finish.toDateTimeAtStartOfDay().toDate());
    timeGeometry.setAxisLabelsPlacement("bottom");
    // Remove year separators
    timeGeometry.setGridColor("#FFFFFF");

    return timeGeometry;
}

From source file:org.libreplan.web.planner.company.CompanyPlanningModel.java

License:Open Source License

private void appendEarnedValueChartAndLegend(Tabpanel earnedValueChartPanel, Timeplot chartEarnedValueTimeplot,
        CompanyEarnedValueChartFiller earnedValueChartFiller) {

    Vbox vbox = new Vbox();
    vbox.setClass("legend-container");
    vbox.setAlign(CENTER);/*  w w  w .  j  a  v  a 2s  .  com*/
    vbox.setPack(CENTER);

    Hbox dateHbox = new Hbox();
    dateHbox.appendChild(new Label(_("Select date")));

    LocalDate initialDate = earnedValueChartFiller.initialDateForIndicatorValues();
    Datebox datebox = new Datebox(initialDate.toDateTimeAtStartOfDay().toDate());
    dateHbox.appendChild(datebox);

    appendEventListenerToDateboxIndicators(earnedValueChartFiller, vbox, datebox);
    vbox.appendChild(dateHbox);

    vbox.appendChild(getEarnedValueChartConfigurableLegend(earnedValueChartFiller, initialDate));

    Hbox hbox = new Hbox();
    hbox.setSclass("earned-value-chart");

    hbox.appendChild(vbox);

    Div div = new Div();
    div.appendChild(chartEarnedValueTimeplot);
    div.setSclass("plannergraph");

    hbox.appendChild(div);

    earnedValueChartPanel.appendChild(hbox);
}

From source file:org.libreplan.web.planner.consolidations.AdvanceConsolidationModel.java

License:Open Source License

@Override
public void initLastConsolidatedDate() {
    // Init the lastConsolidatedDate
    LocalDate consolidatedUntil = (task.getConsolidation() == null) ? null
            : task.getConsolidation().getConsolidatedUntil();

    AdvanceConsolidationDTO.lastConsolidatedDate = (consolidatedUntil == null) ? null
            : consolidatedUntil.toDateTimeAtStartOfDay().toDate();
}

From source file:org.libreplan.web.planner.order.OrderPlanningModel.java

License:Open Source License

private void appendEarnedValueChartAndLegend(Tabpanel earnedValueChartPanel, Timeplot chartEarnedValueTimeplot,
        final OrderEarnedValueChartFiller earnedValueChartFiller) {

    Vbox vbox = new Vbox();
    this.earnedValueChartLegendContainer = vbox;
    vbox.setClass("legend-container");
    vbox.setAlign(CENTER);/*from w  ww.j  ava 2  s.c o m*/
    vbox.setPack(CENTER);

    Hbox dateHbox = new Hbox();
    dateHbox.appendChild(new Label(_("Select date")));

    LocalDate initialDateForIndicatorValues = earnedValueChartFiller.initialDateForIndicatorValues();

    this.earnedValueChartLegendDatebox = new Datebox(
            initialDateForIndicatorValues.toDateTimeAtStartOfDay().toDate());

    this.earnedValueChartLegendDatebox.setConstraint(dateMustBeInsideVisualizationArea(earnedValueChartFiller));
    dateHbox.appendChild(this.earnedValueChartLegendDatebox);

    appendEventListenerToDateboxIndicators();
    vbox.appendChild(dateHbox);

    vbox.appendChild(
            getEarnedValueChartConfigurableLegend(earnedValueChartFiller, initialDateForIndicatorValues));

    Hbox hbox = new Hbox();
    hbox.setSclass("earned-value-chart");

    hbox.appendChild(vbox);

    Div div = new Div();
    div.appendChild(chartEarnedValueTimeplot);
    div.setSclass("plannergraph");
    div.setHeight("170px");

    hbox.appendChild(div);

    earnedValueChartPanel.appendChild(hbox);
}

From source file:org.libreplan.web.planner.taskedition.TaskPropertiesController.java

License:Open Source License

public void updateTaskEndDate(LocalDate endDate) {
    getGanttTaskDTO().endDate = endDate.toDateTimeAtStartOfDay().toDate();
    Util.reloadBindings(endDateBox);
}

From source file:org.libreplan.web.planner.taskedition.TaskPropertiesController.java

License:Open Source License

public void updateTaskStartDate(LocalDate newStart) {
    getGanttTaskDTO().beginDate = newStart.toDateTimeAtStartOfDay().toDate();
    Util.reloadBindings(startDateBox);
}

From source file:org.libreplan.web.resourceload.ResourceLoadModel.java

License:Open Source License

public static Date asDate(LocalDate date) {
    return date == null ? null : date.toDateTimeAtStartOfDay().toDate();
}

From source file:org.libreplan.web.resources.search.NewAllocationSelectorController.java

License:Open Source License

private static Date asDate(LocalDate date) {
    if (date == null) {
        return null;
    }/*w w  w  .j  a va2 s. co m*/

    return date.toDateTimeAtStartOfDay().toDate();
}

From source file:org.libreplan.web.resources.worker.CriterionSatisfactionDTO.java

License:Open Source License

private Date asDate(LocalDate localDate) {
    if (localDate == null) {
        return null;
    }/*www .  jav a  2s . c om*/
    return localDate.toDateTimeAtStartOfDay().toDate();
}