Package org.apache.tapestry

Examples of org.apache.tapestry.IBinding


    public ISelectedFolderSource getSelectedFolderSource()
    {
        if (m_objSelectedFolderSource == null)
        {
            IBinding objBinding = getBinding("selectedFolderSource");
            m_objSelectedFolderSource = (ISelectedFolderSource) objBinding.getObject();
        }
        return m_objSelectedFolderSource;
    }
View Full Code Here


    {
        Integer page = (Integer) cycle.getServiceParameters()[0];

        // Not rendering, so have to access the browser the hard way.

        IBinding browserBinding = getBrowserBinding();

        Browser browser = (Browser) browserBinding.getObject("browser", Browser.class);

        if (browser == null)
            throw Tapestry.createRequiredParameterException(this, "browser");

        browser.jump(page.intValue());
View Full Code Here

        ValueConverter vc = newValueConverter();

        replayControls();

        IBinding b = new AssetBinding("parameterName", vc, l, component, "fred");

        try
        {
            b.getObject();
            unreachable();
        }
        catch (BindingException ex)
        {
            assertEquals("Component Home/foo does not contain an asset named 'fred'.", ex
View Full Code Here

public class TestBindingSource extends HiveMindTestCase
{
    public void testNoPrefix()
    {
        IComponent component = (IComponent) newMock(IComponent.class);
        IBinding binding = (IBinding) newMock(IBinding.class);

        MockControl factoryControl = newControl(BindingFactory.class);
        BindingFactory factory = (BindingFactory) factoryControl.getMock();

        Location l = fabricateLocation(99);

        // Training

        factory.createBinding(component, "foo", "a literal value without a prefix", l);
        factoryControl.setReturnValue(binding);

        replayControls();

        BindingSourceImpl bs = new BindingSourceImpl();
        bs.setLiteralBindingFactory(factory);

        IBinding actual = bs.createBinding(
                component,
                "foo",
                "a literal value without a prefix",
                BindingConstants.LITERAL_PREFIX,
                l);
View Full Code Here

    }

    public void testNoPrefixWithDefault()
    {
        IComponent component = (IComponent) newMock(IComponent.class);
        IBinding binding = (IBinding) newMock(IBinding.class);

        MockControl factoryControl = newControl(BindingFactory.class);
        BindingFactory factory = (BindingFactory) factoryControl.getMock();

        Location l = fabricateLocation(99);

        // Training

        factory.createBinding(component, "foo", "an-expression", l);
        factoryControl.setReturnValue(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix(BindingConstants.OGNL_PREFIX);
        c.setFactory(factory);

        replayControls();

        BindingSourceImpl bs = new BindingSourceImpl();
        bs.setContributions(Collections.singletonList(c));
        bs.initializeService();

        IBinding actual = bs.createBinding(
                component,
                "foo",
                "an-expression",
                BindingConstants.OGNL_PREFIX,
                l);
View Full Code Here

    }

    public void testKnownPrefix()
    {
        IComponent component = (IComponent) newMock(IComponent.class);
        IBinding binding = (IBinding) newMock(IBinding.class);

        MockControl factoryControl = newControl(BindingFactory.class);
        BindingFactory factory = (BindingFactory) factoryControl.getMock();

        Location l = fabricateLocation(99);

        // Training

        factory.createBinding(component, "bar", "path part of locator", l);
        factoryControl.setReturnValue(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix("prefix");
        c.setFactory(factory);

        replayControls();

        BindingSourceImpl bs = new BindingSourceImpl();
        bs.setContributions(Collections.singletonList(c));

        bs.initializeService();

        IBinding actual = bs.createBinding(
                component,
                "bar",
                "prefix:path part of locator",
                BindingConstants.LITERAL_PREFIX,
                l);
View Full Code Here

    }

    public void testPrefixNoMatch()
    {
        IComponent component = (IComponent) newMock(IComponent.class);
        IBinding binding = (IBinding) newMock(IBinding.class);

        MockControl factoryControl = newControl(BindingFactory.class);
        BindingFactory literalFactory = (BindingFactory) factoryControl.getMock();

        BindingFactory factory = (BindingFactory) newMock(BindingFactory.class);

        Location l = fabricateLocation(99);

        // Training

        literalFactory.createBinding(component, "zip", "unknown:path part of locator", l);
        factoryControl.setReturnValue(binding);

        BindingPrefixContribution c = new BindingPrefixContribution();
        c.setPrefix("prefix");
        c.setFactory(factory);

        replayControls();

        BindingSourceImpl bs = new BindingSourceImpl();
        bs.setContributions(Collections.singletonList(c));
        bs.setLiteralBindingFactory(literalFactory);

        bs.initializeService();

        IBinding actual = bs.createBinding(
                component,
                "zip",
                "unknown:path part of locator",
                BindingConstants.LITERAL_PREFIX,
                l);
View Full Code Here

    {
        Creator creator = new Creator();
        ImageSubmit submit = (ImageSubmit) creator.newInstance(ImageSubmit.class, new Object[]
        { "tag", "clicked" });

        IBinding binding = newBinding();
        submit.setBinding("selected", binding);

        IValidationDelegate delegate = newDelegate();
        MockControl formc = newControl(IForm.class);
        IForm form = (IForm) formc.getMock();
View Full Code Here

    {
        Creator creator = new Creator();
        ImageSubmit submit = (ImageSubmit) creator.newInstance(ImageSubmit.class, new Object[]
        { "tag", "clicked" });

        IBinding binding = newBinding();
        submit.setBinding("selected", binding);
        submit.setBinding("point", binding);

        IValidationDelegate delegate = newDelegate();
        MockControl formc = newControl(IForm.class);
View Full Code Here

public class TestInsert extends BaseComponentTestCase
{
    private IBinding newBinding(Location location)
    {
        MockControl control = newControl(IBinding.class);
        IBinding binding = (IBinding) control.getMock();

        binding.getLocation();
        control.setReturnValue(location);

        return binding;
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IBinding

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.