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_SUMMARY;
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SHOW_DETAIL;
023    import org.apache.myfaces.tobago.component.ComponentUtil;
024    
025    import javax.faces.component.UIComponent;
026    import javax.faces.component.UIMessage;
027    
028    
029    public class MessageTag extends TobagoTag
030        implements MessageTagDeclaration {
031    
032      private String forComponent;
033      private String showSummary;
034      private String showDetail;
035    
036      public String getComponentType() {
037        return UIMessage.COMPONENT_TYPE;
038      }
039    
040      protected void setProperties(UIComponent component) {
041        super.setProperties(component);
042        ComponentUtil.setStringProperty(component, ATTR_FOR, forComponent);
043        ComponentUtil.setBooleanProperty(component, ATTR_SHOW_SUMMARY, showSummary);
044        ComponentUtil.setBooleanProperty(component, ATTR_SHOW_DETAIL, showDetail);
045      }
046    
047      public void release() {
048        super.release();
049        forComponent = null;
050        showSummary = null;
051        showDetail = null;
052      }
053    
054      public String getFor() {
055        return forComponent;
056      }
057    
058      public void setFor(String forComponent) {
059        this.forComponent = forComponent;
060      }
061    
062      public void setShowSummary(String showSummary) {
063        this.showSummary = showSummary;
064      }
065    
066      public void setShowDetail(String showDetail) {
067        this.showDetail = showDetail;
068      }
069    }