001    package net.sf.jolene.dom;
002    
003    /**
004     * A grid column object. This is used to define the columns that the grid will display. The columns define the
005     * header text, width, align and cell object. The cell object can be any of the HTMLElement objects. Cell objects
006     * render the object in the grid cell instead of just text. Commonly this would be used to display checkboxes in
007     * the grid.
008     *
009     * @author Dan Howard
010     * @since Oct 11, 2005 Time: 6:51:04 PM
011     */
012    public final class GridColumn {
013    
014        private String width;
015        private String header;
016        private String align;   //@todo does not work. Assigns to the header only!
017        private HTMLElement cellObject;
018    
019        /**
020         * Default constructor.
021         */
022        public GridColumn() {
023            width = "";
024            header = "";
025            align = "";
026            cellObject = null;
027        }
028    
029        /**
030         * Constructs a GridColumn using a header string and a width string.
031         *
032         * @param header header string for the column.
033         * @param width  width of the column.
034         */
035        public GridColumn(String header, String width) {
036            this();
037            this.header = header;
038            this.width = width;
039        }
040    
041        /**
042         * Return the align for the column.
043         *
044         * @return Alignment of the column.
045         */
046        public String getAlign() {
047            return align;
048        }
049    
050    
051        /**
052         * Gets the CellObject for the column.
053         *
054         * @return HTMLElement cell object.
055         */
056        public HTMLElement getCellObject() {
057            return cellObject;
058        }
059    
060        /**
061         * Returns the column header string.
062         *
063         * @return Header of the column.
064         */
065        public String getHeader() {
066            return header;
067        }
068    
069        /**
070         * Returns the column width.
071         *
072         * @return Width of the column.
073         */
074        public String getWidth() {
075            return width;
076        }
077    
078        /**
079         * Sets the column align.
080         *
081         * @param align Alignment of the column.
082         */
083        public void setAlign(String align) {
084            this.align = align;
085        }
086    
087        /**
088         * Sets the column header.
089         *
090         * @param header Header of the column.
091         */
092        public void setHeader(String header) {
093            this.header = header;
094        }
095    
096        /**
097         * Sets the CellObject for the column.
098         *
099         * @param cellObject Any HTMLElement object.
100         */
101        public void setCellObject(HTMLElement cellObject) {
102            this.cellObject = cellObject;
103        }
104    
105        /**
106         * Sets the column width.
107         *
108         * @param width Width of the column.
109         */
110        public void setWidth(String width) {
111            this.width = width;
112        }
113    
114    }