Package javax.faces.component

Examples of javax.faces.component.UIInput$ValueChangeListenerAdapter


    @NotNull
    public static UIInput createInputForSimpleProperty(PropertyDefinitionSimple propertyDefinitionSimple,
        PropertySimple propertySimple, ValueExpression propertyValueExpression, Integer listIndex,
        boolean isGroupConfig, boolean configReadOnly, boolean configFullyEditable, boolean prevalidate, TemplateEngine templateEngine) {
        UIInput input = createInput(propertyDefinitionSimple);

        if (propertySimple != null)
            addTitleAttribute(input, propertySimple.getStringValue());

        boolean isUnset = isUnset(propertyDefinitionSimple.isRequired(), propertySimple, isGroupConfig);
        boolean isReadOnly = isReadOnly(propertyDefinitionSimple.isReadOnly(), propertyDefinitionSimple.isRequired(),
            propertySimple, configReadOnly, configFullyEditable);

        String propertyId = PropertyIdGeneratorUtility.getIdentifier(propertySimple, listIndex);
        input.setId(propertyId);

        input.setValueExpression("value", propertyValueExpression);

        FacesComponentUtility.setUnset(input, isUnset);
        FacesComponentUtility.setReadonly(input, isReadOnly);

        addValidatorsAndConverter(input, propertyDefinitionSimple, configReadOnly, templateEngine);
View Full Code Here


    public static void putDynamicPropertyRetriever(PropertyDynamicType type, DynamicPropertyRetriever retriever) {
        DYNAMIC_PROPERTY_RETRIEVERS.put(type, retriever);
    }

    public static UIInput createInput(PropertyDefinitionSimple propertyDefinitionSimple) {
        UIInput input;
        PropertySimpleType type = (propertyDefinitionSimple != null) ? propertyDefinitionSimple.getType()
            : PropertySimpleType.STRING;
        switch (type) {
        case BOOLEAN: {
            input = createInputForBooleanProperty();
            break;
        }

        case LONG_STRING: {
            input = createInputForLongStringProperty();
            break;
        }

        case PASSWORD: {
            input = createInputForPasswordProperty();
            break;
        }

        default: {
            if (propertyDefinitionSimple != null && isEnum(propertyDefinitionSimple)) {
                input = createInputForEnumProperty(propertyDefinitionSimple);
            } else {
                input = createInputForStringProperty();
            }
        }
        }
        input.setId(UNIQUE_ID_PREFIX + UUID.randomUUID());

        if (propertyDefinitionSimple != null) {
            // It's important to set the label attribute, since we include it in our validation error messages.
            input.getAttributes().put("label", propertyDefinitionSimple.getDisplayName());

            // The below adds an inert attribute to the input that contains the name of the associated property - useful
            // for debugging (i.e. when viewing source of the page or using a JavaScript debugger).
            input.getAttributes().put("ondblclick", "//" + propertyDefinitionSimple.getName());
        }
        return input;
    }
View Full Code Here

    }

    @NotNull
    public static UIInput createInputForSimpleProperty(PropertySimple propertySimple, ValueExpression valueExpression,
        boolean readOnly) {
        UIInput input = createInputForStringProperty();
        input.setValueExpression("value", valueExpression);
        FacesComponentUtility.setReadonly(input, readOnly);
        addTitleAttribute(input, propertySimple.getStringValue());
        return input;
    }
