001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.myfaces.tobago.taglib.component;
021    
022    import org.apache.commons.logging.Log;
023    import org.apache.commons.logging.LogFactory;
024    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SCROLLBARS;
025    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SPAN_X;
026    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_SPAN_Y;
027    import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_PANEL;
028    import org.apache.myfaces.tobago.component.ComponentUtil;
029    import org.apache.myfaces.tobago.component.UICell;
030    
031    import javax.faces.component.UIComponent;
032    import javax.servlet.jsp.tagext.BodyTag;
033    
034    /*
035     * Created 29.07.2003 at 15:09:53.
036     * $Id: CellTag.java 1368577 2012-08-02 16:20:31Z lofwyr $
037     */
038    
039    // Some Weblogic versions need explicit 'implements' for BodyTag
040    public class CellTag extends TobagoBodyTag implements BodyTag, CellTagDeclaration {
041    
042      private static final Log LOG = LogFactory.getLog(CellTag.class);
043    
044      private String spanX = "1";
045    
046      private String spanY = "1";
047    
048      private String scrollbars;
049    
050    
051      public String getComponentType() {
052        return UICell.COMPONENT_TYPE;
053      }
054    
055      public String getRendererType() {
056        return RENDERER_TYPE_PANEL;
057      }
058    
059      protected void setProperties(UIComponent component) {
060        super.setProperties(component);
061    
062        ComponentUtil.setIntegerProperty(component, ATTR_SPAN_X, spanX);
063        ComponentUtil.setIntegerProperty(component, ATTR_SPAN_Y, spanY);
064        ComponentUtil.setStringProperty(component, ATTR_SCROLLBARS, scrollbars);
065    
066        if (LOG.isDebugEnabled()) {
067          LOG.debug("spanX=" + spanX + " spanY=" + spanY);
068          LOG.debug("spanX=" + component.getAttributes().get(ATTR_SPAN_X)
069              + " spanY=" + component.getAttributes().get(ATTR_SPAN_Y));
070          LOG.debug("component = " + getComponentInstance());
071        }
072      }
073    
074      public void release() {
075        super.release();
076        spanX = "1";
077        spanY = "1";
078        scrollbars = null;
079      }
080    
081      public String getSpanX() {
082        return spanX;
083      }
084    
085      public void setSpanX(String spanX) {
086        this.spanX = spanX;
087      }
088    
089      public String getSpanY() {
090        return spanY;
091      }
092    
093      public void setSpanY(String spanY) {
094        this.spanY = spanY;
095      }
096    
097      public String getScrollbars() {
098        return scrollbars;
099      }
100    
101      public void setScrollbars(String scrollbars) {
102        this.scrollbars = scrollbars;
103      }
104    }