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_BORDER;
021    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CELLSPACING;
022    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
023    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARGIN;
024    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARGIN_BOTTOM;
025    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARGIN_LEFT;
026    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARGIN_RIGHT;
027    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_MARGIN_TOP;
028    import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
029    import org.apache.myfaces.tobago.component.ComponentUtil;
030    import org.apache.myfaces.tobago.component.UIGridLayout;
031    
032    import javax.faces.component.UIComponent;
033    
034    
035    public class GridLayoutTag extends TobagoTag
036        implements GridLayoutTagDeclaration {
037    
038      private String border;
039      private String cellspacing;
040    
041      private String margin;
042      private String marginTop;
043      private String marginRight;
044      private String marginBottom;
045      private String marginLeft;
046      private String columns;
047      private String rows;
048    
049      public String getComponentType() {
050        return UIGridLayout.COMPONENT_TYPE;
051      }
052    
053      protected void setProperties(UIComponent component) {
054        super.setProperties(component);
055        ComponentUtil.setStringProperty(component, ATTR_BORDER, border);
056        ComponentUtil.setStringProperty(component, ATTR_CELLSPACING, cellspacing);
057        ComponentUtil.setStringProperty(component, ATTR_MARGIN, margin);
058        ComponentUtil.setStringProperty(component, ATTR_MARGIN_TOP, marginTop);
059        ComponentUtil.setStringProperty(component, ATTR_MARGIN_RIGHT, marginRight);
060        ComponentUtil.setStringProperty(component, ATTR_MARGIN_BOTTOM, marginBottom);
061        ComponentUtil.setStringProperty(component, ATTR_MARGIN_LEFT, marginLeft);
062        ComponentUtil.setStringProperty(component, ATTR_COLUMNS, columns);
063        ComponentUtil.setStringProperty(component, ATTR_ROWS, rows);
064      }
065    
066      public void release() {
067        super.release();
068        border = null;
069        cellspacing = null;
070        margin = null;
071        marginTop = null;
072        marginRight = null;
073        marginBottom = null;
074        marginLeft = null;
075        columns = null;
076        rows = null;
077      }
078    
079      public String getBorder() {
080        return border;
081      }
082    
083      public void setBorder(String border) {
084        this.border = border;
085      }
086    
087      public String getCellspacing() {
088        return cellspacing;
089      }
090    
091      public void setCellspacing(String cellspacing) {
092        this.cellspacing = cellspacing;
093      }
094    
095      public String getMargin() {
096        return margin;
097      }
098    
099      public void setMargin(String margin) {
100        this.margin = margin;
101      }
102    
103      public String getMarginTop() {
104        return marginTop;
105      }
106    
107      public void setMarginTop(String marginTop) {
108        this.marginTop = marginTop;
109      }
110    
111      public String getMarginRight() {
112        return marginRight;
113      }
114    
115      public void setMarginRight(String marginRight) {
116        this.marginRight = marginRight;
117      }
118    
119      public String getMarginBottom() {
120        return marginBottom;
121      }
122    
123      public void setMarginBottom(String marginBottom) {
124        this.marginBottom = marginBottom;
125      }
126    
127      public String getMarginLeft() {
128        return marginLeft;
129      }
130    
131      public void setMarginLeft(String marginLeft) {
132        this.marginLeft = marginLeft;
133      }
134    
135      public String getColumns() {
136        return columns;
137      }
138    
139      public void setColumns(String columns) {
140        this.columns = columns;
141      }
142    
143      public String getRows() {
144        return rows;
145      }
146    
147      public void setRows(String rows) {
148        this.rows = rows;
149      }
150    }