|
1 | 1 | package gwt.material.design.client.ui; |
2 | 2 |
|
3 | | -/* |
4 | | - * #%L |
5 | | - * GwtMaterial |
6 | | - * %% |
7 | | - * Copyright (C) 2015 GwtMaterialDesign |
8 | | - * %% |
9 | | - * Licensed under the Apache License, Version 2.0 (the "License"); |
10 | | - * you may not use this file except in compliance with the License. |
11 | | - * You may obtain a copy of the License at |
12 | | - * |
13 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
14 | | - * |
15 | | - * Unless required by applicable law or agreed to in writing, software |
16 | | - * distributed under the License is distributed on an "AS IS" BASIS, |
17 | | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
18 | | - * See the License for the specific language governing permissions and |
19 | | - * limitations under the License. |
20 | | - * #L% |
21 | | - */ |
| 3 | +import gwt.material.design.client.custom.ComplexWidget; |
| 4 | +import gwt.material.design.client.custom.CustomDiv; |
| 5 | +import gwt.material.design.client.custom.HasColors; |
22 | 6 |
|
23 | | -import gwt.material.design.client.custom.CustomFooter; |
24 | | - |
25 | | -import com.google.gwt.core.client.GWT; |
26 | | -import com.google.gwt.dom.client.Style.Position; |
27 | | -import com.google.gwt.dom.client.Style.Unit; |
28 | | -import com.google.gwt.uibinder.client.UiBinder; |
29 | | -import com.google.gwt.uibinder.client.UiChild; |
30 | | -import com.google.gwt.uibinder.client.UiField; |
31 | | -import com.google.gwt.user.client.ui.Composite; |
32 | | -import com.google.gwt.user.client.ui.Label; |
| 7 | +import com.google.gwt.dom.client.Document; |
33 | 8 | import com.google.gwt.user.client.ui.Widget; |
34 | 9 |
|
35 | | -public class MaterialFooter extends Composite { |
36 | 10 |
|
37 | | - private static MaterialFooterUiBinder uiBinder = GWT.create(MaterialFooterUiBinder.class); |
| 11 | +//@formatter:off |
| 12 | +/** |
| 13 | +* 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. |
| 14 | +* <h3>UiBinder Usage:</h3> |
| 15 | +* |
| 16 | +* <pre> |
| 17 | +* {@code |
| 18 | +<m:MaterialFooter backgroundColor="blue"> |
| 19 | + <m:MaterialRow> |
| 20 | + <m:MaterialColumn grid="s12 m6 l6"> |
| 21 | + <m:MaterialTitle fontSize="0.7" 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."/> |
| 22 | + <m:MaterialButton ui:field="btnChat" text="CHAT" backgroundColor="blue lighten-2" waves="light"/> |
| 23 | + </m:MaterialColumn> |
| 24 | + <m:MaterialColumn grid="s12 m6 l6"> |
| 25 | + <m:MaterialTitle fontSize="0.7" 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."/> |
| 26 | + <m:MaterialButton ui:field="btnDownloadPhonegap" text="GWT Material APK" backgroundColor="blue lighten-2" waves="light"/> |
| 27 | + </m:MaterialColumn> |
| 28 | + </m:MaterialRow> |
| 29 | + |
| 30 | + <m:MaterialFooterCopyright backgroundColor="blue darken-1"> |
| 31 | + <m:MaterialLabel text=" © 2014 Copyright Text"/> |
| 32 | + </m:MaterialFooterCopyright> |
| 33 | +</m:MaterialFooter> } |
| 34 | +* </pre> |
| 35 | +* </p> |
| 36 | +* |
| 37 | +* @author kevzlou7979 |
| 38 | +* @see <a href="http://gwt-material-demo.herokuapp.com/#footer">Material Footer</a> |
| 39 | +*/ |
| 40 | +//@formatter:on |
| 41 | +public class MaterialFooter extends ComplexWidget implements HasColors{ |
38 | 42 |
|
39 | | - interface MaterialFooterUiBinder extends UiBinder<Widget, MaterialFooter> { |
40 | | - } |
41 | | - @UiField CustomFooter footerPanel; |
42 | | - @UiField Label lblCopyright; |
43 | | - @UiField MaterialPanel container; |
44 | | - private String color = ""; |
45 | | - private String copyright = ""; |
46 | | - private String type = ""; |
47 | 43 |
|
48 | | - public MaterialFooter() { |
49 | | - initWidget(uiBinder.createAndBindUi(this)); |
50 | | - } |
51 | | - |
52 | | - @UiChild(tagname = "content") |
53 | | - public void onAddFooterContent(Widget w){ |
54 | | - container.add(w); |
55 | | - } |
| 44 | + CustomDiv container = new CustomDiv(); |
56 | 45 |
|
57 | | - |
58 | | - public String getColor() { |
59 | | - return color; |
60 | | - } |
61 | | - |
62 | | - public void setColor(String color) { |
63 | | - this.color = color; |
64 | | - if(!color.isEmpty()) footerPanel.addStyleName(color); |
65 | | - } |
66 | | - |
67 | | - public String getCopyright() { |
68 | | - return copyright; |
69 | | - } |
70 | | - |
71 | | - public void setCopyright(String copyright) { |
72 | | - this.copyright = copyright; |
73 | | - if(!copyright.isEmpty()) lblCopyright.setText(copyright); |
74 | | - } |
75 | | - |
76 | | - public String getType() { |
77 | | - return type; |
| 46 | + public MaterialFooter() { |
| 47 | + setElement(Document.get().createElement("footer")); |
| 48 | + setStyleName("page-footer"); |
| 49 | + container.setStyleName("container"); |
78 | 50 | } |
79 | 51 |
|
80 | | - public void setType(String type) { |
81 | | - this.type = type; |
82 | | - if(type.equals("fixed")){ |
83 | | - footerPanel.getElement().getStyle().setPosition(Position.FIXED); |
84 | | - footerPanel.getElement().getStyle().setWidth(100, Unit.PCT); |
85 | | - footerPanel.getElement().getStyle().setBottom(0, Unit.PCT); |
| 52 | + @Override |
| 53 | + public void add(Widget child) { |
| 54 | + if(child.getElement().getClassName().contains("footer-copyright")){ |
| 55 | + super.add(child); |
| 56 | + }else{ |
| 57 | + container.add(child); |
| 58 | + super.add(container); |
86 | 59 | } |
| 60 | + |
87 | 61 | } |
88 | 62 |
|
89 | | - public CustomFooter getFooterPanel() { |
90 | | - return footerPanel; |
| 63 | + @Override |
| 64 | + public void setBackgroundColor(String bgColor) { |
| 65 | + // TODO Auto-generated method stub |
| 66 | + addStyleName(bgColor); |
91 | 67 | } |
92 | 68 |
|
93 | | - public void setFooterPanel(CustomFooter footerPanel) { |
94 | | - this.footerPanel = footerPanel; |
| 69 | + @Override |
| 70 | + public void setTextColor(String textColor) { |
| 71 | + // TODO Auto-generated method stub |
| 72 | + addStyleName(textColor + "-text"); |
95 | 73 | } |
96 | | - |
97 | | - public MaterialPanel getContainer() { |
98 | | - return container; |
99 | | - } |
100 | | - |
101 | | - public void setContainer(MaterialPanel container) { |
102 | | - this.container = container; |
103 | | - } |
104 | | - |
105 | 74 |
|
106 | | - |
107 | 75 | } |
0 commit comments