Package javax.faces.component

Examples of javax.faces.component.UIInput


    public Object getInputFieldValue(final InjectionPoint ip) {
        Object result = null;

        if (isInitialized()) {
            String id = getFieldId(ip);
            UIInput component = findComponent(id, id);
            components.put(id, component);

            if (component.isLocalValueSet()) {
                result = component.getValue();
            } else {
                Converter converter = component.getConverter();
                if (converter != null) {
                    result = converter.getAsObject(context, component, (String) component.getSubmittedValue());
                } else {
                    result = component.getSubmittedValue();
                }
            }

        }
View Full Code Here


    @Dependent
    public InputElement produceInputElement(final InjectionPoint ip) {
        if (isInitialized()) {
            String id = ip.getMember().getName();

            UIInput component = findComponent(id, id);
            components.put(id, component);

            InputElement inputElementResult = new InputElement(id, component.getClientId(context), component);

            if (component.isLocalValueSet()) {
                inputElementResult.setValue(component.getValue());
            } else {
                Converter converter = component.getConverter();
                if (converter != null) {
                    Object value = converter.getAsObject(context, component, (String) component.getSubmittedValue());
                    inputElementResult.setValue(value);
                } else {
                    inputElementResult.setValue(component.getSubmittedValue());
                }
            }
            return inputElementResult;
        }
        return null;
View Full Code Here

                if (mapping.size() > 1) {
                    clientInputId = mapping.get(1);
                }

                UIInput component = findComponent(aliasFieldName, clientInputId);
                components.put(aliasFieldName, component);
            }
        }
    }
View Full Code Here

    @Test
    public void testDefaultValue() throws Exception {
        SavedState state = new SavedState();
        checkDefaultState(state);

        SavedState inputState = new SavedState(new UIInput());
        checkDefaultState(inputState);

        SavedState formState = new SavedState(new UIForm());
        checkDefaultState(formState);
View Full Code Here

        assertTrue(form.isSubmitted());
    }

    @Test
    public void testInputConstructor() {
        UIInput input = new UIInput();

        input.setValid(false);
        input.setSubmittedValue("submitted");
        input.setValue("value");
        input.setLocalValueSet(true);

        SavedState inputState = new SavedState(input);

        assertFalse(inputState.isValid());
        assertEquals("submitted", inputState.getSubmittedValue());
View Full Code Here

        state.setValid(false);
        state.setSubmittedValue("submitted");
        state.setValue("value");
        state.setLocalValueSet(true);

        UIInput input = new UIInput();
        state.apply(input);

        assertFalse(input.isValid());
        assertEquals("submitted", input.getSubmittedValue());
        assertEquals("value", input.getValue());
        assertTrue(input.isLocalValueSet());
    }
View Full Code Here

    }

    public static String getInputValue(FacesContext context, UIComponent component,
        ConverterLookupStrategy converterLookupStrategy) throws ConverterException {

        UIInput input = (UIInput) component;
        String submittedValue = (String) input.getSubmittedValue();

        if (submittedValue != null) {
            return submittedValue;
        }

        Object value = input.getValue();
        Converter converter = converterLookupStrategy.getConverterByValue(context, input, value);

        if (converter != null) {
            return converter.getAsString(context, input, value);
        } else {
View Full Code Here

        Facelet at = f.getFacelet("validator.xml");

        UIViewRoot root = faces.getViewRoot();
        at.apply(faces, root);
       
        UIInput input = (UIInput) root.findComponent("form:input");
       
        assertNotNull("input", input);
       
        assertEquals("input validator", 1, input.getValidators().length);
       
        Validator v = input.getValidators()[0];
       
        v.validate(faces, input, "4333");
    }
View Full Code Here

        Facelet at = f.getFacelet("validateDoubleRange.xml");

        UIViewRoot root = faces.getViewRoot();
        at.apply(faces, root);
       
        UIInput input = (UIInput) root.findComponent("form:input");
       
        assertNotNull("input", input);
       
        assertEquals("input validator", 1, input.getValidators().length);
       
        Validator v = input.getValidators()[0];
       
        v.validate(faces, input, new Double(1.8));
    }
View Full Code Here

        Facelet at = f.getFacelet("validateLength.xml");

        UIViewRoot root = faces.getViewRoot();
        at.apply(faces, root);
       
        UIInput input = (UIInput) root.findComponent("form:input");
       
        assertNotNull("input", input);
       
        assertEquals("input validator", 1, input.getValidators().length);
       
        Validator v = input.getValidators()[0];
       
        v.validate(faces, input, "beans");
    }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIInput

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.