001// Copyright 2007 The Apache Software Foundation
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
015package org.apache.tapestry5.services;
016
017import org.apache.tapestry5.corelib.components.Grid;
018import org.apache.tapestry5.ioc.Messages;
019
020/**
021 * Provides context information needed when displaying a value. This interface is an integral part of the {@link Grid}
022 * and similar output components.    It is made available to components via an {@link
023 * org.apache.tapestry5.annotations.Environmental} annotation.
024 */
025public interface PropertyOutputContext
026{
027    /**
028     * Returns the value of the property (the object being displayed is encapsulated by the context).
029     */
030    Object getPropertyValue();
031
032    /**
033     * Returns the message catalog appropriate for use. In practice, this is the message catalog of the container of the
034     * {@link Grid} component. This is used, for example, to locate labels for fields, or to locate string
035     * representations of Enums.
036     */
037    Messages getMessages();
038
039    /**
040     * Returns a string that identifies the property, usually the property name. This is used as the basis for the
041     * client-side client id.
042     */
043    String getPropertyId();
044
045    /**
046     * Returns the name of the property (which may, in fact, be a property expression).
047     */
048    String getPropertyName();
049}