Skip to content

Commit

Permalink
Merge pull request #52 from GwtMaterialDesign/release_2.0
Browse files Browse the repository at this point in the history
Release 2.0-rc4
  • Loading branch information
kevzlou7979 authored Mar 9, 2017
2 parents c18e4e8 + ed7155b commit e8187d2
Show file tree
Hide file tree
Showing 34 changed files with 837 additions and 74 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#gwt-material-demo [![Build Status](https://travis-ci.org/GwtMaterialDesign/gwt-material-demo.svg?branch=master)](https://travis-ci.org/GwtMaterialDesign/gwt-material-demo)
Demo application to show the features of the [gwt-material](https://github.com/GwtMaterialDesign/gwt-material) library.

### Release 2.0-rc3 Demo
### Release 2.0-rc4 Demo
[http://gwtmaterialdesign.github.io/gwt-material-demo](http://gwtmaterialdesign.github.io/gwt-material-demo)
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-demo</artifactId>
<version>2.0-rc3</version>
<version>2.0-rc4</version>
</dependency>
```

Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.0-rc3</version>
<version>2.0-rc4</version>
</parent>

<modelVersion>4.0.0</modelVersion>

<artifactId>gwt-material-demo</artifactId>
<packaging>war</packaging>
<version>2.0-rc3</version>
<version>2.0-rc4</version>
<name>Gwt Material Demo</name>
<description>Showcase for gwt-material</description>

Expand All @@ -34,8 +34,8 @@
<gwt.version>2.8.0</gwt.version>
<gwtp.version>1.5.3</gwtp.version>
<gin.version>2.1.2</gin.version>
<gwt-material.version>2.0-rc3</gwt-material.version>
<gwt-material-table.version>1.0-rc3</gwt-material-table.version>
<gwt-material.version>2.0-rc4</gwt-material.version>
<gwt-material-table.version>1.0-rc4</gwt-material-table.version>

<gwt.style>PRETTY</gwt.style>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
</m:MaterialRow>

<m:MaterialFooterCopyright ui:field="footerCopyRight" addStyleNames="footer-copyright">
<m:MaterialLabel text="© 2016 Copyright GWT Material" />
<m:MaterialLabel text="© 2017 Copyright GWT Material" />
</m:MaterialFooterCopyright>
</m:MaterialFooter>
</g:HTMLPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface Binder extends UiBinder<Widget, AutoCompleteView> {
}

@UiField
MaterialAutoComplete acList, acListType, acListLimit, acModal;
MaterialAutoComplete acList, acListType, acListLimit, acModal, acValue;

@UiField
MaterialModal modal;
Expand All @@ -60,18 +60,21 @@ interface Binder extends UiBinder<Widget, AutoCompleteView> {
UserOracle oracle = new UserOracle();
oracle.addContacts(getAllUsers());
acList.setSuggestions(oracle);
acValue.setSuggestions(oracle);
acList.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {
@Override
public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
MaterialToast.fireToast(event.getSelectedItem().getDisplayString() + " Selected");
}
});
acList.addValueChangeHandler(new ValueChangeHandler<List<? extends SuggestOracle.Suggestion>>() {
@Override
public void onValueChange(ValueChangeEvent<List<? extends SuggestOracle.Suggestion>> event) {
for(SuggestOracle.Suggestion user : event.getValue()){
MaterialToast.fireToast("Value : " + user.getDisplayString());
}
acList.addValueChangeHandler(event -> {
for(SuggestOracle.Suggestion user : event.getValue()){
MaterialToast.fireToast("Value : " + user.getDisplayString());
}
});
acValue.addValueChangeHandler(event -> {
for(SuggestOracle.Suggestion user : event.getValue()){
MaterialToast.fireToast("Value : " + user.getDisplayString());
}
});
acListType.setSuggestions(oracle);
Expand All @@ -92,6 +95,22 @@ void onGetAll(ClickEvent e) {
}
}

@UiHandler("btnAcValue")
void onAcValue(ClickEvent e) {
List<String> itemValues = new ArrayList<>();
itemValues.add(getAllUsers().get(0).getName());
itemValues.add(getAllUsers().get(1).getName());
acValue.setItemValues(itemValues);
}

@UiHandler("btnAcValueEvent")
void onAcValueEvent(ClickEvent e) {
List<String> itemValues = new ArrayList<>();
itemValues.add(getAllUsers().get(2).getName());
itemValues.add(getAllUsers().get(3).getName());
acValue.setItemValues(itemValues, true);
}

public List<User> getSelectedUsers() {
List<? extends SuggestOracle.Suggestion> values = acList.getValue();
List<User> users = new ArrayList<>(values.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@
});
</demo:PrettyPre>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialBadge text="FEATURE UPDATE" textColor="AMBER" shadow="1" layoutPosition="RELATIVE" float="RIGHT" backgroundColor="AMBER_LIGHTEN_5" />
<m:MaterialTitle title="Autocomplete : setValue(value, fireEvents)"/>

<ma:autocomplete.MaterialAutoComplete ui:field="acValue" placeholder="Contacts" grid="s12"/>

<m:MaterialButton text="Set Value" ui:field="btnAcValue" marginRight="20" />
<m:MaterialButton text="Set Value with Event" ui:field="btnAcValueEvent" />
<demo:PrettyPre addStyleNames="lang-java">
&emsp;// Will not fire value change event.<br/>
List&lt;String> itemValues = new ArrayList&lt;>();<br/>
itemValues.add(getAllUsers().get(0).getName());<br/>
itemValues.add(getAllUsers().get(1).getName());<br/>
acValue.setItemValues(itemValues);<br/><br/>
// Will fire value change event.<br/>
List&lt;String> itemValues = new ArrayList&lt;>();<br/>
itemValues.add(getAllUsers().get(2).getName());<br/>
itemValues.add(getAllUsers().get(3).getName());<br/>
acValue.setItemValues(itemValues, true);<br/>
</demo:PrettyPre>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialTitle title="Clearing Items on Autocomplete" description="You can easily clear the Autocomplete List Items by calling autocomlete.clear()"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ interface Binder extends UiBinder<Widget, ComboBoxView> {
comboTimeZone11, comboTimeZone12, comboTimeZone12_1, comboTimeZone13, comboTimeZone14,
comboTimeZone15, comboTimeZone16, comboTimeZone17, comboCloseOnSelect;

@UiField
MaterialComboBox<State> comboValue;

@UiField
MaterialModal modal;

Expand Down Expand Up @@ -84,6 +87,7 @@ protected void populateTimeZones() {
addStateItems(comboTimeZone14);
addStateItems(comboTimeZone15);
addStateItems(comboTimeZone17);
addStateItems(comboValue);
addItemsWithoutGroup(comboCloseOnSelect);

comboTimeZone8.addValueChangeHandler(valueChangeEvent -> {
Expand Down Expand Up @@ -191,6 +195,21 @@ void onSetValues(ClickEvent e) {
comboTimeZone14.setEnabled(false);
}

@UiHandler("comboValue")
void onComboValue(ValueChangeEvent<State> e) {
MaterialToast.fireToast("Value : " + e.getValue().getName());
}

@UiHandler("btnComboValue")
void onClickComboValue(ClickEvent e) {
comboValue.setValue(comboValue.getValues().get(2), false);
}

@UiHandler("btnComboValueEvent")
void onComboValueEvent(ClickEvent e) {
comboValue.setValue(comboValue.getValues().get(0), true);
}

@UiHandler("btnGetValue2")
void onGetValue2(ClickEvent e) {
MaterialToast.fireToast(comboTimeZone13.getSelectedValue().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@
</m:MaterialColumn>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialBadge text="FEATURE UPDATE" textColor="AMBER" shadow="1" layoutPosition="RELATIVE" float="RIGHT" backgroundColor="AMBER_LIGHTEN_5" />
<m:MaterialTitle title="Placeholder : Singe Selection" description="Note that because browsers assume the first option element is selected in non-multi-value select boxes an empty first option element must be provided for the placeholder to work." />
<m:MaterialColumn grid="l6 m6 s12">
<combobox:MaterialComboBox placeholder="This is a placeholder" allowClear="true">
<m:html.Option text="" />
<m:html.Option text="Item 1" />
<m:html.Option text="Item 2" />
<m:html.Option text="Item 3" />
</combobox:MaterialComboBox>
</m:MaterialColumn>
<m:MaterialColumn grid="l12 m12 s12">
<demo:PrettyPre addStyleNames="lang-xml">
&emsp;&lt;combobox:MaterialComboBox placeholder="This is a placeholder" allowClear="true"><br/>
&emsp;&lt;m:html.Option text="" /><br/>
&emsp;&lt;m:html.Option text="Item 1" /><br/>
&emsp;&lt;m:html.Option text="Item 2" /><br/>
&emsp;&lt;m:html.Option text="Item 3" /><br/>
&lt;/combobox:MaterialComboBox><br/>
</demo:PrettyPre>
</m:MaterialColumn>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialColumn grid="l12 m12 s12">
<m:MaterialTitle title="Java : Adding Options" description="Populating your data can be done using java. By calling combobox.addItem(String, T)" />
Expand Down Expand Up @@ -325,6 +348,23 @@
</m:MaterialColumn>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialBadge text="FEATURE UPDATE" textColor="AMBER" shadow="1" layoutPosition="RELATIVE" float="RIGHT" backgroundColor="AMBER_LIGHTEN_5" />
<m:MaterialTitle title="ComboBox : setValue(value, fireEvents)"/>

<combobox:MaterialComboBox placeholder="Time Zone" ui:field="comboValue" />

<m:MaterialButton text="Set Value" ui:field="btnComboValue" marginRight="20" />
<m:MaterialButton text="Set Value with Event" ui:field="btnComboValueEvent" />
<demo:PrettyPre addStyleNames="lang-java">
// Will not fire an event<br/>
comboValue.setValue(comboValue.getValues().get(2));<br/>
comboValue.setValue(comboValue.getValues().get(2), false);<br/><br/>
// Will fire an event<br/>
comboValue.setValue(comboValue.getValues().get(0), true);<br/>
</demo:PrettyPre>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialTitle title="Programmatic Access" description="MaterialCombobox supports methods that allow programmatic control of the component."/>
<m:MaterialColumn grid="l6 m6 s12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
*/


import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewImpl;
import gwt.material.design.addins.client.fileuploader.MaterialFileUploader;
Expand All @@ -38,7 +41,7 @@ interface Binder extends UiBinder<Widget, FileUploaderView> {
}

@UiField
MaterialFileUploader uploader;
MaterialFileUploader uploader, uploaderEnable;

@Inject
FileUploaderView(Binder uiBinder) {
Expand Down Expand Up @@ -109,4 +112,9 @@ public void onMaxFilesReached(MaxFilesReachedEvent<UploadFile> event) {
}
});
}

@UiHandler("switchEnable")
void onSwitchEnable(ValueChangeEvent<Boolean> e) {
uploaderEnable.setEnabled(e.getValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@
&lt;/ma:fileuploader.MaterialFileUploader><br/>
</demo:PrettyPre>
</m:MaterialRow>

<m:MaterialRow addStyleNames="code">
<m:MaterialBadge text="FEATURE UPDATE" textColor="AMBER" shadow="1" layoutPosition="RELATIVE" float="RIGHT" backgroundColor="AMBER_LIGHTEN_5" />
<m:MaterialTitle title="Disable Uploader" description="You can easily disable the file uploader by calling enable='false'" />
<m:MaterialSwitch ui:field="switchEnable" onLabel="Enable" offLabel="Disable" />
<ma:fileuploader.MaterialFileUploader ui:field="uploaderEnable" url="/fileupload" method="POST" maxFileSize="20" shadow="1" enabled="false">
<ma:fileuploader.MaterialUploadLabel title="Drag Files to Upload" description="Some description here" />
</ma:fileuploader.MaterialFileUploader>

<demo:PrettyPre addStyleNames="lang-xml">
&emsp;&lt;ma:fileuploader.MaterialFileUploader ui:field="uploader" enabled="false" url="/uploadServlet" maxFileSize="20" shadow="1"><br/>
&emsp;&lt;ma:fileuploader.MaterialUploadLabel title="Drag Files to Upload" description="Some description here" /><br/>
&lt;/ma:fileuploader.MaterialFileUploader><br/><br/>

// For java<br/>
uploader.setEnabled(false);
</demo:PrettyPre>
</m:MaterialRow>

<g:HTMLPanel addStyleNames="code">
<m:MaterialTitle title="Properties" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ interface Binder extends UiBinder<Widget, PathAnimatorView> {
}

@UiField
MaterialButton btnSource1, btnSource3;
MaterialButton btnOptionSource, btnSource1, btnSource3;

@UiField
MaterialCard card, panelTarget3;
MaterialCard card, panelTarget3, panelWithOptions;

@UiField
MaterialLink btnSource2;
MaterialLink btnSource2, btnCloseWithOptions;

@UiField
MaterialIcon btnSource4;
Expand All @@ -56,9 +56,37 @@ interface Binder extends UiBinder<Widget, PathAnimatorView> {
@UiField
MaterialColumn col1, col2, col3, col4, col5, col6, col7;

@UiField
MaterialDoubleBox txtDuration, txtTargetShowDuration, txtExtraTransitionDuration;

private MaterialPathAnimator animator = new MaterialPathAnimator();

@Inject
PathAnimatorView(Binder uiBinder) {
initWidget(uiBinder.createAndBindUi(this));
txtDuration.setValue(0.3);
txtDuration.setHelperText("Duration (in seconds) of animation. Default is 0.3 seconds.");

txtTargetShowDuration.setValue(0.0);
txtTargetShowDuration.setHelperText("Duration (in seconds) of targetElement to become visible, if hidden initially. The library will automatically try to figure this out from the element's computed styles. Default is 0 seconds.");

txtExtraTransitionDuration.setValue(1.0);
txtExtraTransitionDuration.setHelperText("Extra duration (in seconds) of targetElement to provide visual continuity between the animation and the rendering of the targetElement. Default is 1 second");
}

@UiHandler("btnCloseWithOptions")
void onCloseWithOptions(ClickEvent e) {
animator.reverseAnimate();
}

@UiHandler("btnOptionSource")
void onOptionSource(ClickEvent e) {
animator.setSourceElement(btnOptionSource.getElement());
animator.setTargetElement(panelWithOptions.getElement());
animator.setDuration(txtDuration.getValue());
animator.setTargetShowDuration(txtTargetShowDuration.getValue());
animator.setExtraTransitionDuration(txtExtraTransitionDuration.getValue());
animator.animate();
}

@UiHandler("btnSource1")
Expand Down
Loading

0 comments on commit e8187d2

Please sign in to comment.