001    package org.apache.myfaces.tobago.taglib.component;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more
005     * contributor license agreements.  See the NOTICE file distributed with
006     * this work for additional information regarding copyright ownership.
007     * The ASF licenses this file to You under the Apache License, Version 2.0
008     * (the "License"); you may not use this file except in compliance with
009     * the License.  You may obtain a copy of the License at
010     *
011     *      http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing, software
014     * distributed under the License is distributed on an "AS IS" BASIS,
015     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016     * See the License for the specific language governing permissions and
017     * limitations under the License.
018     */
019    
020    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOR;
021    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_DETAIL;
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_SUMMARY;
023    import org.apache.myfaces.tobago.component.ComponentUtil;
024    
025    import javax.faces.component.UIComponent;
026    import javax.faces.component.UIMessage;
027    
028    /**
029     * @deprecated Please use MessagesRenderer with maxNumber="1"
030     */
031    @Deprecated
032    public class MessageTag extends TobagoTag
033        implements MessageTagDeclaration {
034    
035      private String forComponent;
036      private String showSummary;
037      private String showDetail;
038    
039      public String getComponentType() {
040        return UIMessage.COMPONENT_TYPE;
041      }
042    
043      protected void setProperties(UIComponent component) {
044        super.setProperties(component);
045        ComponentUtil.setStringProperty(component, ATTR_FOR, forComponent);
046        ComponentUtil.setBooleanProperty(component, ATTR_SHOW_SUMMARY, showSummary);
047        ComponentUtil.setBooleanProperty(component, ATTR_SHOW_DETAIL, showDetail);
048      }
049    
050      public void release() {
051        super.release();
052        forComponent = null;
053        showSummary = null;
054        showDetail = null;
055      }
056    
057      public String getFor() {
058        return forComponent;
059      }
060    
061      public void setFor(String forComponent) {
062        this.forComponent = forComponent;
063      }
064    
065      public void setShowSummary(String showSummary) {
066        this.showSummary = showSummary;
067      }
068    
069      public void setShowDetail(String showDetail) {
070        this.showDetail = showDetail;
071      }
072    }