Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.MessageFormatter


    }

    public FieldTranslator createTranslator(Field field, String overrideId, Messages overrideMessages, Locale locale,
            Translator translator)
    {
        MessageFormatter formatter = findFormatter(overrideId, overrideMessages, locale, translator);

        return new FieldTranslatorImpl(field, translator, formatter, formSupport);
    }
View Full Code Here


        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        Messages validationMessages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "Field Label";
        String message = "Woops, did it again.";
        AnnotationProvider ap = mockAnnotationProvider(null);
View Full Code Here

        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        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

        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        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

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

        train_getComponent(resources, field);
View Full Code Here

    @Test
    public void message_formatter()
    {
        Messages messages = source.getValidationMessages(Locale.ENGLISH);

        MessageFormatter formatter = messages.getFormatter("required");

        assertEquals(formatter.format("My Field"), "You must provide a value for My Field.");
    }
View Full Code Here

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

    public MessageFormatter getFormatter(final String key)
    {
        MessageFormatter result = barrier.withRead(new Invokable<MessageFormatter>()
        {
            public MessageFormatter invoke()
            {
                return cache.get(key);
            }
        });

        if (result != null) return result;

        final MessageFormatter newFormatter = buildMessageFormatter(key);

        barrier.withWrite(new Runnable()
        {
            public void run()
            {
View Full Code Here

    @Test
    public void message_formatter()
    {
        Messages messages = source.getValidationMessages(Locale.ENGLISH);

        MessageFormatter formatter = messages.getFormatter("required");

        assertEquals(formatter.format("My Field"), "You must provide a value for My Field.");
    }
View Full Code Here

{
    @Test
    public void matching_pattern() throws Exception
    {
        Field field = mockField();
        MessageFormatter formatter = mockMessageFormatter();

        replay();

        Email validator = new Email(null);
View Full Code Here

    @Test
    public void input_mismatch() throws Exception
    {
        Field field = mockField();
        MessageFormatter formatter = mockMessageFormatter();

        replay();

        Email validator = new Email(null);
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.