Package org.apache.tapestry5

Examples of org.apache.tapestry5.FieldTranslator


    @Test
    public void to_client_via_translator()
    {
        Object value = new Integer(99);
        ComponentResources resources = mockComponentResources();
        FieldTranslator translator = mockFieldTranslator();
        NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();

        expect(translator.getType()).andReturn(Integer.class);

        String clientValue = "abracadabra";

        EasyMock.expect(resources.triggerEvent(EasyMock.eq(EventConstants.TO_CLIENT),
                                               EasyMock.aryEq(new Object[] {value}),
                                               EasyMock.isA(ComponentEventCallback.class))).andReturn(false);

        expect(translator.toClient(value)).andReturn(clientValue);

        replay();

        FieldValidationSupport support = new FieldValidationSupportImpl(typeCoercer);
View Full Code Here


    @Test
    public void to_client_via_event_handler() throws Exception
    {
        Object value = new Object();
        ComponentResources resources = mockComponentResources();
        FieldTranslator translator = mockFieldTranslator();
        NullFieldStrategy nullFieldStrategy = mockNullFieldStrategy();

        final String clientValue = "abracadabra";

        IAnswer answer = new IAnswer()
View Full Code Here

    @SuppressWarnings({"unchecked"})
    public void to_client_via_event_handler_returns_non_string() throws Exception
    {
        Object value = new Object();
        ComponentResources resources = mockComponentResources();
        FieldTranslator translator = mockFieldTranslator();

        IAnswer answer = new IAnswer()
        {
            @SuppressWarnings({"unchecked"})
            public Object answer() throws Throwable
View Full Code Here

    }

    @Test
    public void translate_binding()
    {
        FieldTranslator translator = mockFieldTranslator();
        FieldTranslatorSource source = newMock(FieldTranslatorSource.class);
        ComponentResources resources = mockComponentResources();
        Location l = mockLocation();

        String description = "foo bar";
View Full Code Here

    }

    @Test
    public void translate_binding()
    {
        FieldTranslator translator = mockFieldTranslator();
        FieldTranslatorSource source = newMock(FieldTranslatorSource.class);
        ComponentResources resources = mockComponentResources();
        Location l = mockLocation();

        String description = "foo bar";
View Full Code Here

    }

    @Test
    public void translate_binding()
    {
        FieldTranslator translator = mockFieldTranslator();
        FieldTranslatorSource source = newMock(FieldTranslatorSource.class);
        ComponentResources resources = mockComponentResources();
        Location l = mockLocation();

        String description = "foo bar";
View Full Code Here

        replay();

        FieldTranslatorSource source = new FieldTranslatorSourceImpl(ts, globalMessages, fs);

        FieldTranslator ft = source.createDefaultTranslator(field, "myfield", messages, locale, propertyType, ap);

        assertEquals(ft.getType(), Map.class);

        ft.render(writer);

        verify();
    }
View Full Code Here

        replay();

        FieldTranslatorSource source = new FieldTranslatorSourceImpl(ts, null, fs);

        FieldTranslator ft = source.createDefaultTranslator(field, "myfield", messages, locale, propertyType, ap);

        assertEquals(ft.getType(), Map.class);

        ft.render(writer);

        verify();
    }
View Full Code Here

        replay();

        FieldTranslatorSource source = new FieldTranslatorSourceImpl(ts, null, fs);

        FieldTranslator ft = source.createDefaultTranslator(field, "myfield", messages, locale, propertyType, ap);

        assertEquals(ft.getType(), Map.class);

        ft.render(writer);

        verify();
    }
View Full Code Here

        replay();

        FieldTranslatorSource source = new FieldTranslatorSourceImpl(ts, globalMessages, fs);

        FieldTranslator ft = source.createTranslator(resources, "map");

        assertEquals(ft.getType(), Map.class);

        ft.render(writer);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.FieldTranslator

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.