01: package com.meterware.httpunit;
02:
03: /********************************************************************************************************************
04: * $Id: TableCell.java,v 1.19 2004/09/29 17:15:24 russgold Exp $
05: *
06: * Copyright (c) 2000-2004, Russell Gold
07: *
08: * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
09: * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10: * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11: * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12: *
13: * The above copyright notice and this permission notice shall be included in all copies or substantial portions
14: * of the Software.
15: *
16: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
17: * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19: * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20: * DEALINGS IN THE SOFTWARE.
21: *
22: *******************************************************************************************************************/
23: import com.meterware.httpunit.scripting.ScriptableDelegate;
24:
25: import java.net.URL;
26:
27: import org.w3c.dom.Element;
28: import org.w3c.dom.Node;
29:
30: /**
31: * A single cell in an HTML table.
32: **/
33: public class TableCell extends BlockElement {
34:
35: /**
36: * Returns the number of columns spanned by this cell.
37: **/
38: public int getColSpan() {
39: return _colSpan;
40: }
41:
42: /**
43: * Returns the number of rows spanned by this cell.
44: **/
45: public int getRowSpan() {
46: return _rowSpan;
47: }
48:
49: /**
50: * Returns the text value of this cell.
51: * @deprecated as of 1.6, use #getText()
52: */
53: public String asText() {
54: return getText();
55: }
56:
57: //---------------------------------------- package methods -----------------------------------------
58:
59: TableCell(WebResponse response, FrameSelector frame,
60: Element cellNode, URL url, String parentTarget,
61: String characterSet) {
62: super (response, frame, url, parentTarget, cellNode,
63: characterSet);
64: _colSpan = getAttributeValue(cellNode, "colspan", 1);
65: _rowSpan = getAttributeValue(cellNode, "rowspan", 1);
66: }
67:
68: //----------------------------------- private fields and methods -----------------------------------
69:
70: private int _colSpan;
71: private int _rowSpan;
72:
73: }
|