001package gwt.material.design.client.ui; 002 003/* 004 * #%L 005 * GwtMaterial 006 * %% 007 * Copyright (C) 2015 GwtMaterialDesign 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023 024import gwt.material.design.client.base.HasType; 025import gwt.material.design.client.base.MaterialWidget; 026import gwt.material.design.client.base.mixin.CssTypeMixin; 027import gwt.material.design.client.constants.FooterType; 028import gwt.material.design.client.ui.html.Div; 029 030import com.google.gwt.dom.client.Document; 031import com.google.gwt.user.client.ui.Widget; 032 033 034//@formatter:off 035/** 036* Footers are a great way to organize a lot of site navigation and information at the end of a page. This is where the user will look once hes finished scrolling through the current page or is looking for additional information about your website. 037* <h3>UiBinder Usage:</h3> 038* 039* <pre> 040* {@code 041<m:MaterialFooter backgroundColor="blue"> 042 <m:MaterialRow> 043 <m:MaterialColumn grid="s12 m6 l6"> 044 <m:MaterialTitle fontSize="0.7em" color="white" title="Join The Discussion" description="We provide Gitter Chat rooms in order for GWT Developers discussed and collaborate about GWT Material Design and Phonegap Integration."/> 045 <m:MaterialButton ui:field="btnChat" text="CHAT" backgroundColor="blue lighten-2" waves="LIGHT"/> 046 </m:MaterialColumn> 047 <m:MaterialColumn grid="s12 m6 l6"> 048 <m:MaterialTitle fontSize="0.7em" color="white" title="GWT Phonegap" description="We provide Gitter Chat rooms in order for GWT Developers discussed and collaborate about GWT Material Design and Phonegap Integration."/> 049 <m:MaterialButton ui:field="btnDownloadPhonegap" text="GWT Material APK" backgroundColor="blue lighten-2" waves="LIGHT"/> 050 </m:MaterialColumn> 051 </m:MaterialRow> 052 053 <m:MaterialFooterCopyright backgroundColor="blue darken-1"> 054 <m:MaterialLabel text=" © 2014 Copyright Text"/> 055 </m:MaterialFooterCopyright> 056</m:MaterialFooter> } 057* </pre> 058* </p> 059* 060* @author kevzlou7979 061* @author Ben Dol 062* @see <a href="http://gwt-material-demo.herokuapp.com/#footer">Material Footer</a> 063*/ 064//@formatter:on 065public class MaterialFooter extends MaterialWidget implements HasType<FooterType> { 066 067 private Div container = new Div(); 068 private final CssTypeMixin<FooterType, MaterialFooter> typeMixin = new CssTypeMixin<>(this); 069 070 public MaterialFooter() { 071 super(Document.get().createElement("footer"), "page-footer"); 072 container.setStyleName("container"); 073 super.add(container); 074 } 075 076 @Override 077 public void add(Widget child) { 078 if(child instanceof MaterialFooterCopyright) { 079 super.add(child); 080 } else { 081 container.add(child); 082 } 083 } 084 085 @Override 086 public void setType(FooterType type) { 087 typeMixin.setType(type); 088 } 089 090 @Override 091 public FooterType getType() { 092 return typeMixin.getType(); 093 } 094}