Skip to content

Commit

Permalink
Merge pull request #364 from GwtMaterialDesign/release_2.1.1
Browse files Browse the repository at this point in the history
Release 2.1.1
  • Loading branch information
kevzlou7979 authored Aug 30, 2018
2 parents adee37d + efedc01 commit 7b2676d
Show file tree
Hide file tree
Showing 38 changed files with 1,209 additions and 689 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ cache:
- $HOME/.m2
before_install:
# install the gwt-material-jquery library before we build the demo
- git clone -b master https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- git clone -b release_2.1.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- cd gwt-material-jquery
- mvn install -DskipTests=true -DdryRun=true
- cd ..
# install the gwt-material library before we build the demo
- git clone -b master https://github.com/GwtMaterialDesign/gwt-material.git
- git clone -b release_2.1.1 https://github.com/GwtMaterialDesign/gwt-material.git
- cd gwt-material
- mvn install -DskipTests=true -DdryRun=true
- cd ..
Expand Down
2 changes: 1 addition & 1 deletion .utility/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.1.1" ]; then
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy --settings ~/settings.xml
fi
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@

Gwt Material Design Extra Components for https://github.com/GwtMaterialDesign/gwt-material <br>

## Current Version 2.1
## Current Version 2.1.1
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>2.1</version>
<version>2.1.1</version>
</dependency>
```

## Snapshot Version 2.1.1-SNAPSHOT
## Snapshot Version 2.2-SNAPSHOT
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-addins</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
```

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

<artifactId>gwt-material-addins</artifactId>
<packaging>gwt-lib</packaging>

<name>Gwt Material Addins</name>
<version>2.1</version>
<version>2.1.1</version>
<description>Extra Components of GWT Material Framework</description>

<properties>
<gwt-material.version>2.1</gwt-material.version>
<gwt-material.version>2.1.1</gwt-material.version>
</properties>

