View Javadoc

1   // Copyright 2008 Thiago H. de Paula Figueiredo
2   //
3   // Licensed under the Apache License, Version 2.0 (the "License");
4   // you may not use this file except in compliance with the License.
5   // You may obtain a copy of the License at
6   //
7   //     http://www.apache.org/licenses/LICENSE-2.0
8   //
9   // Unless required by applicable law or agreed to in writing, software
10  // distributed under the License is distributed on an "AS IS" BASIS,
11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  // See the License for the specific language governing permissions and
13  // limitations under the License.
14  
15  package br.com.arsmachina.tapestrycrud;
16  
17  import java.io.Serializable;
18  
19  import org.apache.tapestry5.Block;
20  import org.apache.tapestry5.corelib.components.Zone;
21  
22  /**
23   * Interface that defines some common methods for pages that edit entities.
24   * 
25   * @param <T> the entity class related to this encoder.
26   * @param <K> the type of the class' primary key property.
27   * @author Thiago H. de Paula Figueiredo
28   */
29  public interface EditPage<T, K extends Serializable> extends
30  		CrudPage<T, K> {
31  
32  	/**
33  	 * Returns edited object.
34  	 * 
35  	 * @return a {@link T}.
36  	 */
37  	public T getObject();
38  
39  	/**
40  	 * Changes the edited object.
41  	 * 
42  	 * @param object a {@link T}.
43  	 */
44  	public void setObject(T object);
45  
46  	/**
47  	 * Returns the {@link Zone} that wraps the form. It is used for AJAX form submission.
48  	 * Otherwise, just return <code>null</code>.
49  	 *  
50  	 * @return an {@link Object} that must be a {@link Zone} (preferred) or a  
51  	 * {@link Block}
52  	 */
53  	public Object getFormZone();
54  
55  }