Package org.libreplan.business.workreports.entities

Examples of org.libreplan.business.workreports.entities.WorkReportLine


    @DELETE
    @Path("/line/{code}/")
    @Transactional
    public Response removeWorkReportLine(@PathParam("code") String code) {
        try {
            WorkReportLine workReportLine = workReportLineDAO.findByCode(code);
            Set<OrderElement> orderElements = sumChargedEffortDAO
                    .getOrderElementsToRecalculateTimsheetDates(null,
                            Collections.singleton(workReportLine));
            sumChargedEffortDAO
                    .updateRelatedSumChargedEffortWithDeletedWorkReportLineSet(new HashSet<WorkReportLine>(
                            Arrays.asList(workReportLine)));
            workReportLineDAO.remove(workReportLine.getId());
            sumChargedEffortDAO.recalculateTimesheetData(orderElements);
            return Response.ok().build();
        } catch (InstanceNotFoundException e) {
            return Response.status(Status.NOT_FOUND).build();
        }
View Full Code Here


                if (validateWorkReport()) {
                    messagesForUser.showInvalidValues(e);
                }
            }
            if (value instanceof WorkReportLine) {
                WorkReportLine workReportLine = (WorkReportLine) invalidValue.getRootBean();
                Row row = ComponentsFinder.findRowByValue(listWorkReportLines, workReportLine);
                if (row == null) {
                    messagesForUser.showInvalidValues(e);
                } else {
                    validateWorkReportLine(row, workReportLine);
View Full Code Here

        return workReportModel.getWorkReportLines();
    }

    private void appendDateInLines(final Row row) {
        final Datebox date = new Datebox();
        final WorkReportLine line = (WorkReportLine) row.getValue();
        Util.bind(date, new Util.Getter<Date>() {

            @Override
            public Date get() {
                if (line != null) {
                    return line.getDate();
                }
                return null;
            }

        }, new Util.Setter<Date>() {

            @Override
            public void set(Date value) {
                if (line != null) {
                    line.setDate(value);
                }
            }
        });
        row.appendChild(date);
    }
View Full Code Here

        });
        row.appendChild(autocomplete);
    }

    private void changeResourceInLines(final Autocomplete autocomplete, Row row) {
        final WorkReportLine workReportLine = (WorkReportLine) row.getValue();
        final Comboitem comboitem = autocomplete.getSelectedItem();
        if ((comboitem == null) || ((Resource) comboitem.getValue() == null)) {
            workReportLine.setResource(null);
            throw new WrongValueException(autocomplete,
                    _("Please, select an item"));
        } else {
            workReportLine.setResource((Resource) comboitem.getValue());
        }
    }
View Full Code Here

            workReportLine.setResource((Resource) comboitem.getValue());
        }
    }

    private Resource getResource(Row listitem) {
        WorkReportLine workReportLine = (WorkReportLine) listitem.getValue();
        return workReportLine.getResource();
    }
View Full Code Here

     * Append a Textbox @{link Order} to row
     *
     * @param row
     */
    private void appendOrderElementInLines(Row row) {
        final WorkReportLine workReportLine = (WorkReportLine) row.getValue();

        final BandboxSearch bandboxSearch = BandboxSearch.create(
                "OrderElementBandboxFinder", getOrderElements());

        bandboxSearch.setSelectedElement(workReportLine.getOrderElement());
        bandboxSearch.setSclass("bandbox-workreport-task");
        bandboxSearch.setListboxWidth("750px");

        bandboxSearch.setListboxEventListener(Events.ON_SELECT,
                new EventListener() {
View Full Code Here

        OrderElement orderElement = (OrderElement) selectedItem.getValue();
        line.setOrderElement(orderElement);
    }

    private void appendFieldsAndLabelsInLines(final Row row){
        final WorkReportLine line = (WorkReportLine)row.getValue();
        for(Object fieldOrLabel : getFieldsAndLabelsLine(line)){
            if(fieldOrLabel instanceof DescriptionValue){
                appendNewTextbox(row, (DescriptionValue) fieldOrLabel);
            } else if (fieldOrLabel instanceof Label) {
                appendAutocompleteLabelsByTypeInLine(row,
View Full Code Here

    }

    private void appendAutocompleteLabelsByTypeInLine(Row row,
            final Label currentLabel) {
        final LabelType labelType = currentLabel.getType();
        final WorkReportLine line = (WorkReportLine) row.getValue();
        final Autocomplete comboLabels = createAutocompleteLabels(labelType,
                currentLabel);
        comboLabels.setParent(row);

        comboLabels.addEventListener(Events.ON_CHANGE, new EventListener() {
View Full Code Here

            }
        });
    }

    private void appendHoursStartAndFinish(final Row row) {
        final WorkReportLine line = (WorkReportLine) row.getValue();

        final Timebox timeStart = getNewTimebox();
        final Timebox timeFinish = getNewTimebox();

        row.appendChild(timeStart);
        row.appendChild(timeFinish);

        Util.bind(timeStart, new Util.Getter<Date>() {

            @Override
            public Date get() {
                if ((line != null) && (line.getClockStart() != null)) {
                    return line.getClockStart().toDateTimeToday().toDate();
                }
                return null;
            }

        }, new Util.Setter<Date>() {

            @Override
            public void set(Date value) {
                if (line != null) {
                    checkCannotBeHigher(timeStart, timeFinish);
                    setClock(line, timeStart, timeFinish);
                    updateEffort(row);
                }
            }

        });

        Util.bind(timeFinish, new Util.Getter<Date>() {

            @Override
            public Date get() {
                if ((line != null) && (line.getClockStart() != null)) {
                    return line.getClockFinish().toDateTimeToday().toDate();
                }
                return null;
            }

        }, new Util.Setter<Date>() {
View Full Code Here

        timeStart.setButtonVisible(true);
        return timeStart;
    }

    private void updateEffort(final Row row) {
        WorkReportLine line = (WorkReportLine) row.getValue();
        Textbox effort = getEffort(row);
        if (effort != null && line.getEffort() != null) {
            effort.setValue(line.getEffort().toFormattedString());
            effort.invalidate();
        }
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.workreports.entities.WorkReportLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.