Package org.apache.tapestry

Examples of org.apache.tapestry.Block


    }

    @Test
    public void found_display_block_in_override()
    {
        Block block = mockBlock();
        RequestPageCache cache = mockRequestPageCache();
        BeanBlockOverrideSource overrideSource = mockBeanBlockOverrideSource();
        String datatype = "MyData";

        expect(overrideSource.hasDisplayBlock(datatype)).andReturn(true);
        expect(overrideSource.getDisplayBlock(datatype)).andReturn(block);

        replay();

        BeanBlockSource source = new BeanBlockSourceImpl(cache, overrideSource, EMPTY_CONFIGURATION);

        // Check case insensitivity while we are at it.
        assertTrue(source.hasDisplayBlock(datatype));
        Block actual = source.getDisplayBlock(datatype);

        assertSame(actual, block);

        verify();
    }
View Full Code Here


    }

    @Test
    public void found_edit_block()
    {
        Block block = mockBlock();
        RequestPageCache cache = mockRequestPageCache();
        Page page = mockPage();
        BeanBlockContribution contribution = new BeanBlockContribution("mydata", "MyPage",
                                                                       "mydisplay", true);
        Collection<BeanBlockContribution> configuration = newList(contribution);

        train_get(cache, "MyPage", page);
        train_getBlock(page, "mydisplay", block);

        replay();

        BeanBlockSource source = new BeanBlockSourceImpl(cache, createBeanBlockOverrideSource(cache), configuration);

        // Check case insensitivity while we are at it.
        Block actual = source.getEditBlock("MyData");

        assertSame(actual, block);

        verify();
    }
View Full Code Here

    }

    @Test
    public void found_edit_block_in_override()
    {
        Block block = mockBlock();
        RequestPageCache cache = mockRequestPageCache();
        BeanBlockOverrideSource overrideSource = mockBeanBlockOverrideSource();
        String datatype = "MyData";

        expect(overrideSource.getEditBlock(datatype)).andReturn(block);

        replay();

        BeanBlockSource source = new BeanBlockSourceImpl(cache, overrideSource, EMPTY_CONFIGURATION);

        Block actual = source.getEditBlock(datatype);

        assertSame(actual, block);

        verify();
    }
View Full Code Here

    }

    @Test
    public void true_test_renders_else_block()
    {
        Block block = mockBlock();

        replay();

        Unless component = new Unless();
View Full Code Here

        _propertyEditModel = _model.get(propertyName);

        _blockForProperty = null;
        _fieldForProperty = null;

        Block override = _resources.getBlockParameter(_propertyEditModel.getId());

        if (override != null)
        {
            _blockForProperty = override;
            return;
View Full Code Here

    @Inject
    private ComponentResources _gridCellResources;

    Object beginRender(MarkupWriter writer)
    {
        Block override = _resources.getBlockParameter(_model.getId() + "Cell");

        if (override != null)
            return override;

        Block builtin = _gridCellResources.findBlock(_model.getEditorType());

        if (builtin != null)
            return builtin;

        Object value = _model.getConduit().get(_row);
View Full Code Here

        queue.push(this);
    }

    public Block getBlock(String id)
    {
        Block result = findBlock(id);

        if (result == null)
            throw new BlockNotFoundException(StructureMessages.blockNotFound(_completeId, id),
                    getLocation());
View Full Code Here

        queue.push(this);
    }

    public Block getBlock(String id)
    {
        Block result = findBlock(id);

        if (result == null)
            throw new BlockNotFoundException(StructureMessages.blockNotFound(_completeId, id),
                    getLocation());
View Full Code Here

public class BlockBindingFactory implements BindingFactory
{
    public Binding newBinding(String description, ComponentResources container,
            ComponentResources component, String expression, Location location)
    {
        Block block = container.getBlock(expression);

        return new LiteralBinding(description, block, location);
    }
View Full Code Here

    @Inject
    private ComponentResources _gridCellResources;

    Object beginRender(MarkupWriter writer)
    {
        Block override = _resources.getBlockParameter(_model.getId() + "Cell");

        if (override != null)
            return override;

        Block builtin = _gridCellResources.findBlock(_model.getDataType());

        if (builtin != null)
            return builtin;

        Object value = _model.getConduit().get(_row);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.Block

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.