Examples of PageRenderSupport


Examples of org.apache.tapestry.PageRenderSupport

        String anchor = component.getAnchor();
        ILink link = component.getLink(cycle);

        String url = link.getURL(anchor, true);

        PageRenderSupport support = TapestryUtils.getPageRenderSupport(cycle, component);

        String functionName = support.getUniqueString("popup_window");

        BodyBuilder builder = new BodyBuilder();

        builder.addln("function {0}()", functionName);
        builder.begin();
        builder.addln(
                "var newWindow = window.open({0}, {1}, {2});",
                TapestryUtils.enquote(url),
                TapestryUtils.enquote(getWindowName()),
                TapestryUtils.enquote(getFeatures()));
        builder.addln("newWindow.focus();");
        builder.end();

        support.addBodyScript(builder.toString());

        return "javascript:" + functionName + "();";
    }
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

public class PartialRenderPageRenderSupportTest extends TapestryTestCase
{
    @Test
    public void allocate_ids()
    {
        PageRenderSupport prs = new PartialRenderPageRenderSupport("");

        assertEquals(prs.allocateClientId("foo"), "foo");
        assertEquals(prs.allocateClientId("foo"), "foo_0");
    }
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

    }

    @Test
    public void allocate_ids_with_uid()
    {
        PageRenderSupport prs = new PartialRenderPageRenderSupport(":uid");

        assertEquals(prs.allocateClientId("foo"), "foo:uid");
        assertEquals(prs.allocateClientId("foo"), "foo:uid_0");

    }
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

    }

    @Test
    public void add_links_do_nothing()
    {
        PageRenderSupport prs = new PartialRenderPageRenderSupport("");

        Asset asset = mockAsset();

        replay();

        prs.addScriptLink(asset);
        prs.addClasspathScriptLink("foo/bar.js");
        prs.addStylesheetLink(asset, null);

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

public class ClientBehaviorSupportImplTest extends TapestryTestCase
{
    @Test
    public void no_changes()
    {
        PageRenderSupport support = mockPageRenderSupport();

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(support);
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

    }

    @Test
    public void add_links()
    {
        PageRenderSupport support = mockPageRenderSupport();

        JSONObject template = new JSONObject("{ zones: [], links: [['client1', 'zone1'], ['client2', 'zone2']] }");

        support.addScript(ZONE_INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(support);
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

    }

    @Test
    public void add_zones()
    {
        PageRenderSupport support = mockPageRenderSupport();

        JSONObject template = new JSONObject("{ zones: [ {div:'client1'}, {div:'client2'} ], links:[] }");

        support.addScript(ZONE_INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(support);
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

    }

    @Test
    public void zones_with_functions()
    {
        PageRenderSupport support = mockPageRenderSupport();


        JSONObject template = new JSONObject(
                "{ zones: [ {div:'client1', show:'showme'}, {div:'client2', update:'updateme'} ], links:[] }");

        support.addScript(ZONE_INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(support);
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

    }

    @Test
    public void zone_function_names_are_converted_to_lower_case()
    {
        PageRenderSupport support = mockPageRenderSupport();

        JSONObject template = new JSONObject(
                "{ zones: [ {div:'client1', show:'showme'}, {div:'client2', update:'updateme'} ], links:[] }");

        support.addScript(ZONE_INITIALIZER_STRING, template.getJSONArray("zones"), template.getJSONArray("links"));

        replay();

        ClientBehaviorSupportImpl setup = new ClientBehaviorSupportImpl(support);
View Full Code Here

Examples of org.apache.tapestry.PageRenderSupport

     * @see org.apache.tapestry.form.AbstractFormComponent#renderFormComponent(org.apache.tapestry.IMarkupWriter,
     *      org.apache.tapestry.IRequestCycle)
     */
    protected void renderFormComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, this);

        boolean disabled = isDisabled();
        DateTranslator translator = (DateTranslator) getTranslator();
        Locale locale = getPage().getLocale();
        SimpleDateFormat format = translator.getDateFormat(locale);
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.