001 // Copyright 2008 Thiago H. de Paula Figueiredo
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package br.com.arsmachina.tapestrycrud.components;
016
017
018 import org.apache.tapestry5.BindingConstants;
019 import org.apache.tapestry5.annotations.BeforeRenderBody;
020 import org.apache.tapestry5.annotations.IncludeStylesheet;
021 import org.apache.tapestry5.annotations.Parameter;
022 import org.apache.tapestry5.corelib.components.Grid;
023
024 import br.com.arsmachina.tapestrycrud.Constants;
025
026 /**
027 * Component used to easily standardize and internationalize the
028 * {@link Grid}'s "no records to display" message.
029 * It puts the message inside a <code>div</code> with class <code>t-crud-emptygrid</code>.
030 * <a href="http://ars-machina.svn.sourceforge.net/viewvc/ars-machina/example/trunk/src/main/webapp/project/ListProject.tml?view=markup"
031 * >Ars Machina Project Example</a>.
032 *
033 * @author Thiago H. de Paula Figueiredo
034 */
035 @IncludeStylesheet(Constants.TAPESTRY_CRUD_CSS_ASSET)
036 public class EmptyGridMessage {
037
038 /**
039 * Key of the empty grid message.
040 */
041 public static final String MESSAGE_GRID_EMPTY = "message.grid.empty";
042
043 /**
044 * Generated <code><p></code> CSS class.
045 */
046 public static final String CSS_CLASS = "t-crud-emptygrid";
047
048 /**
049 * Message to be shown.
050 */
051 @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = MESSAGE_GRID_EMPTY)
052 private String message;
053
054 /**
055 * Returns the value of the <code>message</code> property.
056 *
057 * @return a {@link String}.
058 */
059 public String getMessage() {
060 return message;
061 }
062
063 /**
064 * Changes the value of the <code>message</code> property.
065 *
066 * @param message a {@link String}.
067 */
068 public void setMessage(String message) {
069 this.message = message;
070 }
071
072 /**
073 * Discards the tag body.
074 * @return <code>false</code>.
075 */
076 @BeforeRenderBody
077 public boolean discardBody() {
078 return false;
079 }
080
081 }