View Full Code Here

        PropertySimple propertySimple = this.propertyMap.getSimple(propertyDefinitionDynamic.getName());
        ValueExpression propertyValueExpression = createPropertyValueExpression(propertySimple.getName(),
            this.valueExpressionFormat);

        UIInput input = null;
        if (!this.isGroup || (propertySimple.getOverride() != null && propertySimple.getOverride())) {
            // We need to create the input component ahead of when we need to add it to the component tree, since we
            // need to know the input component's id in order to render the unset control.
            input = PropertyRenderingUtility.createInputForDynamicProperty(propertyDefinitionDynamic, propertySimple,
                propertyValueExpression, getListIndex(), this.isGroup, this.config.isReadOnly(), this.config
View Full Code Here

        PropertySimple propertySimple = this.propertyMap.getSimple(propertyDefinitionSimple.getName());
        ValueExpression propertyValueExpression = createPropertyValueExpression(propertySimple.getName(),
            this.valueExpressionFormat);

        UIInput input = null;
        if (!this.isGroup || (propertySimple.getOverride() != null && propertySimple.getOverride()))
            // We need to create the input component ahead of when we need to add it to the component tree, since we
            // need to know the input component's id in order to render the unset control.
            input = PropertyRenderingUtility.createInputForSimpleProperty(propertyDefinitionSimple, propertySimple,
                propertyValueExpression, getListIndex(), this.isGroup, this.config.isReadOnly(), this.config
View Full Code Here

        FacesComponentUtility.addVerbatimText(wrapper, "</td>");

        FacesComponentUtility.addVerbatimText(wrapper, "<td class='" + OPENMAP_PROPERTY_VALUE_CELL_STYLE_CLASS + "'>");
        String expressionString = String.format(valueExpressionFormat, propertySimple.getName());
        ValueExpression valueExpression = FacesExpressionUtility.createValueExpression(expressionString, String.class);
        UIInput input = null;
        if (!this.isGroup || propertySimple.getOverride() != null && propertySimple.getOverride())
            input = PropertyRenderingUtility.createInputForSimpleProperty(propertySimple, valueExpression, this.config
                .isReadOnly());
        addPropertySimpleValue(wrapper, input, valueExpression);
        FacesComponentUtility.addVerbatimText(wrapper, "</td>");
View Full Code Here

    private void addSetAllToSameValueControls(PropertySetComponent propertySetComponent,
        PropertyDefinitionSimple propertyDefinitionSimple, HtmlPanelGroup setAllToSameValueControlPanel,
        List<PropertyInfo> propertyInfos) {
        String masterInputId = propertySetComponent.getId() + "_setAllToSameValue";
        UIInput input = PropertyRenderingUtility.createInput(propertyDefinitionSimple);
        input.setId(masterInputId);
        // NOTE: Don't add the input to the component tree yet - we'll add it a bit later.

        HtmlPanelGrid panelGrid = FacesComponentUtility.createComponent(HtmlPanelGrid.class);
        if (isOptional(propertyDefinitionSimple)) {
            panelGrid.setColumns(5);
View Full Code Here

            + CssStyleClasses.MEMBER_PROPERTY_LABEL_CELL + "'>");
        FacesComponentUtility.addOutputText(propertySetComponent, null, propertyInfo.getLabel(), null);
        FacesComponentUtility.addVerbatimText(propertySetComponent, "</td>");

        // Create the input, which is referenced by the unset control and rendered under the Value column.
        UIInput input;
        if (propertyDefinitionSimple != null)
            input = PropertyRenderingUtility.createInputForSimpleProperty(propertyDefinitionSimple, propertyInfo
                .getProperty(), propertyInfo.getPropertyValueExpression(), propertySetComponent.getListIndex(), false,
                propertySetComponent.getReadOnly(), false, true,null);
        else
View Full Code Here

{
    public String enableValidation()
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form1:number1");
        Validator[] validators = number1.getValidators();
        if (validators == null || validators.length == 0)
        {
            number1.addValidator(new LongRangeValidator(10, 1));
        }

        UIInput number2 = (UIInput)facesContext.getViewRoot().findComponent("form1:number2");
        validators = number2.getValidators();
        if (validators == null || validators.length == 0)
        {
            number2.addValidator(new LongRangeValidator(50, 20));
        }

        UIInput text = (UIInput)facesContext.getViewRoot().findComponent("form2:text");
        validators = text.getValidators();
        if (validators == null || validators.length == 0)
        {
            text.addValidator(new LengthValidator(7, 3));
        }

        return "ok";
    }
View Full Code Here

    public String disableValidation()
    {
        FacesContext facesContext = FacesContext.getCurrentInstance();

        UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form1:number1");
        Validator[] validators = number1.getValidators();
        if (validators != null)
        {
            for (int i = 0; i < validators.length; i++)
            {
                Validator validator = validators[i];
                number1.removeValidator(validator);
            }
        }

        UIInput number2 = (UIInput)facesContext.getViewRoot().findComponent("form1:number2");
        validators = number2.getValidators();
        if (validators != null)
        {
            for (int i = 0; i < validators.length; i++)
            {
                Validator validator = validators[i];
                number2.removeValidator(validator);
            }
        }

        UIInput text = (UIInput)facesContext.getViewRoot().findComponent("form2:text");
        validators = text.getValidators();
        if (validators != null)
        {
            for (int i = 0; i < validators.length; i++)
            {
                Validator validator = validators[i];
                text.removeValidator(validator);
            }
        }

        return "ok";
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIInput$ValueChangeListenerAdapter

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.