Package org.libreplan.web.common.components

Examples of org.libreplan.web.common.components.Autocomplete


        ourCompanyPassword = (Textbox) editWindow
                .getFellow("ourCompanyPassword");
    }

    private void clearAutocompleteUser() {
        Autocomplete user = (Autocomplete) editWindow.getFellowIfAny("user");
        if (user != null) {
            user.clear();
        }
    }
View Full Code Here


        return (List<Criterion>) unit.getRequiredCriterions();
    }

    public void addWorkerAssignment(MachineWorkersConfigurationUnit unit,
            Component c) {
        Autocomplete a = (Autocomplete) c.getPreviousSibling();
        Worker worker = (Worker) a.getItemByText(a.getValue());
        if (worker == null) {
            messages.showMessage(Level.ERROR, _("No worker selected"));
        } else {
            machineModel.addWorkerAssigmentToConfigurationUnit(unit, worker);
            Util.reloadBindings(c.getNextSibling());
View Full Code Here

        });
    }

    private Autocomplete createComboboxLabelTypes(
            WorkReportLabelTypeAssigment workReportLabelTypeAssigment) {
        Autocomplete comboLabelTypes = new Autocomplete();
        comboLabelTypes.setButtonVisible(true);

        final Set<LabelType> listLabelType = getMapLabelTypes().keySet();
        for (LabelType labelType : listLabelType) {
            Comboitem comboItem = new Comboitem();
            comboItem.setValue(labelType);
            comboItem.setLabel(labelType.getName());
            comboItem.setParent(comboLabelTypes);

            if ((workReportLabelTypeAssigment.getLabelType() != null)
                    && (workReportLabelTypeAssigment.getLabelType()
                            .equals(labelType))) {
                comboLabelTypes.setSelectedItem(comboItem);
            }
        }
        return comboLabelTypes;
    }
View Full Code Here

        return comboLabelTypes;
    }

    private Autocomplete createComboboxLabels(LabelType labelType,
            WorkReportLabelTypeAssigment workReportLabelTypeAssigment) {
        Autocomplete comboLabels = new Autocomplete();
        comboLabels.setButtonVisible(true);

        if (labelType != null) {
            final List<Label> listLabel = this.getMapLabelTypes()
                    .get(labelType);
            for (Label label : listLabel) {
                Comboitem comboItem = new Comboitem();
                comboItem.setValue(label);
                comboItem.setLabel(label.getName());
                comboItem.setParent(comboLabels);

                if ((workReportLabelTypeAssigment.getDefaultLabel() != null)
                        && (workReportLabelTypeAssigment.getDefaultLabel()
                                .equals(label))) {
                    comboLabels.setSelectedItem(comboItem);
                }
            }
        }
        return comboLabels;
    }
View Full Code Here

     * Append a Autocomplete @{link CostCategory} to row
     *
     * @param row
     */
    private void appendAutocompleteType(final Row row) {
        final Autocomplete autocomplete = new Autocomplete();
        autocomplete.setAutodrop(true);
        autocomplete.applyProperties();
        autocomplete.setFinder("CostCategoryFinder");
        autocomplete.setConstraint("no empty:" + _("A category must be selected"));

        // Getter, show type selected
        if (getCostCategory(row) != null) {
            autocomplete.setSelectedItem(getCostCategory(row));
        }

        // Setter, set type selected to HourCost.type
        autocomplete.addEventListener("onSelect", new EventListener() {

            @Override
            public void onEvent(Event event) {
                final Comboitem comboitem = autocomplete.getSelectedItem();

                if(comboitem != null) {
                    // Update resourcesCostCategoryAssignment
                    ResourcesCostCategoryAssignment assignment =
                        (ResourcesCostCategoryAssignment) row.getValue();
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() {
            @Override
            public void onEvent(Event event) {
                if (comboLabels.getSelectedItem() != null) {
                    Label newLabel = (Label) comboLabels.getSelectedItem()
                            .getValue();
                    workReportModel.changeLabelInWorkReportLine(currentLabel,
                            newLabel, line);
                }
                reloadWorkReportLines();
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() {
            @Override
            public void onEvent(Event event) {
                if(comboLabels.getSelectedItem() != null){
                    Label newLabel = (Label) comboLabels.getSelectedItem()
                            .getValue();
                    workReportModel.changeLabelInWorkReport(currentLabel,
                            newLabel);
                }
                Util.reloadBindings(headingFieldsAndLabels);
View Full Code Here

            }
        });
    }

    private Autocomplete createAutocompleteLabels(LabelType labelType,Label selectedLabel) {
        Autocomplete comboLabels = new Autocomplete();
        comboLabels.setButtonVisible(true);
        comboLabels.setWidth("100px");

        if (labelType != null) {
            final List<Label> listLabel = getMapLabelTypes()
                    .get(labelType);

            for (Label label : listLabel) {
                Comboitem comboItem = new Comboitem();
                comboItem.setValue(label);
                comboItem.setLabel(label.getName());
                comboItem.setParent(comboLabels);

                if ((selectedLabel != null)
                        && (selectedLabel.equals(label))) {
                    comboLabels.setSelectedItem(comboItem);
                }
            }
        }
        return comboLabels;
    }
View Full Code Here

        if (getWorkReportType().getResourceIsSharedInLines()) {
            if (!validateWorkReport()) {
                return false;
            }
        } else if (workReportLine.getResource() == null) {
            Autocomplete autoResource = getTextboxResource(row);
            if (autoResource != null) {
                String message = _("cannot be empty");
                showInvalidMessage(autoResource, message);
            }
            return false;
View Full Code Here

        return ((CriterionDTO) listitem.getValue()).getCriterion()
                .getCostCategory();
    }

    private Autocomplete appendAutocompleteType(final Treeitem row) {
        final Autocomplete autocomplete = new Autocomplete();
        autocomplete.setAutodrop(true);
        autocomplete.applyProperties();
        autocomplete.setFinder("CostCategoryFinder");

        // Getter, show type selected
        if (getCostCategory(row) != null) {
            autocomplete.setSelectedItem(getCostCategory(row));
        }

        // Setter, set type selected to HourCost.type
        autocomplete.addEventListener("onSelect", new EventListener() {

            @Override
            public void onEvent(Event event) {
                final Comboitem comboitem = autocomplete.getSelectedItem();

                if (comboitem != null) {
                    // Update resourcesCostCategoryAssignment
                    CriterionDTO assignment = (CriterionDTO) row
                            .getValue();
                    assignment.getCriterion().setCostCategory(
                            (CostCategory) comboitem
                            .getValue());
                    row.setValue(assignment);
                }
            }
        });

        autocomplete.addEventListener("onBlur", new EventListener() {

            @Override
            public void onEvent(Event event) {
                if (autocomplete.getText().isEmpty()) {
                    autocomplete.clear();
                    CriterionDTO assignment = (CriterionDTO) row.getValue();
                    assignment.getCriterion().setCostCategory(null);
                }
            }
        });
View Full Code Here

TOP

Related Classes of org.libreplan.web.common.components.Autocomplete

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.