Examples of IPropertySpecification


Examples of org.apache.tapestry.spec.IPropertySpecification

        MockControl specc = newControl(IComponentSpecification.class);
        IComponentSpecification spec = (IComponentSpecification) specc.getMock();

        MockControl psc = newControl(IPropertySpecification.class);
        IPropertySpecification ps = (IPropertySpecification) psc.getMock();

        component.getSpecification();
        componentc.setReturnValue(spec);

        spec.getPropertySpecification("zip");
        specc.setReturnValue(ps);

        ps.getPersistence();
        psc.setReturnValue("unknown");

        source.getStrategy("unknown");
        sourcec.setThrowable(inner);

        ps.getLocation();
        psc.setReturnValue(l);

        log.error("Simulated error.", l, inner);

        replayControls();
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        pvs.applyValue(finalValue);
    }

    private void endPropertySpecification()
    {
        IPropertySpecification ps = (IPropertySpecification) peekObject();

        String initialValue = getExtendedValue(ps.getInitialValue(), "initial-value", false);

        // In the 3.0 DTD, the initial value was always an OGNL expression.
        // In the 3.1 DTD, it is a binding reference, qualified with a prefix.

        if (initialValue != null && !_DTD_3_1)
            initialValue = "ognl:" + initialValue;

        ps.setInitialValue(initialValue);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        else
            persistence = getBooleanAttribute("persistent", false) ? "session" : null;

        String initialValue = getAttribute("initial-value");

        IPropertySpecification ps = _factory.createPropertySpecification();
        ps.setName(name);

        if (HiveMind.isNonBlank(type))
            ps.setType(type);

        ps.setPersistence(persistence);
        ps.setInitialValue(initialValue);

        IComponentSpecification cs = (IComponentSpecification) peekObject();
        cs.addPropertySpecification(ps);

        push(_elementName, ps, STATE_PROPERTY, false);
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("PropertySpecifications.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInitialValue", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertEquals("type", "boolean", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertNull("type", ps.getType());

        // Starting with release 3.1, the initial value is a binding reference
        // with an appropriate prefix. In 3.0 it was always an OGNL expression.

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("type", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInitialValue");
        assertEquals("ognl:long.initial.value", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

    {
        List names = new ArrayList();
        Iterator i = propertySpecs.iterator();
        while (i.hasNext())
        {
            IPropertySpecification ps = (IPropertySpecification) i.next();

            names.add(ps.getName());
        }

        MockControl c = newControl(IComponentSpecification.class);
        IComponentSpecification result = (IComponentSpecification) c.getMock();

        result.getPropertySpecificationNames();
        c.setReturnValue(names);

        i = propertySpecs.iterator();
        while (i.hasNext())
        {
            IPropertySpecification ps = (IPropertySpecification) i.next();

            result.getPropertySpecification(ps.getName());
            c.setReturnValue(ps);
        }

        return result;
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        int count = names.size();

        for (int i = 0; i < count; i++)
        {
            String name = (String) names.get(i);
            IPropertySpecification ps = spec.getPropertySpecification(name);

            String expression = ps.getInitialValue();
            Object initialValue = null;

            // If no initial value expression is provided, then read the current
            // property of the expression.  This may be null, or may be
            // a value set in finishLoad() (via an abstract accessor).

            try
            {
                if (StringUtils.isEmpty(expression))
                {
                    initialValue = OgnlUtils.get(name, _resolver, component);
                }
                else
                {
                    // Evaluate the expression and update the property.

                    initialValue = OgnlUtils.get(expression, _resolver, component);

                    OgnlUtils.set(name, _resolver, component, initialValue);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationRuntimeException(
                    Tapestry.format(
                        "PageLoader.unable-to-initialize-property",
                        name,
                        component,
                        ex.getMessage()),
                    ps.getLocation(),
                    ex);
            }

            PageDetachListener initializer =
                new PropertyInitializer(_resolver, component, name, initialValue);
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

    {
        List names = new ArrayList();
        Iterator i = propertySpecs.iterator();
        while (i.hasNext())
        {
            IPropertySpecification ps = (IPropertySpecification) i.next();

            names.add(ps.getName());
        }

        MockControl c = newControl(IComponentSpecification.class);
        IComponentSpecification result = (IComponentSpecification) c.getMock();

        result.getPropertySpecificationNames();
        c.setReturnValue(names);

        i = propertySpecs.iterator();
        while (i.hasNext())
        {
            IPropertySpecification ps = (IPropertySpecification) i.next();

            result.getPropertySpecification(ps.getName());
            c.setReturnValue(ps);
        }

        return result;
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("PropertySpecifications.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInitialValue", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertEquals("type", "boolean", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertNull("type", ps.getType());

        // Starting with release 4.0, the initial value is a binding reference
        // with an appropriate prefix. In 3.0 it was always an OGNL expression.

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("type", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInitialValue");
        assertEquals("ognl:long.initial.value", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("Property.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInit", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());

        // In a 4.0 DTD, type is always null.
        assertNull("type", ps.getType());

        // Note that no prefix is added. Initial value will be a string literal,
        // or have a prefix and be something else.

        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInit");
        assertEquals("message:long-init-key", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("PropertySpecifications.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInitialValue", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertEquals("type", "boolean", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertNull("type", ps.getType());

        // Starting with release 4.0, the initial value is a binding reference
        // with an appropriate prefix. In 3.0 it was always an OGNL expression.

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("type", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInitialValue");
        assertEquals("ognl:long.initial.value", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.