001: /*
002: ItsNat Java Web Application Framework
003: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
004: Author: Jose Maria Arranz Santamaria
005:
006: This program is free software: you can redistribute it and/or modify
007: it under the terms of the GNU Affero General Public License as published by
008: the Free Software Foundation, either version 3 of the License, or
009: (at your option) any later version. See the GNU Affero General Public
010: License for more details. See the copy of the GNU Affero General Public License
011: included in this program. If not, see <http://www.gnu.org/licenses/>.
012: */
013:
014: package org.itsnat.impl.comp.html;
015:
016: import org.itsnat.comp.ItsNatTableStructure;
017: import org.itsnat.comp.html.ItsNatHTMLComponentManager;
018: import org.itsnat.comp.html.ItsNatHTMLTable;
019: import org.itsnat.comp.html.ItsNatHTMLTableHeader;
020: import org.itsnat.comp.html.ui.ItsNatHTMLElementComponentUI;
021: import org.itsnat.comp.html.ui.ItsNatHTMLTableUI;
022: import org.itsnat.comp.ui.ItsNatComponentUI;
023: import org.itsnat.core.html.ItsNatHTMLDocument;
024: import org.itsnat.core.NameValue;
025: import org.itsnat.impl.comp.ItsNatTableImpl;
026: import org.itsnat.impl.comp.ItsNatTableHeaderImpl;
027: import org.itsnat.impl.comp.html.ui.ItsNatHTMLTableUIImpl;
028: import org.itsnat.impl.core.html.ItsNatHTMLDocumentImpl;
029: import org.w3c.dom.Document;
030: import org.w3c.dom.Element;
031: import org.w3c.dom.Node;
032: import org.w3c.dom.html.HTMLElement;
033: import org.w3c.dom.html.HTMLTableElement;
034: import org.w3c.dom.html.HTMLTableSectionElement;
035:
036: /**
037: *
038: * @author jmarranz
039: */
040: public class ItsNatHTMLTableImpl extends ItsNatTableImpl implements
041: ItsNatHTMLTable {
042: /** Creates a new instance of ItsNatHTMLTableImpl */
043: public ItsNatHTMLTableImpl(HTMLTableElement element,
044: ItsNatTableStructure structure, NameValue[] artifacts,
045: ItsNatHTMLComponentManagerImpl componentMgr) {
046: super (element, structure, artifacts, componentMgr);
047:
048: init();
049: }
050:
051: public HTMLTableElement getHTMLTableElement() {
052: return (HTMLTableElement) getElement();
053: }
054:
055: public ItsNatHTMLTableUI getItsNatHTMLTableUI() {
056: return (ItsNatHTMLTableUI) compUI;
057: }
058:
059: public ItsNatHTMLTableHeader getItsNatHTMLTableHeader() {
060: return (ItsNatHTMLTableHeader) header;
061: }
062:
063: public ItsNatHTMLTableUI createDefaultItsNatHTMLTableUI() {
064: return new ItsNatHTMLTableUIImpl(this );
065: }
066:
067: public ItsNatComponentUI createDefaultItsNatComponentUI() {
068: return createDefaultItsNatHTMLTableUI();
069: }
070:
071: public ItsNatTableHeaderImpl createItsNatTableHeader(
072: Element headerElem) {
073: return new ItsNatHTMLTableHeaderImpl(this ,
074: (HTMLTableSectionElement) headerElem);
075: }
076:
077: public Node createDefaultNode() {
078: Document doc = getItsNatDocument().getDocument();
079: HTMLTableElement table = (HTMLTableElement) doc
080: .createElement("table");
081: HTMLTableSectionElement tbody = (HTMLTableSectionElement) doc
082: .createElement("tbody");
083: table.appendChild(tbody);
084: return table;
085: }
086:
087: public ItsNatHTMLComponentManagerImpl getItsNatHTMLComponentManagerImpl() {
088: return (ItsNatHTMLComponentManagerImpl) componentMgr;
089: }
090:
091: public ItsNatHTMLComponentManager getItsNatHTMLComponentManager() {
092: return getItsNatHTMLComponentManagerImpl();
093: }
094:
095: public ItsNatHTMLElementComponentUI getItsNatHTMLElementComponentUI() {
096: return (ItsNatHTMLElementComponentUI) compUI;
097: }
098:
099: public ItsNatHTMLDocumentImpl getItsNatHTMLDocumentImpl() {
100: return getItsNatHTMLComponentManagerImpl()
101: .getItsNatHTMLDocumentImpl();
102: }
103:
104: public ItsNatHTMLDocument getItsNatHTMLDocument() {
105: return getItsNatHTMLDocumentImpl();
106: }
107:
108: public HTMLElement getHTMLElement() {
109: return (HTMLElement) getNode();
110: }
111: }
|