Skip to content

Commit 480624b

Browse files
authored
Merge pull request #85 from GwtMaterialDesign/release_2.0
New Updates 2.0 demo showcase
2 parents fb4f525 + 441aaeb commit 480624b

30 files changed

+1382
-501
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<parent>
55
<artifactId>gwt-material-parent</artifactId>
66
<groupId>com.github.gwtmaterialdesign</groupId>
7-
<version>2.0-rc7</version>
7+
<version>2.0-SNAPSHOT</version>
88
</parent>
99

1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>gwt-material-demo</artifactId>
1313
<packaging>war</packaging>
14-
<version>2.0-rc7</version>
14+
<version>2.0-SNAPSHOT</version>
1515
<name>Gwt Material Demo</name>
1616
<description>Showcase for gwt-material</description>
1717

@@ -34,7 +34,7 @@
3434
<gwt.version>2.8.1</gwt.version>
3535
<gwtp.version>1.5.3</gwtp.version>
3636
<gin.version>2.1.2</gin.version>
37-
<gwt-material.version>2.0-rc7</gwt-material.version>
37+
<gwt-material.version>2.0-SNAPSHOT</gwt-material.version>
3838

3939
<gwt.style>PRETTY</gwt.style>
4040

src/main/java/gwt/material/design/demo/client/application/components/forms/FormsModule.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,23 @@
2121
*/
2222

2323

