Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.FormSupport


    @Test
    public void test_submit_event_fired()
    {
        Request request = mockRequest();
        final ComponentResources resources = mockComponentResources();
        FormSupport formSupport = mockFormSupport();

        String elementName = "myname";

        train_getParameter(request, Form.SUBMITTING_ELEMENT_ID, null);
        train_getParameter(request, elementName, "login");

        formSupport.defer(isA(Runnable.class));

        replay();

        Submit submit = new Submit(request);
View Full Code Here


    @Test
    public void add_zone_inside_form()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();
        FormSupport fs = mockFormSupport();

        expect(environment.peek(FormSupport.class)).andReturn(fs).atLeastOnce();

        expect(fs.getClientId()).andReturn("myform");
        expect(fs.getFormComponentId()).andReturn("MyPage.myform");

        JSONObject expected = new JSONObject(String.format(
                "{element:'client1', parameters:{'%s': 'myform', '%s': 'MyPage.myform' }}",
                RequestConstants.FORM_CLIENTID_PARAMETER, RequestConstants.FORM_COMPONENTID_PARAMETER));
View Full Code Here

        JSONObject spec = new JSONObject("element", clientId);

        addFunction(spec, "show", showFunctionName);
        addFunction(spec, "update", updateFunctionName);

        FormSupport formSupport = environment.peek(FormSupport.class);

        if (formSupport != null)
        {
            JSONObject parameters = new JSONObject(RequestConstants.FORM_CLIENTID_PARAMETER, formSupport.getClientId(),
                    RequestConstants.FORM_COMPONENTID_PARAMETER, formSupport.getFormComponentId());
            spec.put("parameters", parameters);
        }

        javascriptSupport.addInitializerCall("zone", spec);
    }
View Full Code Here

     * Renders a <div> tag and provides an override of the {@link org.apache.tapestry5.services.FormSupport}
     * environmental.
     */
    void beginRender(MarkupWriter writer)
    {
        FormSupport formSupport = environment.peekRequired(FormSupport.class);

        clientId = resources.isBound("id") ? idParameter : javascriptSupport.allocateClientId(resources);

        hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);

        Element element = writer.element(this.element, "id", clientId);

        resources.renderInformalParameters(writer);

        if (!visible)
            element.addClassName(CSSClassConstants.INVISIBLE);

        clientBehaviorSupport.addFormFragment(clientId, alwaysSubmit, show, hide);

        componentActions = new ComponentActionSink(logger, clientDataEncoder);

        // Here's the magic of environmentals ... we can create a wrapper around
        // the normal FormSupport environmental that intercepts some of the behavior.
        // Here we're setting aside all the actions inside the FormFragment so that we
        // can control whether those actions occur when the form is submitted.

        FormSupport override = new FormSupportAdapter(formSupport)
        {
            @Override
            public <T> void store(T component, ComponentAction<T> action)
            {
                componentActions.store(component, action);
View Full Code Here

        if (!visible)
            e.addClassName(CSSClassConstants.INVISIBLE);

        clientBehaviorSupport.addZone(clientId, show, update);

        FormSupport existingFormSupport = environment.peek(FormSupport.class);

        insideForm = existingFormSupport != null;

        if (insideForm)
        {
View Full Code Here

        this.defaultTracker = defaultTracker;
    }

    void setupRender()
    {
        FormSupport existing = environment.peek(FormSupport.class);

        if (existing != null)
            throw new TapestryException(messages.get("nesting-not-allowed"), existing, null);
    }
View Full Code Here

        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        Messages validationMessages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "Field Label";
View Full Code Here

        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
        String message = "Formatted Message";
View Full Code Here

        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
        String message = "Formatted Message";
View Full Code Here

        FieldComponent field = mockFieldComponent();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        TranslatorSource ts = mockTranslatorSource();
        ValidationMessagesSource vms = mockValidationMessagesSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("map", Map.class);
        Messages validationMessages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.FormSupport

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.