Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.MessageFormatter


    public void validator_with_constraint() throws Exception
    {
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        Integer five = 5;
        FormSupport fs = mockFormSupport();
View Full Code Here


    public void validator_with_constraint_and_macro() throws Exception
    {
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        Integer five = 5;
        FormSupport fs = mockFormSupport();
View Full Code Here

        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
        String message = "Formatted Message";
        AnnotationProvider ap = mockAnnotationProvider(null);
View Full Code Here

        Messages messages = mockMessages();
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("map", Map.class);
        Messages globalMessages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
        String message = "Formatted Message";

        train_getComponent(resources, field);
View Full Code Here

        return String.format("[[missing key: %s]]", key);
    }

    public MessageFormatter getFormatter(String key)
    {
        MessageFormatter result = cache.get(key);

        if (result == null)
        {
            result = buildMessageFormatter(key);
            cache.put(key, result);
View Full Code Here

    }

    @Test
    public void get_formatter()
    {
        MessageFormatter mf = messages.getFormatter("result");

        assertEquals(mf.format("great"), "The result is 'great'.");
    }
View Full Code Here

    }

    @Test
    public void formatters_are_cached()
    {
        MessageFormatter mf1 = messages.getFormatter("result");
        MessageFormatter mf2 = messages.getFormatter("result");

        assertSame(mf2, mf1);
    }
View Full Code Here

        String formValidationid = formSupport.getFormValidationId();

        Object coercedConstraintValue = computeConstraintValue(validatorType, validator, spec.getConstraintValue(),
                formValidationid, overrideId, overrideMessages);

        MessageFormatter formatter = findMessageFormatter(formValidationid, overrideId, overrideMessages, validatorType,
                validator);

        return new FieldValidatorImpl(field, coercedConstraintValue, formatter, validator, formSupport);
    }
View Full Code Here

    }

    @Override
    public MessageFormatter getFormatter(String key)
    {
        MessageFormatter result = cache.get(key);

        if (result == null)
        {
            result = buildMessageFormatter(key);
            cache.put(key, result);
View Full Code Here

{
    @Test
    public void null_value()
    {
        Field field = mockFieldWithLabel("My Field");
        MessageFormatter formatter = mockMessageFormatter();

        train_format(formatter, "{message}", "My Field");

        Html5Support html5Support = mockHtml5Support();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.MessageFormatter

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.