Package org.libreplan.business.labels.entities

Examples of org.libreplan.business.labels.entities.LabelType


            orderElementDAO.save(orderLine);
        }
    }

    private void createAPairOfLabelTypes() {
        LabelType labelType_A = findOrCreate(labelTypeDAO, LabelType.class,
                labelTypeA, labelTypeA, labelTypeA);
        LabelType labelType_B = findOrCreate(labelTypeDAO, LabelType.class,
                labelTypeB, labelTypeB, labelTypeB);

        if (labelType_A.isNewObject()) {
            Label label_A1 = Label.create(labelA1, labelA1);
            Label label_A2 = Label.create(labelA2, labelA2);
            Label label_B1 = Label.create(labelB1, labelB1);

            labelType_A.addLabel(label_A1);
            labelType_A.addLabel(label_A2);
            labelType_B.addLabel(label_B1);

            labelTypeDAO.save(labelType_A);
            labelTypeDAO.save(labelType_B);
        }
    }
View Full Code Here


    private Label givenLabelStored() {
        Label label = Label.create("label-code-" + UUID.randomUUID(),
                "labelName " + UUID.randomUUID().toString());

        LabelType labelType = LabelType.create("label-type-"
                + UUID.randomUUID());
        labelType.addLabel(label);

        labelTypeDAO.save(labelType);
        labelTypeDAO.flush();
        sessionFactory.getCurrentSession().evict(labelType);
        sessionFactory.getCurrentSession().evict(label);

        labelType.dontPoseAsTransientObjectAnymore();
        label.dontPoseAsTransientObjectAnymore();
        return label;
    }
View Full Code Here

            throw new WrongValueException(txtLabelName,
                    _("cannot be empty"));
        }

        // Label does not exist, create
        final LabelType labelType = (LabelType) comboitem.getValue();
        Label label = getModel().findLabelByNameAndType(
                labelName, labelType);
        if (label == null) {
            label = addLabel(labelName, labelType);
        } else {
View Full Code Here

            this.labels = updatedLabels;
        }
    }

    private Label getLabelBy(WorkReportLabelTypeAssigment labelTypeAssigment) {
        LabelType type = labelTypeAssigment.getLabelType();
        for (Label label : labels) {
            if (label.getType().getId().equals(type.getId())) {
                return label;
            }
        }
        return null;
    }
View Full Code Here

        final WorkReportLabelTypeAssigment workReportLabelTypeAssigment = (WorkReportLabelTypeAssigment) row
                .getValue();
        Comboitem selectedItemType = ((Autocomplete) row.getFirstChild())
                .getSelectedItem();

        LabelType selectedLabelType = null;
        if (selectedItemType != null) {
            selectedLabelType = (LabelType) selectedItemType.getValue();
        }

        final Combobox comboLabels = createComboboxLabels(selectedLabelType,
View Full Code Here

                workReportLabelTypeAssigment, newPosition);
    }

    private void changeLabelType(Comboitem selectedItem,
            WorkReportLabelTypeAssigment workReportLabelTypeAssigment) {
        LabelType labelType = null;
        if (selectedItem != null) {
            labelType = (LabelType) selectedItem.getValue();
        }
        workReportLabelTypeAssigment.setLabelType(labelType);
        workReportLabelTypeAssigment.setDefaultLabel(null);
View Full Code Here

        return getFromDB(labelType.getId());
    }

    private LabelType getFromDB(Long id) {
        try {
            LabelType result = labelTypeDAO.find(id);
            reattachLabels(result);
            return result;
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

                gridLabelTypes.renderAll();

                final Rows rows = gridLabelTypes.getRows();
                for (Iterator i = rows.getChildren().iterator(); i.hasNext();) {
                    final Row row = (Row) i.next();
                    final LabelType labelType = (LabelType) row.getValue();
                    Hbox hbox = (Hbox) row.getChildren().get(2);
                    Button btnDelete = (Button) hbox.getChildren().get(1);
                    if (!canRemoveLabelType(labelType)) {
                        btnDelete.setDisabled(true);
                        btnDelete.setImage("/common/img/ico_borrar_out.png");
                        btnDelete
                                .setHoverImage("/common/img/ico_borrar_out.png");
                        btnDelete.setTooltiptext("");
                    }
                }
            }

            private boolean canRemoveLabelType(LabelType labelType) {
                boolean canRemove = true;
                if (labelType.isNewObject()) {
                    return canRemove;
                }
                // If at least one of its labels is being used by and
                // orderelement, cannot remove labelType
                for (Label each: labelType.getLabels()) {
                    if (!each.getOrderElements().isEmpty()) {
                        canRemove = false;
                        break;
                    }
                }
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);
View Full Code Here

        });
    }

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

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

TOP

Related Classes of org.libreplan.business.labels.entities.LabelType

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.