Skip to content

Commit 6afad74

Browse files
committed
Added showcase and codeblocks for Autocomplete component inside Modal.
1 parent bb83c2c commit 6afad74

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

src/main/java/gwt/material/design/demo/client/application/addins/autocomplete/AutoCompleteView.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package gwt.material.design.demo.client.application.addins.autocomplete;
22

33
import com.google.gwt.event.dom.client.ClickEvent;
4-
import com.google.gwt.event.logical.shared.ValueChangeEvent;
54
import com.google.gwt.uibinder.client.UiBinder;
65
import com.google.gwt.uibinder.client.UiField;
76
import com.google.gwt.uibinder.client.UiHandler;
8-
import com.google.gwt.user.client.ui.Image;
97
import com.google.gwt.user.client.ui.SuggestOracle;
108
import com.google.gwt.user.client.ui.Widget;
119
import com.gwtplatform.mvp.client.ViewImpl;
1210
import gwt.material.design.addins.client.autocomplete.MaterialAutoComplete;
13-
import gwt.material.design.addins.client.autocomplete.base.MaterialSuggestionOracle;
11+
import gwt.material.design.client.ui.MaterialModal;
1412
import gwt.material.design.client.ui.MaterialToast;
1513
import gwt.material.design.demo.client.application.addins.autocomplete.base.User;
1614
import gwt.material.design.demo.client.application.addins.autocomplete.base.UserOracle;
@@ -26,7 +24,10 @@ interface Binder extends UiBinder<Widget, AutoCompleteView> {
2624
}
2725

2826
@UiField
29-
MaterialAutoComplete acList, acListType, acListLimit;
27+
MaterialAutoComplete acList, acListType, acListLimit, acModal;
28+
29+
@UiField
30+
MaterialModal modal;
3031

3132
@Inject
3233
AutoCompleteView(Binder uiBinder) {
@@ -36,6 +37,7 @@ interface Binder extends UiBinder<Widget, AutoCompleteView> {
3637
acList.setSuggestions(oracle);
3738
acListType.setSuggestions(oracle);
3839
acListLimit.setSuggestions(oracle);
40+
acModal.setSuggestions(oracle);
3941
}
4042

4143

@@ -79,4 +81,14 @@ public List<User> getAllUsers() {
7981
list.add(new User("https://s3.amazonaws.com/uifaces/faces/twitter/tonymillion/128.jpg", User.Position.MARKETING, false, "Clint Heller", "[email protected]", "123123123", "645-555-65", "Makati City, Philippines", "Gwt Material"));
8082
return list;
8183
}
84+
85+
@UiHandler("btnOpenModal")
86+
void onOpenModal(ClickEvent e) {
87+
modal.openModal();
88+
}
89+
90+
@UiHandler("btnClose")
91+
void onClose(ClickEvent e) {
92+
modal.closeModal();
93+
}
8294
}

src/main/java/gwt/material/design/demo/client/application/addins/autocomplete/AutoCompleteView.ui.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,28 @@
8585
<demo:PrettyPre addStyleNames="lang-xml z-depth-1">
8686
&emsp;&lt;ma:autocomplete.MaterialAutoComplete limit="3" placeholder="States" />
8787
</demo:PrettyPre>
88+
89+
<m:MaterialTitle title="Inside Modal" description="You can build your overlay inside the modal" />
90+
<m:MaterialButton ui:field="btnOpenModal" text="Open Modal" textColor="white" waves="DEFAULT"/>
91+
<m:MaterialModal ui:field="modal">
92+
<m:MaterialModalContent>
93+
<m:MaterialTitle title="Select contacts" description="Some description here..."/>
94+
<ma:autocomplete.MaterialAutoComplete ui:field="acModal" placeholder="Contacts"/>
95+
</m:MaterialModalContent>
96+
<m:MaterialModalFooter textAlign="RIGHT">
97+
<m:MaterialButton ui:field="btnClose" text="Close" type="FLAT" textColor="black" waves="DEFAULT"/>
98+
</m:MaterialModalFooter>
99+
</m:MaterialModal>
100+
<demo:PrettyPre addStyleNames="lang-xml z-depth-1">
101+
&emsp;&lt;m:MaterialModal ui:field="modal"><br/>
102+
&emsp;&lt;m:MaterialModalContent><br/>
103+
&emsp;&lt;m:MaterialTitle title="Select contacts" description="Some description here..."/><br/>
104+
&emsp;&lt;ma:autocomplete.MaterialAutoComplete ui:field="acModal" placeholder="Contacts"/><br/>
105+
&emsp;&lt;/m:MaterialModalContent><br/>
106+
&emsp;&lt;m:MaterialModalFooter textAlign="RIGHT"><br/>
107+
&emsp;&lt;m:MaterialButton ui:field="btnClose" text="Close" type="FLAT" textColor="black" waves="DEFAULT"/><br/>
108+
&emsp;&lt;/m:MaterialModalFooter><br/>
109+
&lt;/m:MaterialModal><br/>
110+
</demo:PrettyPre>
88111
</g:HTMLPanel>
89112
</ui:UiBinder>

0 commit comments

Comments
 (0)