Package org.openfaces.component.input

Examples of org.openfaces.component.input.DropDownField


            "buttonImageUrl"
    };

    protected void configureInputComponent(FacesContext context, ExpressionFilter filter, UIInput inputComponent) {
        DropDownField field = (DropDownField) inputComponent;
        field.setOnchange(getFilterSubmissionScript(filter));
        field.setOnkeypress(getFilterKeyPressScript(filter));
        field.setStyle(filter.getStyle());
        field.setStyleClass(Styles.mergeClassNames(filter.getStyleClass(), "o_fullWidth"));
        field.setListStyle("font-weight: normal;");

        String rolloverItemClass = Styles.getCSSClass(context,
                filter, "background: " + DefaultStyles.getSelectionBackgroundColor() +
                        " !important; color: " + DefaultStyles.getSelectionTextColor() + " !important;", StyleGroup.selectedStyleGroup(), null);
        field.setRolloverListItemClass(rolloverItemClass);

        int childrenCount = field.getChildren().size();
        if (childrenCount != 1) {
            throw new IllegalStateException("Search component of DropDownFieldFilter should have exactly one child component - " +
                    "the DropDownItems component. children.size = " + childrenCount);
        }
        Object dropDownFieldItems = field.getChildren().get(0);
        if (!(dropDownFieldItems instanceof DropDownItems)) {
            throw new IllegalStateException("Search component of DropDownFieldFilter should have exactly one child component - " +
                    "instance of DropDownItems component. But was  - " + dropDownFieldItems.toString());
        }
        DropDownItems dropDownItems = (DropDownItems) dropDownFieldItems;
        Collection<Object> possibleValuesCollection = filter.calculateAllCriterionNames(context);
        for (Iterator<Object> criterionIterator = possibleValuesCollection.iterator(); criterionIterator.hasNext();) {
            Object criterionObj = criterionIterator.next();
            if (isEmptyItem(criterionObj)) {
                criterionIterator.remove();
            }
        }

        List<Object> availableItems = new ArrayList<Object>(possibleValuesCollection);
        List<DropDownItem> itemList = new ArrayList<DropDownItem>(availableItems.size());
        for (Object itemObj : availableItems) {
            DropDownItem item = createDropDownItem(context, itemObj);
            itemList.add(item);
        }
        DropDownItem allRecordsItem = createDropDownItem(context, null);
        String allRecordsCriterionName = filter.getAllRecordsText();
        HtmlOutputText outputText = Components.createOutputText(context, allRecordsCriterionName);
        String predefinedCriterionClass = getPredefinedCriterionClass(context, filter);
        outputText.setStyleClass(predefinedCriterionClass);
        allRecordsItem.getChildren().add(outputText);
        itemList.add(0, allRecordsItem);
        dropDownItems.setValue(itemList);
        List<UIComponent> children = field.getChildren();
        children.clear();
        children.add(dropDownItems);
    }
View Full Code Here


    private HtmlPanelGroup getPropertySelectorContainer(UIComponent rowContainer) {
        return (HtmlPanelGroup) Components.getChildBySuffix(rowContainer, PROPERTY_SELECTOR_ID_SUFFIX);
    }

    private DropDownField createPropertySelector(FacesContext context, HtmlPanelGroup propertySelectorContainer, CompositeFilter compositeFilter) {
        DropDownField propertySelector = (DropDownField) Components.createChildComponent(context, propertySelectorContainer, DropDownField.COMPONENT_TYPE, DROP_DOWN_ID_SUFFIX);
        DropDownItems dropDownItems = (DropDownItems) Components.createChildComponent(context, propertySelector, DropDownItems.COMPONENT_TYPE, DROP_DOWN_ITEMS_ID_SUFFIX);
        List<String> properties = compositeFilter.getFilterPropertiesTitles();
        dropDownItems.setValue(properties);
        propertySelector.setOnchange("O$('" + compositeFilter.getClientId(context) + "')._propertyChange(" + index + ");");
        propertySelector.setStyleClass(DEFAULT_PROPERTY_CLASS);
        propertySelector.setCustomValueAllowed(false);
        propertySelector.setSuggestionMode(SuggestionMode.ALL);
        propertySelector.setSuggestionDelay(0);
        propertySelector.setAutoComplete(true);
        return propertySelector;
    }
View Full Code Here

    private DropDownField findPropertySelector(CompositeFilter compositeFilter) {
        UIComponent rowContainer = getRowContainer(compositeFilter);
        if (rowContainer == null) return null;
        HtmlPanelGroup propertySelectorContainer = getPropertySelectorContainer(rowContainer);
        if (propertySelectorContainer == null) return null;
        DropDownField propertySelector = getPropertySelector(propertySelectorContainer);
        return propertySelector;
    }
