001    /* 
002     * This file is part of the Echo Point Project.  This project is a collection
003     * of Components that have extended the Echo Web Application Framework.
004     *
005     * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006     *
007     * The contents of this file are subject to the Mozilla Public License Version
008     * 1.1 (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     * http://www.mozilla.org/MPL/
011     *
012     * Software distributed under the License is distributed on an "AS IS" basis,
013     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014     * for the specific language governing rights and limitations under the
015     * License.
016     *
017     * Alternatively, the contents of this file may be used under the terms of
018     * either the GNU General Public License Version 2 or later (the "GPL"), or
019     * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020     * in which case the provisions of the GPL or the LGPL are applicable instead
021     * of those above. If you wish to allow use of your version of this file only
022     * under the terms of either the GPL or the LGPL, and not to allow others to
023     * use your version of this file under the terms of the MPL, indicate your
024     * decision by deleting the provisions above and replace them with the notice
025     * and other provisions required by the GPL or the LGPL. If you do not delete
026     * the provisions above, a recipient may use your version of this file under
027     * the terms of any one of the MPL, the GPL or the LGPL.
028     */
029    package echopointng.layout;
030    
031    import echopointng.table.TableCellRendererEx;
032    import nextapp.echo2.app.layout.TableLayoutData;
033    
034    /**
035     * <code>TableLayoutDataEx</code> is an extension of
036     * <code>TableLayoutData</code> that allows row and column spanning by table
037     * cells.
038     * 
039     * @see TableCellRendererEx
040     * @see echopointng.TableEx
041     * 
042     */
043    public class TableLayoutDataEx extends TableLayoutData {
044            private int colSpan;
045            private int rowSpan;
046            private String toolTipText;
047            
048            /**
049             * Constructs a <code>TableLayoutDataEx</code>
050             */
051            public TableLayoutDataEx() {
052                    this(1, 1);
053            }
054    
055            /**
056             * Constructs a <code>TableLayoutDataEx</code>
057             * 
058             * @param colSpan -
059             *            the number of columns that are spanned by this cell.
060             * @param rowSpan -
061             *            the number of rows that are spanned by this cell.
062             */
063            public TableLayoutDataEx(int colSpan, int rowSpan) {
064                    setColSpan(colSpan);
065                    setRowSpan(rowSpan);
066            }
067    
068            /**
069             * @return the number of columns that are spanned by this cell.
070             */
071            public int getColSpan() {
072                    return colSpan;
073            }
074    
075            /**
076             * @return the number of rows that are spanned by this cell.
077             */
078            public int getRowSpan() {
079                    return rowSpan;
080            }
081    
082            /**
083             * Sets the number of columns that are spanned by this cell. Less than 1 is
084             * normalised out to 1.
085             * 
086             * @param newValue -
087             *            the number of columns that are spanned by this cell.
088             */
089            public void setColSpan(int newValue) {
090                    this.colSpan = (newValue < 1 ? 1 : newValue);
091            }
092    
093            /**
094             * Sets the number of rows that are spanned by this cell. Less than 1 is
095             * normalised out to 1.
096             * 
097             * @param newValue -
098             *            the number of rows that are spanned by this cell.
099             */
100            public void setRowSpan(int newValue) {
101                    this.rowSpan = (newValue < 1 ? 1 : newValue);
102            }
103    
104        /**
105         * Returns the tool tip text (displayed when the mouse cursor is hovered 
106         * over the area with this layout data).
107         * 
108         * @return the tool tip text
109         */
110        public String getToolTipText() {
111            return (String) toolTipText;
112        }
113        
114        /**
115         * Sets the tool tip text (displayed when the mouse cursor is hovered 
116         * over the area with this layout data).
117         * 
118         * @param newValue the new tool tip text
119         */
120        public void setToolTipText(String newValue) {
121            toolTipText = newValue;
122        }
123            
124    }