Package org.apache.tapestry

Examples of org.apache.tapestry.IForm


    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {
        // Next few lines of code is similar to AbstractFormComponent (which, alas, extends from
        // AbstractComponent, not from BaseComponent).
        IForm form = TapestryUtils.getForm(cycle, this);

        setForm(form);

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

        IValidationDelegate delegate = form.getDelegate();

        delegate.setFormComponent(this);

        form.getElementId(this);

        if (form.isRewinding())
        {
            if (!isDisabled())
            {
                rewindFormComponent(writer, cycle);
            }
View Full Code Here


     *
     **/

    public IForm getForm(IRequestCycle cycle)
    {
        IForm result = Go.get(cycle);

        if (result == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("Postfield.must-be-contained-by-go"),
                this,
View Full Code Here

     @see org.apache.tapestry.AbstractComponent#renderComponent(IMarkupWriter, IRequestCycle)
     **/

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

        boolean rewinding = form.isRewinding();

        if (!rewinding && cycle.isRewinding())
            return;

        String name = form.getElementId(this);

        if (rewinding)
        {
            rewind(cycle);
            return;
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 = getValueBinding().getObject();

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

            String id = getElementId();
            //if we would like to test the IForm.addHiddenValue(name, externalValue) method with
            //Hidden JUnit test the following code must be default. But from the performance issue
            //I don't use the id parameter clauses. 
/*      if(id == null || id.length() == 0){
        form.addHiddenValue(name, externalValue);
            }else{
        form.addHiddenValue(name, id, externalValue);
            }
*/
      form.addHiddenValue(name, id, externalValue);
           

            return;
        }

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);

        if (!cycleRewinding)
        {
            i = Tapestry.coerceToIterator(getSourceBinding().getObject());
        }
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

     *
     **/

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

        if (delegate == null)
            throw new ApplicationRuntimeException(
                Tapestry.format(
                    "ValidField.no-delegate",
View Full Code Here

        // If not wrapped by a Body, then do nothing.

        if (body == null)
            return;

        IForm form = Form.get(cycle);

        String formName = form.getName();
        String textFieldName = getName();

        String fullName = "document." + formName + "." + textFieldName;

        body.addInitializationScript(fullName + ".focus();");
View Full Code Here

        IFormComponent field,
        Map symbols)
    {
        IEngine engine = field.getPage().getEngine();
        IScriptSource source = engine.getScriptSource();
        IForm form = field.getForm();

        Map finalSymbols = (symbols == null) ? new HashMap() : symbols;

        finalSymbols.put(FIELD_SYMBOL, field);
        finalSymbols.put(FORM_SYMBOL, form);
        finalSymbols.put(VALIDATOR_SYMBOL, this);

        IResourceLocation location =
            new ClasspathResourceLocation(engine.getResourceResolver(), scriptPath);

        IScript script = source.getScript(location);

        Body body = Body.get(cycle);

        if (body == null)
            throw new ApplicationRuntimeException(
                Tapestry.getMessage("ValidField.must-be-contained-by-body"),
                field,
                null,
                null);

        script.execute(cycle, body, finalSymbols);

        String functionName = (String) finalSymbols.get(FUNCTION_SYMBOL);

        form.addEventHandler(FormEventType.SUBMIT, functionName);
    }
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.