Package org.apache.tapestry.form

Source Code of org.apache.tapestry.form.Submit

/* $$ Clover has instrumented this file $$ */// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.apache.tapestry.form;

import org.apache.tapestry.IActionListener;
import org.apache.tapestry.IBinding;
import org.apache.tapestry.IForm;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;


/**
*  Implements a component that manages an HTML <input type=submit> form element.
*
*  [<a href="../../../../../ComponentReference/Submit.html">Component Reference</a>]
*
<p>This component is generally only used when the form has multiple
*  submit buttons, and it is important for the application to know
*  which one was pressed.  You may also want to use
{@link ImageSubmit} which accomplishes much the same thing, but uses
*  a graphic image instead.
*
*
@author Howard Lewis Ship
*
**/

public abstract class Submit extends AbstractFormComponent{public static com.cortexeb.tools.clover.d __CLOVER_148_0 = com.cortexeb.tools.clover.aq.getRecorder(new char[] {67,58,92,119,111,114,107,115,112,97,99,101,92,106,97,107,97,114,116,97,45,116,97,112,101,115,116,114,121,92,102,114,97,109,101,119,111,114,107,92,116,97,114,103,101,116,92,99,108,111,118,101,114,45,100,98},1096998272901L);

    protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
    {try { __CLOVER_148_0.M[778]++;

        __CLOVER_148_0.S[3663]++;IForm form = getForm(cycle);
   
        __CLOVER_148_0.S[3664]++;boolean rewinding = form.isRewinding();

        __CLOVER_148_0.S[3665]++;String name = form.getElementId(this);

        __CLOVER_148_0.S[3666]++;if ((((rewinding) && (++__CLOVER_148_0.CT[687] != 0)) || (++__CLOVER_148_0.CF[687] == 0))){
        {
            // Don't bother doing anything if disabled.

            __CLOVER_148_0.S[3667]++;if ((((isDisabled()) && (++__CLOVER_148_0.CT[688] != 0)) || (++__CLOVER_148_0.CF[688] == 0))){
                __CLOVER_148_0.S[3668]++;return;}

            // How to know which Submit button was actually
            // clicked?  When submitted, it produces a request parameter
            // with its name and value (the value serves double duty as both
            // the label on the button, and the parameter value).

            __CLOVER_148_0.S[3669]++;String value = cycle.getRequestContext().getParameter(name);

            // If the value isn't there, then this button wasn't
            // selected.

            __CLOVER_148_0.S[3670]++;if ((((value == null) && (++__CLOVER_148_0.CT[689] != 0)) || (++__CLOVER_148_0.CF[689] == 0))){
                __CLOVER_148_0.S[3671]++;return;}

            __CLOVER_148_0.S[3672]++;IBinding selectedBinding = getSelectedBinding();

            __CLOVER_148_0.S[3673]++;if ((((selectedBinding != null) && (++__CLOVER_148_0.CT[690] != 0)) || (++__CLOVER_148_0.CF[690] == 0))){
                __CLOVER_148_0.S[3674]++;selectedBinding.setObject(getTag());}

            __CLOVER_148_0.S[3675]++;IActionListener listener = getListener();

            __CLOVER_148_0.S[3676]++;if ((((listener != null) && (++__CLOVER_148_0.CT[691] != 0)) || (++__CLOVER_148_0.CF[691] == 0))){
                __CLOVER_148_0.S[3677]++;listener.actionTriggered(this, cycle);}

            __CLOVER_148_0.S[3678]++;return;
        }}

        __CLOVER_148_0.S[3679]++;writer.beginEmpty("input");
        __CLOVER_148_0.S[3680]++;writer.attribute("type", "submit");
        __CLOVER_148_0.S[3681]++;writer.attribute("name", name);

        __CLOVER_148_0.S[3682]++;if ((((isDisabled()) && (++__CLOVER_148_0.CT[692] != 0)) || (++__CLOVER_148_0.CF[692] == 0))){
            __CLOVER_148_0.S[3683]++;writer.attribute("disabled", "disabled");}

        __CLOVER_148_0.S[3684]++;String label = getLabel();

        __CLOVER_148_0.S[3685]++;if ((((label != null) && (++__CLOVER_148_0.CT[693] != 0)) || (++__CLOVER_148_0.CF[693] == 0))){
            __CLOVER_148_0.S[3686]++;writer.attribute("value", label);}

        __CLOVER_148_0.S[3687]++;renderInformalParameters(writer, cycle);

        __CLOVER_148_0.S[3688]++;writer.closeTag();
    } finally { }}

    public abstract String getLabel();

    public abstract IBinding getSelectedBinding();

    public abstract boolean isDisabled();

    public abstract IActionListener getListener();

    public abstract Object getTag();

}
TOP

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

TOP
Copyright © 2018 www.massapi.com. 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.