Package org.apache.tapestry.form

Examples of org.apache.tapestry.form.TranslatedFieldSupport


        IEngine cengine = newMock(IEngine.class);
        ILink link = newMock(ILink.class);
        IScript script = newMock(IScript.class);
        PageRenderSupport prs = newMock(PageRenderSupport.class);

        TranslatedFieldSupport translator = newMock(TranslatedFieldSupport.class);
        ValidatableFieldSupport validator = newMock(ValidatableFieldSupport.class);

        IValidationDelegate delegate = new ValidationDelegate();
        IForm form = newMock(IForm.class);
        IMarkupWriter writer = newBufferWriter();

        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "input",
                                   "name", "suggest",
                                   "clientId", "suggest",
                                   "form", form,
                                   "translatedFieldSupport", translator,
                                   "validatableFieldSupport", validator,
                                   "engineService", engine,
                                   "script", script);

        expect(cycle.isRewinding()).andReturn(false).anyTimes();
        expect(resp.isDynamic()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();

        expect(form.wasPrerendered(writer, comp)).andReturn(false).anyTimes();
        expect(form.getDelegate()).andReturn(delegate).anyTimes();
        expect(form.getElementId(comp)).andReturn("suggest");
        expect(form.isRewinding()).andReturn(false).anyTimes();

        form.setFormFieldUpdating(true);
       
        expect(translator.format(comp, null)).andReturn("r2d2");
        translator.renderContributions(comp, writer, cycle);
        validator.renderContributions(comp, writer, cycle);

        expect(cycle.getEngine()).andReturn(cengine);
        expect(cengine.getOutputEncoding()).andReturn("utf-8");
        expect(engine.getLink(eq(false), isA(DirectServiceParameter.class))).andReturn(link);
View Full Code Here


        IEngine cengine = newMock(IEngine.class);
        ILink link = newMock(ILink.class);
        IScript script = newMock(IScript.class);
        PageRenderSupport prs = newMock(PageRenderSupport.class);

        TranslatedFieldSupport translator = newMock(TranslatedFieldSupport.class);
        ValidatableFieldSupport validator = newMock(ValidatableFieldSupport.class);

        IValidationDelegate delegate = new ValidationDelegate();
        IForm form = newMock(IForm.class);
        IMarkupWriter writer = newBufferWriter();

        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "textarea",
                                   "name", "suggest",
                                   "clientId", "suggest",
                                   "form", form,
                                   "translatedFieldSupport", translator,
                                   "validatableFieldSupport", validator,
                                   "engineService", engine,
                                   "script", script);

        expect(cycle.isRewinding()).andReturn(false).anyTimes();
        expect(resp.isDynamic()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();

        expect(form.wasPrerendered(writer, comp)).andReturn(false).anyTimes();
        expect(form.getDelegate()).andReturn(delegate).anyTimes();
        expect(form.getElementId(comp)).andReturn("suggest");
        expect(form.isRewinding()).andReturn(false).anyTimes();

        form.setFormFieldUpdating(true);

        expect(translator.format(comp, null)).andReturn("r2d2");
        translator.renderContributions(comp, writer, cycle);
        validator.renderContributions(comp, writer, cycle);

        expect(cycle.getEngine()).andReturn(cengine);
        expect(cengine.getOutputEncoding()).andReturn("utf-8");
        expect(engine.getLink(eq(false), isA(DirectServiceParameter.class))).andReturn(link);
View Full Code Here

    {
        IRequestCycle cycle = newMock(IRequestCycle.class);
        checkOrder(cycle, false);
        ResponseBuilder resp = newMock(ResponseBuilder.class);

        TranslatedFieldSupport translator = newMock(TranslatedFieldSupport.class);
        ValidatableFieldSupport validator = newMock(ValidatableFieldSupport.class);

        IValidationDelegate delegate = new ValidationDelegate();
        IForm form = new MockForm(delegate);
        IMarkupWriter writer = newBufferWriter();

        IBinding binding = newMock(IBinding.class);
        Location l = newLocation();
        ComponentSpecification spec = new ComponentSpecification();
       
        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "input",
                                   "name", "suggest",
                                   "clientId", "suggest",
                                   "form", form,
                                   "translatedFieldSupport", translator,
                                   "validatableFieldSupport", validator,
                                   "options", "{thisisinvalid:true",
                                   "specification", spec);

        expect(cycle.isRewinding()).andReturn(false).anyTimes();
        expect(resp.isDynamic()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();

        expect(translator.format(comp, null)).andReturn("r2d2");
        translator.renderContributions(comp, writer, cycle);
        validator.renderContributions(comp, writer, cycle);

        expect(binding.getObject()).andReturn("{thisisinvalid:true");
        expect(binding.getLocation()).andReturn(l);
View Full Code Here

        IEngine cengine = newMock(IEngine.class);
        ILink link = newMock(ILink.class);
        IScript script = newMock(IScript.class);
        PageRenderSupport prs = newMock(PageRenderSupport.class);

        TranslatedFieldSupport translator = newMock(TranslatedFieldSupport.class);
        ValidatableFieldSupport validator = newMock(ValidatableFieldSupport.class);

        IValidationDelegate delegate = new ValidationDelegate();
        IForm form = newMock(IForm.class);
        IMarkupWriter writer = newBufferWriter();

        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "input",
                                   "name", "suggest",
                                   "clientId", "suggest",
                                   "form", form,
                                   "translatedFieldSupport", translator,
                                   "validatableFieldSupport", validator,
                                   "engineService", engine,
                                   "script", script);

        expect(cycle.isRewinding()).andReturn(false).anyTimes();
        expect(resp.isDynamic()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();

        expect(form.wasPrerendered(writer, comp)).andReturn(false).anyTimes();
        expect(form.getDelegate()).andReturn(delegate).anyTimes();
        expect(form.getElementId(comp)).andReturn("suggest");
        expect(form.isRewinding()).andReturn(false).anyTimes();

        form.setFormFieldUpdating(true);
       
        expect(translator.format(comp, null)).andReturn("r2d2");
        translator.renderContributions(comp, writer, cycle);
        validator.renderContributions(comp, writer, cycle);

        expect(cycle.getEngine()).andReturn(cengine);
        expect(cengine.getOutputEncoding()).andReturn("utf-8");
        expect(engine.getLink(eq(false), isA(DirectServiceParameter.class))).andReturn(link);
View Full Code Here

        IEngine cengine = newMock(IEngine.class);
        ILink link = newMock(ILink.class);
        IScript script = newMock(IScript.class);
        PageRenderSupport prs = newMock(PageRenderSupport.class);

        TranslatedFieldSupport translator = newMock(TranslatedFieldSupport.class);
        ValidatableFieldSupport validator = newMock(ValidatableFieldSupport.class);

        IValidationDelegate delegate = new ValidationDelegate();
        IForm form = newMock(IForm.class);
        IMarkupWriter writer = newBufferWriter();

        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "textarea",
                                   "name", "suggest",
                                   "clientId", "suggest",
                                   "form", form,
                                   "translatedFieldSupport", translator,
                                   "validatableFieldSupport", validator,
                                   "engineService", engine,
                                   "script", script,
                                   "options", "{afterUpdateElement:myapp.processUpdate,other:other}");

        expect(cycle.isRewinding()).andReturn(false).anyTimes();
        expect(resp.isDynamic()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();

        expect(form.wasPrerendered(writer, comp)).andReturn(false).anyTimes();
        expect(form.getDelegate()).andReturn(delegate).anyTimes();
        expect(form.getElementId(comp)).andReturn("suggest");
        expect(form.isRewinding()).andReturn(false).anyTimes();

        form.setFormFieldUpdating(true);

        expect(translator.format(comp, null)).andReturn("r2d2");
        translator.renderContributions(comp, writer, cycle);
        validator.renderContributions(comp, writer, cycle);

        expect(cycle.getEngine()).andReturn(cengine);
        expect(cengine.getOutputEncoding()).andReturn("utf-8");
        expect(engine.getLink(eq(false), isA(DirectServiceParameter.class))).andReturn(link);
View Full Code Here

    {
        IRequestCycle cycle = newMock(IRequestCycle.class);
        checkOrder(cycle, false);
        ResponseBuilder resp = newMock(ResponseBuilder.class);

        TranslatedFieldSupport translator = newMock(TranslatedFieldSupport.class);
        ValidatableFieldSupport validator = newMock(ValidatableFieldSupport.class);

        IValidationDelegate delegate = new ValidationDelegate();
        IForm form = new MockForm(delegate);
        IMarkupWriter writer = newBufferWriter();

        IBinding binding = newMock(IBinding.class);
        Location l = newLocation();
        ComponentSpecification spec = new ComponentSpecification();
       
        Suggest comp = newInstance(Suggest.class,
                                   "response", resp,
                                   "templateTagName", "input",
                                   "name", "suggest",
                                   "clientId", "suggest",
                                   "form", form,
                                   "translatedFieldSupport", translator,
                                   "validatableFieldSupport", validator,
                                   "options", "{thisisinvalid:true",
                                   "specification", spec);

        expect(cycle.isRewinding()).andReturn(false).anyTimes();
        expect(resp.isDynamic()).andReturn(false);
        expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(form).anyTimes();

        expect(translator.format(comp, null)).andReturn("r2d2");
        translator.renderContributions(comp, writer, cycle);
        validator.renderContributions(comp, writer, cycle);

        expect(binding.getObject()).andReturn("{thisisinvalid:true");
        expect(binding.getLocation()).andReturn(l);
View Full Code Here

{

    public void test_Render()
    {
        ValidatableFieldSupport vfs = newMock(ValidatableFieldSupport.class);
        TranslatedFieldSupport tfs = newMock(TranslatedFieldSupport.class);

        DateTranslator translator = new DateTranslator();
        translator.setPattern("hh:mm a");
        ResponseBuilder resp = newMock(ResponseBuilder.class);

        IRequestCycle cycle = newMock(IRequestCycle.class);
        IForm form = newMock(IForm.class);
        checkOrder(form, false);
        IPage page = newPage();
        Locale locale = Locale.getDefault();

        MockDelegate delegate = new MockDelegate();

        IScript script = newMock(IScript.class);

        Date dtValue = new Date();

        GTimePicker component = newInstance(GTimePicker.class,
                                            "name", "fred",
                                            "script", script,
                                            "validatableFieldSupport", vfs,
                                            "translatedFieldSupport", tfs,
                                            "translator", translator,
                                            "value", dtValue,
                                            "page", page);

        expect(cycle.renderStackPush(component)).andReturn(component);
        expect(form.getName()).andReturn("testform").anyTimes();

        form.setFormFieldUpdating(true);

        IMarkupWriter writer = newBufferWriter();

        trainGetForm(cycle, form);
        trainWasPrerendered(form, writer, component, false);

        trainGetDelegate(form, delegate);

        delegate.setFormComponent(component);

        trainGetElementId(form, component, "fred");
        trainIsRewinding(form, false);
        expect(cycle.isRewinding()).andReturn(false).anyTimes();

        delegate.setFormComponent(component);

        expect(cycle.getResponseBuilder()).andReturn(resp).anyTimes();
        expect(resp.isDynamic()).andReturn(false).anyTimes();

        expect(tfs.format(component, dtValue)).andReturn(dtValue.toString());

        tfs.renderContributions(component, writer, cycle);
        vfs.renderContributions(component, writer, cycle);

        expect(page.getLocale()).andReturn(locale).anyTimes();

        PageRenderSupport prs = newPageRenderSupport();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.form.TranslatedFieldSupport

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.