001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.markup.html.form;
018
019
020/**
021 * Triggers a form submit and controls its processing
022 * 
023 * @author Igor Vaynberg (ivaynberg)
024 */
025public interface IFormSubmitter
026{
027        /**
028         * Returns the form this component submits.
029         * 
030         * @return form submitted by this component
031         */
032        Form<?> getForm();
033
034        /**
035         * Returns whether form should be processed the default way. When false (default is true), all
036         * validation and form updating is bypassed and the onSubmit method of that button is called
037         * directly, and the onSubmit method of the parent form is not called. A common use for this is
038         * to create a cancel button.
039         * 
040         * @return defaultFormProcessing
041         */
042        boolean getDefaultFormProcessing();
043
044        /**
045         * Override this method to provide special submit handling in a multi-button form. This method
046         * will be called <em>before</em> the form's onSubmit method.
047         */
048        void onSubmit();
049
050        /**
051         * Override this method to provide special submit handling in a multi-button form. This method
052         * will be called <em>after</em> the form's onSubmit method.
053         */
054        void onAfterSubmit();
055
056        /**
057         * Method that is invoked when form processing fails; for example, when there are validation
058         * errors.
059         */
060        void onError();
061}