Skip to content

Commit 1ada6d9

Browse files
committed
Missing checkbox setValues() demo and codeblocks.
1 parent 23dfe79 commit 1ada6d9

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ interface Binder extends UiBinder<Widget, FormsView> {
3838
}
3939

4040
@UiField MaterialListBox lstOptions, lstSetValue;
41-
@UiField MaterialCheckBox cbBoxAll, cbBox, cbBlue, cbRed, cbCyan, cbGreen, cbBrown;
41+
@UiField MaterialCheckBox cbBoxAll, cbBox, cbBlue, cbRed, cbCyan, cbGreen, cbBrown, cbValue;
4242

4343
@UiField MaterialSwitch switch1, switch2, switchSetValue;
4444
@UiField MaterialLabel lblRange;
@@ -240,6 +240,21 @@ void onCheckAll(ValueChangeEvent<Boolean> e) {
240240
}
241241
}
242242

243+
@UiHandler("cbValue")
244+
void onCheckValue(ValueChangeEvent<Boolean> e) {
245+
MaterialToast.fireToast("Value : " + e.getValue());
246+
}
247+
248+
@UiHandler("btnCbValue")
249+
void onClickCbValue(ClickEvent e) {
250+
cbValue.setValue(true);
251+
}
252+
253+
@UiHandler("btnCbValueEvent")
254+
void onClickCbValueEvent(ClickEvent e) {
255+
cbValue.setValue(false, true);
256+
}
257+
243258
@UiHandler("lstSetValue")
244259
void onListBoxSetValue(ValueChangeEvent<String> e) {
245260
MaterialToast.fireToast(e.getValue());

src/main/java/gwt/material/design/demo/client/application/components/forms/FormsView.ui.xml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@
336336
</m:MaterialRow>
337337
<demo:PrettyPre addStyleNames="lang-java">
338338
&emsp;// Set Value with firing the value change event <br/>
339-
range.setValue(true, true); <br/>
339+
radio.setValue(true, true); <br/>
340340
// Set Value without firing the value change event <br/>
341-
range.setValue(true);<br/>
342-
range.setValue(true, false);
341+
radio.setValue(false);<br/>
342+
radio.setValue(false, false);
343343
</demo:PrettyPre>
344344
</m:MaterialRow>
345345

@@ -382,6 +382,24 @@
382382
&lt;m:MaterialCheckBox ui:field="cbBrown" text="Brown" type="FILLED"/><br/>
383383
</demo:PrettyPre>
384384
</m:MaterialRow>
385+
386+
<m:MaterialRow addStyleNames="code">
387+
<m:MaterialBadge text="FEATURE UPDATE" textColor="AMBER" shadow="1" layoutPosition="RELATIVE" float="RIGHT" backgroundColor="AMBER_LIGHTEN_5" />
388+
<m:MaterialTitle title="CheckBox : setValue(value, fireEvents)"/>
389+
<m:MaterialCheckBox ui:field="cbValue" text="CheckBox"/>
390+
391+
<m:MaterialRow>
392+
<m:MaterialButton text="Set Value" ui:field="btnCbValue" marginRight="20" />
393+
<m:MaterialButton text="Set Value with Event" ui:field="btnCbValueEvent" />
394+
</m:MaterialRow>
395+
<demo:PrettyPre addStyleNames="lang-java">
396+
&emsp;// Set Value with firing the value change event <br/>
397+
checkBox.setValue(true, true); <br/>
398+
// Set Value without firing the value change event <br/>
399+
checkBox.setValue(false);<br/>
400+
checkBox.setValue(false, false);
401+
</demo:PrettyPre>
402+
</m:MaterialRow>
385403

386404
<m:MaterialRow addStyleNames="code">
387405
<m:MaterialTitle title="Switches" />

0 commit comments

Comments
 (0)