001/* 002 * #%L 003 * GwtMaterial 004 * %% 005 * Copyright (C) 2015 - 2017 GwtMaterialDesign 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package gwt.material.design.client.ui.table; 021 022import com.google.gwt.dom.client.Element; 023import com.google.gwt.user.client.DOM; 024import gwt.material.design.jquery.client.api.JQueryElement; 025import gwt.material.design.client.base.MaterialWidget; 026import gwt.material.design.client.js.JsTableElement; 027 028/** 029 * @author Ben Dol 030 */ 031public class Table extends MaterialWidget { 032 033 private JsTableElement element; 034 private MaterialWidget thead; 035 private MaterialWidget tbody; 036 037 public Table() { 038 this(DOM.createTable()); 039 } 040 041 public Table(JQueryElement element) { 042 this(element.asElement()); 043 } 044 045 public Table(Element element) { 046 super(element); 047 048 this.element = JsTableElement.$(getElement()); 049 } 050 051 public JsTableElement getJsElement() { 052 return element; 053 } 054 055 public void addHead(MaterialWidget thead) { 056 this.thead = thead; 057 add(thead); 058 } 059 060 public MaterialWidget getHead() { 061 return thead; 062 } 063 064 public void addBody(MaterialWidget tbody) { 065 this.tbody = tbody; 066 add(tbody); 067 } 068 069 public MaterialWidget getBody() { 070 return tbody; 071 } 072}