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