Package org.apache.tapestry

Examples of org.apache.tapestry.IForm


              pageRenderSupport
                      .addBodyScript("function submitLink(form, elementId) { form._linkSubmit.value = elementId; if (form.onsubmit == null || form.onsubmit()) form.submit(); }");
              cycle.setAttribute(ATTRIBUTE_FUNCTION_NAME, this);
          }
 
          IForm form = getForm(cycle);
          String formName = form.getName();

            // one hidden field per form:
          String formHiddenFieldAttributeName = ATTRIBUTE_FUNCTION_NAME + formName;
          if (cycle.getAttribute(formHiddenFieldAttributeName) == null)
          {
View Full Code Here


     * values to be encoded in the form are provided by the {@link IPropertySelectionModel model}.
     */

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        if (form.wasPrerendered(writer, this))
            return;

        boolean rewinding = form.isRewinding();

        String name = form.getElementId(this);

        if (rewinding)
        {
            // If disabled, ignore anything that comes up from the client.

View Full Code Here

     * {@link IRequestCycle}attribute.
     */

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        if (cycle.getAttribute(ATTRIBUTE_NAME) != null)
            throw new ApplicationRuntimeException(Tapestry.getMessage("RadioGroup.may-not-nest"),
                    this, null, null);

        // It isn't enough to know whether the cycle in general is rewinding, need to know
        // specifically if the form which contains this component is rewinding.

        _rewinding = form.isRewinding();

        // Used whether rewinding or not.

        String name = form.getElementId(this);

        cycle.setAttribute(ATTRIBUTE_NAME, this);

        // When rewinding, find out which (if any) radio was selected by
        // the user.
View Full Code Here

     *
     **/

    public IForm getForm(IRequestCycle cycle)
    {
        IForm result = TapestryUtils.getForm(cycle, this);

        setForm(result);

        IValidationDelegate delegate = result.getDelegate();

        delegate.setFormComponent(this);

        return result;
    }
View Full Code Here

     * checking {@link Form#isRewinding()}.
     */

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        if (form.wasPrerendered(writer, this))
            return;

        // It isn't enough to know whether the cycle in general is rewinding, need to know
        // specifically if the form which contains this component is rewinding.

        boolean rewinding = form.isRewinding();

        // Used whether rewinding or not.

        String name = form.getElementId(this);

        if (rewinding)
        {
            if (!isDisabled())
                setValue(cycle.getParameter(name));
View Full Code Here

    }

    private IForm newForm(IValidationDelegate delegate)
    {
        MockControl control = newControl(IForm.class);
        IForm form = (IForm) control.getMock();

        form.getDelegate();
        control.setReturnValue(delegate);

        return form;
    }
View Full Code Here

    }

    public void testNoField()
    {
        IValidationDelegate delegate = new MockDelegate();
        IForm form = newForm(delegate);
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(form);

        replayControls();
View Full Code Here

        verifyControls();
    }

    public void testNoFieldOrDisplayName()
    {
        IForm form = newForm();
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(form);
        Location l = newLocation();
        IBinding binding = newBinding(l);
        IPage page = newPage();
View Full Code Here

    public void testDisplayNameFromField()
    {
        IValidationDelegate delegate = new MockDelegate();

        MockControl formc = newControl(IForm.class);
        IForm form = (IForm) formc.getMock();

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(form);
        IFormComponent field = newField("MyLabel");
        Location l = newLocation();

        FieldLabel fl = (FieldLabel) _creator.newInstance(FieldLabel.class, new Object[]
        { "location", l, "field", field });

        form.prerenderField(writer, field, l);

        form.getDelegate();
        formc.setReturnValue(delegate);

        replayControls();

        fl.render(writer, cycle);
View Full Code Here

    }

    public void testNoDisplayNameInField()
    {
        MockControl formc = newControl(IForm.class);
        IForm form = (IForm) formc.getMock();

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(form);

        MockControl fieldc = newControl(IFormComponent.class);

        IFormComponent field = (IFormComponent) fieldc.getMock();

        Location l = newLocation();
        IPage page = newPage();

        FieldLabel fl = (FieldLabel) _creator.newInstance(FieldLabel.class, new Object[]
        { "id", "label", "location", l, "field", field, "page", page, "container", page });

        form.prerenderField(writer, field, l);

        field.getDisplayName();
        fieldc.setReturnValue(null);

        field.getExtendedId();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IForm

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.