Package org.apache.tapestry

Examples of org.apache.tapestry.IForm


        Creator creator = new Creator();
        Submit submit = (Submit) creator.newInstance(Submit.class);

        IValidationDelegate delegate = newDelegate();
        MockControl formc = newControl(IForm.class);
        IForm form = (IForm) formc.getMock();
        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
        IMarkupWriter writer = newWriter();

        train(cyclec, cycle, form);

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

        delegate.setFormComponent(submit);

        trainWasPrerendered(formc, form, writer, submit, false);
View Full Code Here


        IBinding binding = newBinding();
        submit.setBinding("selected", binding);

        IValidationDelegate delegate = newDelegate();
        MockControl formc = newControl(IForm.class);
        IForm form = (IForm) formc.getMock();
        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();
        IMarkupWriter writer = newWriter();

        train(cyclec, cycle, form);

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

        delegate.setFormComponent(submit);

        trainWasPrerendered(formc, form, writer, submit, false);
View Full Code Here

    }

    public void testTriggerWithListener()
    {
        IActionListener listener = newListener();
        IForm form = newForm();
        IRequestCycle cycle = newCycle();

        Creator creator = new Creator();
        Submit submit = (Submit) creator.newInstance(Submit.class, new Object[]
        { "listener", listener, "listenerInvoker", new ListenerInvokerTerminator() });
View Full Code Here

public abstract class Button extends AbstractFormComponent
{
    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);

        boolean rewinding = form.isRewinding();

        String name = form.getElementId(this);

        if (rewinding)
        {
            return;
        }
View Full Code Here

public abstract class Hidden extends AbstractFormComponent
{

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

        String name = form.getElementId(this);

        // If the form containing the Hidden isn't rewound, then render.

        if (!formRewound)
        {
            // Optimiziation: if the page is rewinding (some other action or
            // form was submitted), then don't bother rendering.

            if (cycle.isRewinding())
                return;

            String externalValue = null;

            if (getEncode())
            {
                Object value = getValue();

                try
                {
                    externalValue = getDataSqueezer().squeeze(value);
                }
                catch (IOException ex)
                {
                    throw new ApplicationRuntimeException(ex.getMessage(), this, null, ex);
                }
            }
            else
                externalValue = (String) getBinding("value").getObject(String.class);

            String id = getElementId();

            form.addHiddenValue(name, id, externalValue);

            return;
        }

        String externalValue = cycle.getRequestContext().getParameter(name);
View Full Code Here

    public abstract IForm getForm();
    public abstract void setForm(IForm form);

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = Form.get(getPage().getRequestCycle());

        if (form == null)
            throw new ApplicationRuntimeException(
                "Palette component must be wrapped by a Form.",
                this,
                null,
                null);

        setForm(form);

        IValidationDelegate delegate = form.getDelegate();

        if (delegate != null)
            delegate.setFormComponent(this);

        setName(form.getElementId(this));

        if (form.isRewinding())
            handleSubmission(cycle);

        // Don't do any additional work if rewinding
        // (some other action or form on the page).

        if (!cycle.isRewinding())
        {
            // Lots of work to produce JavaScript and HTML for this sucker.

            _symbols = new HashMap(MAP_SIZE);

            runScript(cycle);

            // Output symbol 'formSubmitFunctionName' is the name
            // of a JavaScript function to execute when the form
            // is submitted.  This is also key to the operation
            // of the PropertySelection.

            form.addEventHandler(
                FormEventType.SUBMIT,
                (String) _symbols.get("formSubmitFunctionName"));

            constructColumns();
        }
View Full Code Here

{
    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        Iterator i = null;

        IForm form = getForm(cycle);

        boolean cycleRewinding = cycle.isRewinding();

        // If the cycle is rewinding, but not this particular form,
        // then do nothing (don't even render the body).

        if (cycleRewinding && !form.isRewinding())
            return;

        String name = form.getElementId(this);

        boolean indexBound = isParameterBound("index");

        if (!cycleRewinding)
        {
View Full Code Here

     *
     **/

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        IForm form = getForm(cycle);
   
        // Used whether rewinding or not.

        String name = form.getElementId(this);

        if (form.isRewinding())
        {
            String value = cycle.getRequestContext().getParameter(name);

            setSelected((value != null));

View Full Code Here

     * {@link IPropertySelectionModel model}.
     */

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

        boolean rewinding = form.isRewinding();

        String name = form.getElementId(this);

        List selectedList = (List) getBinding("selectedList").getObject(List.class);

        if (selectedList == null)
            throw Tapestry.createRequiredParameterException(this, "selectedList");
View Full Code Here

public abstract class FormConditional extends AbstractFormComponent
{

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

        boolean cycleRewinding = cycle.isRewinding();

        // If the cycle is rewinding, but not this particular form,
        // then do nothing (don't even render the body).

        if (cycleRewinding && !form.isRewinding())
            return;

        String name = form.getElementId(this);

        boolean condition = getCondition(cycle, form, name);

        // call listener
        IActionListener listener = getListener();
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.