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 org.apache.commons.logging.Log;
021    import org.apache.commons.logging.LogFactory;
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SCROLLBARS;
023    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SPAN_X;
024    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SPAN_Y;
025    import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_PANEL;
026    import org.apache.myfaces.tobago.component.ComponentUtil;
027    import org.apache.myfaces.tobago.component.UICell;
028    
029    import javax.faces.component.UIComponent;
030    import javax.servlet.jsp.tagext.BodyTag;
031    
032    /*
033     * Created 29.07.2003 at 15:09:53.
034     * $Id: CellTag.java 474273 2006-11-13 12:15:36Z lofwyr $
035     */
036    
037    
038    public class CellTag extends TobagoBodyTag implements BodyTag, CellTagDeclaration {
039    
040      private static final Log LOG = LogFactory.getLog(CellTag.class);
041    
042      private String spanX = "1";
043    
044      private String spanY = "1";
045    
046      private String scrollbars;
047    
048    
049      public String getComponentType() {
050        return UICell.COMPONENT_TYPE;
051      }
052    
053      public String getRendererType() {
054        return RENDERER_TYPE_PANEL;
055      }
056    
057      protected void setProperties(UIComponent component) {
058        super.setProperties(component);
059    
060        ComponentUtil.setIntegerProperty(component, ATTR_SPAN_X, spanX);
061        ComponentUtil.setIntegerProperty(component, ATTR_SPAN_Y, spanY);
062        ComponentUtil.setStringProperty(component, ATTR_SCROLLBARS, scrollbars);
063    
064        if (LOG.isDebugEnabled()) {
065          LOG.debug("spanX=" + spanX + " spanY=" + spanY);
066          LOG.debug("spanX=" + component.getAttributes().get(ATTR_SPAN_X)
067              + " spanY=" + component.getAttributes().get(ATTR_SPAN_Y));
068          LOG.debug("component = " + getComponentInstance());
069        }
070      }
071    
072      public void release() {
073        super.release();
074        spanX = "1";
075        spanY = "1";
076        scrollbars = null;
077      }
078    
079      public String getSpanX() {
080        return spanX;
081      }
082    
083      public void setSpanX(String spanX) {
084        this.spanX = spanX;
085      }
086    
087      public String getSpanY() {
088        return spanY;
089      }
090    
091      public void setSpanY(String spanY) {
092        this.spanY = spanY;
093      }
094    
095      public String getScrollbars() {
096        return scrollbars;
097      }
098    
099      public void setScrollbars(String scrollbars) {
100        this.scrollbars = scrollbars;
101      }
102    }