Package org.libreplan.business.workreports.valueobjects

Examples of org.libreplan.business.workreports.valueobjects.DescriptionField


     * @param comment
     *            the description value
     */
    private void updateOrCreateDescriptionValuesAndAddToWorkReportLine(WorkReportLine workReportLine,
            String comment) {
        DescriptionField descriptionField = workReportType.getLineFields().iterator().next();

        Integer maxLenght = descriptionField.getLength();
        if (comment.length() > maxLenght) {
            comment = comment.substring(0, maxLenght - 1);
        }

        Set<DescriptionValue> descriptionValues = workReportLine
                .getDescriptionValues();
        if (descriptionValues.isEmpty()) {
            descriptionValues.add(DescriptionValue.create(
                    descriptionField.getFieldName(), comment));
        } else {
            descriptionValues.iterator().next().setValue(comment);
        }

        workReportLine.setDescriptionValues(descriptionValues);
View Full Code Here


        }
        return descriptionFields;
    }

    public void addNewDescriptionField() {
        DescriptionField descriptionField = DescriptionField.create();
        getWorkReportType().addDescriptionFieldToEndLine(descriptionField);
    }
View Full Code Here

        return result;
    }

    private Integer getIndex(Object object) {
        if (object instanceof DescriptionValue) {
            DescriptionField descriptionField = getDescriptionFieldByName(((DescriptionValue) object)
                    .getFieldName());
            return descriptionField.getPositionNumber();
        }
        if (object instanceof Label) {
            return getAssignedLabelIndex((Label) object);
        }
        if (object instanceof DescriptionField) {
View Full Code Here

        return null;
    }

    @Override
    public Integer getLength(DescriptionValue descriptionValue) {
        DescriptionField descriptionField = getDescriptionFieldByName(descriptionValue
                .getFieldName());
        return descriptionField.getLength();
    }
View Full Code Here

            }
        });
    }

    private void appendListboxPositionDescriptionField(final Row row) {
        final DescriptionField descriptionField = (DescriptionField) row
                .getValue();
        final Listbox listPosition = createListPosition();
        listPosition.setParent(row);

        if (workReportTypeModel.isHeadingDescriptionField(descriptionField)) {
View Full Code Here

            }
        });
    }

    private void appendRemoveButtonDescriptionField(final Row row) {
        final DescriptionField descriptionField = (DescriptionField) row
                .getValue();
        final Button removeButton = createRemoveButton();
        removeButton.setParent(row);

        removeButton.addEventListener(Events.ON_CLICK, new EventListener() {
View Full Code Here

        }
        return validateIndexLabelsAndFields();
    }

    private boolean validateDescriptionFields() {
        DescriptionField descriptionField = workReportTypeModel
                .validateFieldNameLineFields();
        if (descriptionField != null) {
            selectTab(tabReportStructure);
            showInvalidDescriptionFieldName(descriptionField);
            return false;
View Full Code Here

    public class DescriptionFieldRowRenderer implements RowRenderer {

        @Override
        public void render(Row row, Object data) {

            final DescriptionField descriptionField = (DescriptionField) data;
            row.setValue(descriptionField);

            if (isReadOnly()) {
                appendLabelNameDescriptionField(row);
                appendLabelLengthDescriptionField(row);
View Full Code Here

    @Test
    @Transactional
    public void checkSaveDescriptionFieldsWorkReportType() {
        WorkReportType workReportType = createValidWorkReportType();

        DescriptionField descriptionFieldHead = createValidDescriptionField();
        workReportType.addDescriptionFieldToEndHead(descriptionFieldHead);

        DescriptionField descriptionFieldLine = createValidDescriptionField();
        workReportType.addDescriptionFieldToEndLine(descriptionFieldLine);

        try {
            workReportTypeDAO.save(workReportType);
        } catch (ValidationException e) {
View Full Code Here

    @Test
    @Transactional
    public void checkIfFieldNameDescriptionFieldsIsUnique() {
        WorkReportType workReportType = createValidWorkReportType();

        DescriptionField descriptionFieldHead = createValidDescriptionField();
        descriptionFieldHead.setFieldName("A");
        workReportType.addDescriptionFieldToEndHead(descriptionFieldHead);

        DescriptionField descriptionFieldLine = createValidDescriptionField();
        descriptionFieldLine.setFieldName("A");
        workReportType.addDescriptionFieldToEndLine(descriptionFieldLine);

        try {
            workReportTypeDAO.save(workReportType);
            fail("It should throw an exception");
View Full Code Here

TOP

Related Classes of org.libreplan.business.workreports.valueobjects.DescriptionField

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.