<scm>
<connection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</connection>
<developerConnection>scm:git:[email protected]:GwtMaterialDesign/gwt-material-addins.git</developerConnection>
<url>http://github.com/GwtMaterialDesign/gwt-material-addins</url>
<tag>v2.1</tag>
<tag>v2.1.1</tag>
</scm>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,59 +232,65 @@ protected void onLoad() {

protected void loadHandlers() {

itemBoxBlurHandler = itemBox.addBlurHandler(blurEvent -> {
if (getValue().size() > 0) {
label.addStyleName(CssName.ACTIVE);
}
});
if (itemBoxBlurHandler == null) {
itemBoxBlurHandler = itemBox.addBlurHandler(blurEvent -> {
if (getValue().size() > 0) {
label.addStyleName(CssName.ACTIVE);
}
});
}

itemBoxKeyDownHandler = itemBox.addKeyDownHandler(event -> {
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_ENTER:
if (directInputAllowed) {
String value = itemBox.getValue();
if (value != null && !(value = value.trim()).isEmpty()) {
gwt.material.design.client.base.Suggestion directInput = new gwt.material.design.client.base.Suggestion();
directInput.setDisplay(value);
directInput.setSuggestion(value);
addItem(directInput);
if (getType() == AutocompleteType.TEXT) {
itemBox.setText(value);
} else {
itemBox.setValue("");
if (itemBoxKeyDownHandler == null) {
itemBoxKeyDownHandler = itemBox.addKeyDownHandler(event -> {
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_ENTER:
if (directInputAllowed) {
String value = itemBox.getValue();
if (value != null && !(value = value.trim()).isEmpty()) {
gwt.material.design.client.base.Suggestion directInput = new gwt.material.design.client.base.Suggestion();
directInput.setDisplay(value);
directInput.setSuggestion(value);
addItem(directInput);
if (getType() == AutocompleteType.TEXT) {
itemBox.setText(value);
} else {
itemBox.setValue("");
}
itemBox.setFocus(true);
}
itemBox.setFocus(true);
}
}
break;
case KeyCodes.KEY_BACKSPACE:
if (itemBox.getValue().trim().isEmpty()) {
if (itemsHighlighted.isEmpty()) {
if (suggestionMap.size() > 0) {
ListItem li = (ListItem) list.getWidget(list.getWidgetCount() - 2);

if (tryRemoveSuggestion(li.getWidget(0))) {
li.removeFromParent();
break;
case KeyCodes.KEY_BACKSPACE:
if (itemBox.getValue().trim().isEmpty()) {
if (itemsHighlighted.isEmpty()) {
if (suggestionMap.size() > 0) {
ListItem li = (ListItem) list.getWidget(list.getWidgetCount() - 2);

if (tryRemoveSuggestion(li.getWidget(0))) {
li.removeFromParent();
}
}
}
}
}
break;
case KeyCodes.KEY_DELETE:
if (itemBox.getValue().trim().isEmpty()) {
for (ListItem li : itemsHighlighted) {
if (tryRemoveSuggestion(li.getWidget(0))) {
li.removeFromParent();
break;
case KeyCodes.KEY_DELETE:
if (itemBox.getValue().trim().isEmpty()) {
for (ListItem li : itemsHighlighted) {
if (tryRemoveSuggestion(li.getWidget(0))) {
li.removeFromParent();
}
}
itemsHighlighted.clear();
}
itemsHighlighted.clear();
}
itemBox.setFocus(true);
break;
}
});
itemBox.setFocus(true);
break;
}
});
}

itemBoxClickHandler = itemBox.addClickHandler(event -> suggestBox.showSuggestionList());
if (itemBoxClickHandler == null) {
itemBoxClickHandler = itemBox.addClickHandler(event -> suggestBox.showSuggestionList());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,11 @@ public void setValue(List<T> values, boolean fireEvents) {
*/
public void setSingleValue(T value, boolean fireEvents) {
int index = this.values.indexOf(value);
if (index >= 0) {
if (index < 0 && value instanceof String) {
index = getIndexByString((String) value);
}

if (index > -1) {
List<T> before = getValue();
setSelectedIndex(index);

Expand All @@ -542,6 +546,29 @@ public void setSingleValue(T value, boolean fireEvents) {
}
}

// TODO: Optimize performance (maybe use a map)
public T getValueByString(String key) {
for (T value : values) {
if (keyFactory.generateKey(value).equals(key)) {
return value;
}
}
return null;
}

// TODO: Optimize performance (maybe use a map)
public int getIndexByString(String key) {
int index = -1;

for (T value : values) {
++index;
if (keyFactory.generateKey(value).equals(key)) {
return index;
}
}
return index;
}

/**
* Set directly all the values that will be stored into
* combobox and build options into it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class MaterialEmptyState extends MaterialWidget implements HasIcon, HasTi

public MaterialEmptyState() {
super(Document.get().createDivElement(), CssName.VALIGN_WRAPPER, AddinsCssName.EMPTY_STATE);

setIconSize(IconSize.LARGE);
}

public MaterialEmptyState(Color bgColor, Color textColor, IconType iconType, String title, String description) {
Expand All @@ -89,7 +91,6 @@ protected void onLoad() {
container.setWidth("100%");
container.setStyleName(CssName.VALIGN + " " + CssName.CENTER);
container.add(title);
icon.setIconSize(IconSize.LARGE);
title.insert(icon, 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ protected void onLoad() {

@Override
public void load() {

JsRichEditor jsRichEditor = $(getElement());

options.toolbar = manager.getToolbars();
Expand Down Expand Up @@ -264,11 +263,7 @@ protected void adjustNestedDialog(MaterialDialog dialog) {
protected void adjustFullScreen(MaterialDialog dialog) {
getEditor().find("div[data-event='fullscreen']").off("click").on("click", (e, param1) -> {
dialog.setFullscreen(toggleFullScreen);
if (toggleFullScreen) {
toggleFullScreen = false;
} else {
toggleFullScreen = true;
}
toggleFullScreen = !toggleFullScreen;
return true;
});
}
Expand Down
Loading

0 comments on commit 7b2676d

Please sign in to comment.