View Full Code Here

    private HtmlPanelGroup getOperationSelectorContainer(UIComponent rowContainer) {
        return (HtmlPanelGroup) Components.getChildBySuffix(rowContainer, OPERATION_SELECTOR_ID_SUFFIX);
    }

    private DropDownField createOperationSelector(FacesContext context, HtmlPanelGroup operationSelectorContainer, CompositeFilter compositeFilter) {
        DropDownField operationSelector = (DropDownField) Components.createChildComponent(context, operationSelectorContainer, DropDownField.COMPONENT_TYPE, DROP_DOWN_ID_SUFFIX);
        Components.createChildComponent(context, operationSelector, DropDownItems.COMPONENT_TYPE, DROP_DOWN_ITEMS_ID_SUFFIX);
        operationSelector.setOnchange("O$('" + compositeFilter.getClientId(context) + "')._operationChange(" + index + ");");
        operationSelector.setConverter(compositeFilter.getConditionConverter());
        operationSelector.setStyleClass(DEFAULT_OPERATION_CLASS);
        operationSelector.setStyle("width: 100px;");
        operationSelector.setCustomValueAllowed(false);
        operationSelector.setSuggestionDelay(0);
        operationSelector.setSuggestionMode(SuggestionMode.ALL);
        operationSelector.setAutoComplete(true);
        return operationSelector;
    }
View Full Code Here

    private DropDownField findOperationSelector(CompositeFilter compositeFilter) {
        UIComponent rowContainer = getRowContainer(compositeFilter);
        if (rowContainer == null) return null;
        HtmlPanelGroup operationSelectorContainer = getOperationSelectorContainer(rowContainer);
        if (operationSelectorContainer == null) return null;
        DropDownField operationSelector = getOperationSelector(operationSelectorContainer);
        return operationSelector;
    }
View Full Code Here

        }
        HtmlPanelGroup propertySelectorContainer = getPropertySelectorContainer(rowContainer);
        if (propertySelectorContainer == null) {
            propertySelectorContainer = createPropertySelectorContainer(context, rowContainer);
        }
        DropDownField propertySelector = getPropertySelector(propertySelectorContainer);
        if (propertySelector == null) {
            propertySelector = createPropertySelector(context, propertySelectorContainer, compositeFilter);
        }
        initPropertySelector(propertySelector);
View Full Code Here

        initInverseCheckBox(inverseCheckBox);
        HtmlPanelGroup operationSelectorContainer = getOperationSelectorContainer(rowContainer);
        if (operationSelectorContainer == null) {
            operationSelectorContainer = createOperationSelectorContainer(context, rowContainer);
        }
        DropDownField operationSelector = getOperationSelector(operationSelectorContainer);
        if (operationSelector == null) {
            operationSelector = createOperationSelector(context, operationSelectorContainer, compositeFilter);
        }
        initOperationSelector(operationSelector, compositeFilter);
        return operationSelectorContainer;
View Full Code Here

    }


    public ExpressionFilterCriterion updateRowModelFromEditors(FacesContext context, CompositeFilter compositeFilter) {
        UIComponent parametersEditorContainer = findParametersEditorContainer(compositeFilter);
        DropDownField propertySelector = findPropertySelector(compositeFilter);
        if (propertySelector == null) {
            property = null;
            operation = null;
            parametersEditor = null;
            return null;
        }
        String propertyValue = (String) propertySelector.getValue();
        FilterProperty newProperty = compositeFilter.getFilterPropertyByTitle(propertyValue);
        boolean propertyModified = property == null ? newProperty != null : newProperty != null && !newProperty.getName().equals(property.getName());
        property = newProperty;
        DropDownField operationSelector = findOperationSelector(compositeFilter);
        HtmlSelectBooleanCheckbox inverseCheckBox = findInverseCheckBox(context, compositeFilter);
        if (propertyModified || property == null || operationSelector == null || inverseCheckBox == null) {
            operation = null;
            parametersEditor = null;
            return null;
        }
        FilterCondition newOperation = (FilterCondition) operationSelector.getValue();
        inverse = (Boolean) inverseCheckBox.getValue();
        boolean operationModified = newOperation == null ? operation == null : !newOperation.equals(operation);
        operation = newOperation;
        if (operation == null || parametersEditor == null) {
            parametersEditor = null;
View Full Code Here

        return (DropDownItems) Components.getChildBySuffix(dropDown, DROP_DOWN_ITEMS_ID_SUFFIX);
    }

    private DropDownField createDropDown(FacesContext context, UIComponent container) {
        clearContainer(container);
        DropDownField dropDown = (DropDownField) Components.createChildComponent(context, container, DropDownField.COMPONENT_TYPE, DROP_SOWN_ID_SUFFIX);
        dropDown.setStyleClass(FilterRow.DEFAULT_PARAMETER_CLASS);
        dropDown.setStyle("width: 145px;");
        dropDown.setMaxlength(250);

        if (filterProperty.getType() == FilterType.SELECT) {
            dropDown.setCustomValueAllowed(false);
        }
        DropDownItems dropDownItems = (DropDownItems) Components.createChildComponent(context, dropDown, DropDownItems.COMPONENT_TYPE, DROP_DOWN_ITEMS_ID_SUFFIX);
        return dropDown;
    }
View Full Code Here

    }

    public void prepare(FacesContext context, CompositeFilter compositeFilter, FilterRow filterRow, UIComponent container) {
        super.prepare(context, compositeFilter, filterRow, container);
        DropDownField dropDown = getDropDown(container);
        if (dropDown == null) {
            dropDown = createDropDown(context, container);
        }
        initDropDown(dropDown);
    }
View Full Code Here

TOP

Related Classes of org.openfaces.component.input.DropDownField

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.