Package org.apache.tapestry5

Examples of org.apache.tapestry5.Block


            String pageName = componentClassResolver.resolvePageClassNameToPageName(pageClass);


            final Page page = this.pageCache.get(pageName);

            final Block block = page.getRootElement().getBlock(
                    contribution.getBlockId());

            result.add(block);
        }
        return result;
View Full Code Here


        return overrideSource.hasDisplayBlock(datatype) || masterSource.hasDisplayBlock(datatype);
    }

    public Block getDisplayBlock(String datatype)
    {
        Block result = overrideSource.getDisplayBlock(datatype);

        if (result == null)
            result = masterSource.getDisplayBlock(datatype);

        if (result == null)
View Full Code Here

        return result;
    }

    public Block getEditBlock(String datatype)
    {
        Block result = overrideSource.getEditBlock(datatype);

        if (result == null)
            result = masterSource.getEditBlock(datatype);

        if (result == null)
View Full Code Here

    }

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

        replay();

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

    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        Block block = mockBlock();
        Logger logger = mockLogger();

        Instantiator ins = newInstantiator(component, model);

        train_getLogger(model, logger);
View Full Code Here

    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        Block block1 = mockBlock();
        Block block2 = mockBlock();
        Logger logger = mockLogger();

        train_getLogger(model, logger);

        Instantiator ins = newInstantiator(component, model);
View Full Code Here

    }


    public Block getBlockForColumn()
    {
        Block override = overrides.getOverrideBlock(columnModel.getId() + "Header");

        if (override != null) return override;

        return standardHeader;
    }
View Full Code Here

     * Invoked from subclasses to do the rendering. The subclass controls the naming convention for locating an
     * overriding Block parameter (it is the name of the property possibly suffixed with a value).
     */
    protected Object renderPropertyValue(MarkupWriter writer, String overrideBlockId)
    {
        Block override = overrides.getOverrideBlock(overrideBlockId);

        if (override != null) return override;

        String datatype = model.getDataType();

View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void validator_with_no_constraint() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = singletonMap("required", validator);

        train_getConstraintType(validator, null);

        train_getFormValidationId(fs, "form");

        train_getComponentResources(field, resources);

        train_getId(resources, "fred");
        train_getContainerMessages(resources, containerMessages);
        train_contains(containerMessages, "form-fred-required-message", false);
        train_contains(containerMessages, "fred-required-message", false);

        train_getLocale(resources, Locale.FRENCH);

        train_getValidationMessages(messagesSource, Locale.FRENCH, messages);

        train_getMessageKey(validator, "key");
        train_getMessageFormatter(messages, "key", formatter);

        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, null);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void component_messages_overrides_validator_messages() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        FormSupport fs = mockFormSupport();

        Map<String, Validator> map = singletonMap("required", validator);

        train_getConstraintType(validator, null);

        train_getFormValidationId(fs, "form");

        train_getComponentResources(field, resources);
        train_getId(resources, "fred");
        train_getLocale(resources, Locale.ENGLISH);
        train_getContainerMessages(resources, containerMessages);

        train_contains(containerMessages, "form-fred-required-message", false);
        train_contains(containerMessages, "fred-required-message", true);

        train_getMessageFormatter(containerMessages, "fred-required-message", formatter);

        train_isRequired(validator, false);
        train_getValueType(validator, Object.class);
        validator.validate(field, null, formatter, inputValue);

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(messagesSource, coercer, fs, map, null);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.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.