24-
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
24+
import com.google.gwt.inject.client.AbstractGinModule;
25+
import gwt.material.design.demo.client.application.components.forms.checkbox.CheckBoxModule;
26+
import gwt.material.design.demo.client.application.components.forms.listbox.ListBoxModule;
27+
import gwt.material.design.demo.client.application.components.forms.radiobutton.RadioButtonModule;
28+
import gwt.material.design.demo.client.application.components.forms.range.RangeModule;
29+
import gwt.material.design.demo.client.application.components.forms.switches.SwitchModule;
30+
import gwt.material.design.demo.client.application.components.forms.textfields.TextFieldModule;
31+
32+
public class FormsModule extends AbstractGinModule {
2533

26-
public class FormsModule extends AbstractPresenterModule {
2734
@Override
2835
protected void configure() {
29-
bindPresenter(FormsPresenter.class, FormsPresenter.MyView.class,
30-
FormsView.class, FormsPresenter.MyProxy.class);
36+
install(new TextFieldModule());
37+
install(new ListBoxModule());
38+
install(new RadioButtonModule());
39+
install(new CheckBoxModule());
40+
install(new SwitchModule());
41+
install(new RangeModule());
3142
}
3243
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package gwt.material.design.demo.client.application.components.forms.checkbox;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 - 2016 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+
*/
22+
23+
24+
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
25+
26+
public class CheckBoxModule extends AbstractPresenterModule {
27+
@Override
28+
protected void configure() {
29+
bindPresenter(CheckBoxPresenter.class, CheckBoxPresenter.MyView.class,
30+
CheckBoxView.class, CheckBoxPresenter.MyProxy.class);
31+
}
32+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package gwt.material.design.demo.client.application.components.forms.checkbox;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 - 2016 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+
*/
22+
23+
import com.google.inject.Inject;
24+
import com.google.web.bindery.event.shared.EventBus;
25+
import com.gwtplatform.mvp.client.Presenter;
26+
import com.gwtplatform.mvp.client.View;
27+
import com.gwtplatform.mvp.client.annotations.NameToken;
28+
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
29+
import com.gwtplatform.mvp.client.proxy.ProxyPlace;
30+
import gwt.material.design.demo.client.application.ApplicationPresenter;
31+
import gwt.material.design.demo.client.event.SetPageTitleEvent;
32+
import gwt.material.design.demo.client.place.NameTokens;
33+
34+
public class CheckBoxPresenter extends Presenter<CheckBoxPresenter.MyView, CheckBoxPresenter.MyProxy> {
35+
interface MyView extends View {
36+
}
37+
38+
@NameToken(NameTokens.checkbox)
39+
@ProxyCodeSplit
40+
interface MyProxy extends ProxyPlace<CheckBoxPresenter> {
41+
}
42+
43+
@Inject
44+
CheckBoxPresenter(EventBus eventBus, MyView view, MyProxy proxy) {
45+
super(eventBus, view, proxy, ApplicationPresenter.SLOT_MAIN);
46+
}
47+
48+
@Override
49+
protected void onReveal() {
50+
super.onReveal();
51+
52+
SetPageTitleEvent.fire("CheckBox", "Checkboxes allow the user to select multiple options from a set. If you have multiple options appearing in a list, you can preserve space by using checkboxes instead of on/off switches.", "components/forms/checkbox/CheckBoxView", "https://material.io/guidelines/components/selection-controls.html", this);
53+
}
54+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package gwt.material.design.demo.client.application.components.forms.checkbox;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 - 2016 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+
*/
22+
23+
24+
import com.google.gwt.event.dom.client.ClickEvent;
25+
import com.google.gwt.event.logical.shared.ValueChangeEvent;
26+
import com.google.gwt.uibinder.client.UiBinder;
27+
import com.google.gwt.uibinder.client.UiField;
28+
import com.google.gwt.uibinder.client.UiHandler;
29+
import com.google.gwt.user.client.ui.Widget;
30+
import com.gwtplatform.mvp.client.ViewImpl;
31+
import gwt.material.design.client.ui.MaterialCheckBox;
32+
import gwt.material.design.client.ui.MaterialToast;
33+
34+
import javax.inject.Inject;
35+
36+
public class CheckBoxView extends ViewImpl implements CheckBoxPresenter.MyView {
37+
interface Binder extends UiBinder<Widget, CheckBoxView> {
38+
}
39+
40+
@UiField MaterialCheckBox cbBoxAll, cbBox, cbBlue, cbRed, cbCyan, cbGreen, cbBrown, cbValue;
41+
42+
@Inject
43+
CheckBoxView(Binder uiBinder) {
44+
initWidget(uiBinder.createAndBindUi(this));
45+
}
46+
47+
@UiHandler("cbBox")
48+
void onCheckBox(ValueChangeEvent<Boolean> e) {
49+
if(e.getValue()) {
50+
cbBox.setText("CheckBox 1: true");
51+
} else {
52+
cbBox.setText("CheckBox 1: false");
53+
}
54+
}
55+
56+
@UiHandler("cbBoxAll")
57+
void onCheckAll(ValueChangeEvent<Boolean> e) {
58+
if(e.getValue()) {
59+
cbBlue.setValue(true);
60+
cbRed.setValue(true);
61+
cbCyan.setValue(true);
62+
cbGreen.setValue(true);
63+
cbBrown.setValue(true);
64+
} else {
65+
cbBlue.setValue(false);
66+
cbRed.setValue(false);
67+
cbCyan.setValue(false);
68+
cbGreen.setValue(false);
69+
cbBrown.setValue(false);
70+
}
71+
}
72+
73+
@UiHandler("cbValue")
74+
void onCheckValue(ValueChangeEvent<Boolean> e) {
75+
MaterialToast.fireToast("Value : " + e.getValue());
76+
}
77+
78+
@UiHandler("btnCbValue")
79+
void onClickCbValue(ClickEvent e) {
80+
cbValue.setValue(true);
81+
}
82+
83+
@UiHandler("btnCbValueEvent")
84+
void onClickCbValueEvent(ClickEvent e) {
85+
cbValue.setValue(false, true);
86+
}
87+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!--
2+
#%L
3+
GwtMaterial
4+
%%
5+
Copyright (C) 2015 - 2016 GwtMaterialDesign
6+
%%
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
#L%
19+
-->
20+
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
21+
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
22+
xmlns:m="urn:import:gwt.material.design.client.ui"
23+
xmlns:demo="urn:import:gwt.material.design.demo.client.ui">
24+
25+
<m:MaterialRow>
26+
<m:MaterialRow addStyleNames="code">
27+
<m:MaterialTitle title="Check Box" description="Checkboxes"/>
28+
<m:MaterialRow>
29+
<m:MaterialColumn grid="l2">
30+
<m:MaterialCheckBox text="Blue" value="true" />
31+
<m:MaterialCheckBox text="Red" />
32+
<m:MaterialCheckBox text="Cyan" value="true" type="FILLED"/>
33+
<m:MaterialCheckBox text="Green" value="true" enabled="false"/>
34+
<m:MaterialCheckBox text="Brown" enabled="false"/>
35+
<m:MaterialCheckBox ui:field="cbBox" text="CheckBox 1: true" value="true" type="FILLED"/>
36+
</m:MaterialColumn>
37+
<m:MaterialColumn grid="l2">
38+
<m:MaterialCheckBox ui:field="cbBoxAll" text="Check all" type="FILLED"/>
39+
<m:MaterialCheckBox ui:field="cbBlue" text="Blue" type="FILLED" />
40+
<m:MaterialCheckBox ui:field="cbRed" text="Red" type="FILLED"/>
41+
<m:MaterialCheckBox ui:field="cbCyan" text="Cyan" type="FILLED"/>
42+
<m:MaterialCheckBox ui:field="cbGreen" text="Green" type="FILLED"/>
43+
<m:MaterialCheckBox ui:field="cbBrown" text="Brown" type="FILLED"/>
44+
</m:MaterialColumn>
45+
</m:MaterialRow>
46+
47+
<demo:PrettyPre addStyleNames="lang-xml">
48+
&emsp;&lt;m:MaterialCheckBox text="Blue" value="true" /><br/>
49+
&lt;m:MaterialCheckBox text="Red" /><br/>
50+
&lt;m:MaterialCheckBox text="Cyan" value="true" type="FILLED"/><br/>
51+
&lt;m:MaterialCheckBox text="Green" value="true" enabled="false"/><br/>
52+
&lt;m:MaterialCheckBox text="Brown" enabled="false"/><br/>
53+
&lt;m:MaterialCheckBox ui:field="cbBox" text="CheckBox 1: true" value="true" type="FILLED"/><br/>
54+
</demo:PrettyPre>
55+
56+
<demo:PrettyPre addStyleNames="lang-xml">
57+
&emsp;&lt;m:MaterialCheckBox ui:field="cbBoxAll" text="Check all" type="FILLED"/><br/>
58+
&lt;m:MaterialCheckBox ui:field="cbBlue" text="Blue" type="FILLED" /><br/>
59+
&lt;m:MaterialCheckBox ui:field="cbRed" text="Red" type="FILLED"/><br/>
60+
&lt;m:MaterialCheckBox ui:field="cbCyan" text="Cyan" type="FILLED"/><br/>
61+
&lt;m:MaterialCheckBox ui:field="cbGreen" text="Green" type="FILLED"/><br/>
62+
&lt;m:MaterialCheckBox ui:field="cbBrown" text="Brown" type="FILLED"/><br/>
63+
</demo:PrettyPre>
64+
</m:MaterialRow>
65+
66+
<m:MaterialRow addStyleNames="code">
67+
<m:MaterialBadge text="FEATURE UPDATE" textColor="AMBER" shadow="1" layoutPosition="RELATIVE" float="RIGHT" backgroundColor="AMBER_LIGHTEN_5" />
68+
<m:MaterialTitle title="CheckBox : setValue(value, fireEvents)"/>
69+
<m:MaterialCheckBox ui:field="cbValue" text="CheckBox"/>
70+
71+
<m:MaterialRow>
72+
<m:MaterialButton text="Set Value" ui:field="btnCbValue" marginRight="20" />
73+
<m:MaterialButton text="Set Value with Event" ui:field="btnCbValueEvent" />
74+
</m:MaterialRow>
75+
<demo:PrettyPre addStyleNames="lang-java">
76+
&emsp;// Set Value with firing the value change event <br/>
77+
checkBox.setValue(true, true); <br/>
78+
// Set Value without firing the value change event <br/>
79+
checkBox.setValue(false);<br/>
80+
checkBox.setValue(false, false);
81+
</demo:PrettyPre>
82+
</m:MaterialRow>
83+
</m:MaterialRow>
84+
</ui:UiBinder>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package gwt.material.design.demo.client.application.components.forms.listbox;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 - 2016 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+
*/
22+
23+
24+
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
25+
26+
public class ListBoxModule extends AbstractPresenterModule {
27+
@Override
28+
protected void configure() {
29+
bindPresenter(ListBoxPresenter.class, ListBoxPresenter.MyView.class,
30+
ListBoxView.class, ListBoxPresenter.MyProxy.class);
31+
}
32+
}

0 commit comments

Comments
 (0)