From 32dd52d1c97f99c471ac7993fb584da34de8da4c Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Tue, 24 Jul 2018 21:05:09 +0800 Subject: [PATCH 1/8] Iteration for next 2.1.1-SNAPSHOT --- .travis.yml | 2 +- .utility/deploy.sh | 2 +- gwt-material/pom.xml | 4 ++-- pom.xml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9bf7d83b..7163b452c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: - $HOME/.m2 before_install: # install the gwt-material-jquery because it will depends on built in jquery -- 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 .. diff --git a/.utility/deploy.sh b/.utility/deploy.sh index 6a2ced0db..f56a6e2ef 100644 --- a/.utility/deploy.sh +++ b/.utility/deploy.sh @@ -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 "ossrh\${env.OSSRH_USER}\${env.OSSRH_PASS}" > ~/settings.xml mvn deploy --settings ~/settings.xml fi \ No newline at end of file diff --git a/gwt-material/pom.xml b/gwt-material/pom.xml index 7b557b5c1..73a88be93 100644 --- a/gwt-material/pom.xml +++ b/gwt-material/pom.xml @@ -4,7 +4,7 @@ gwt-material-parent com.github.gwtmaterialdesign - 2.1 + 2.1.1-SNAPSHOT 4.0.0 @@ -18,7 +18,7 @@ com.github.gwtmaterialdesign gwt-material-jquery - 2.1 + 2.1.1-SNAPSHOT com.google.gwt diff --git a/pom.xml b/pom.xml index 5b18a0dc2..9ada5abc8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.gwtmaterialdesign gwt-material-parent - 2.1 + 2.1.1-SNAPSHOT pom gwt-material @@ -65,7 +65,7 @@ scm:git:git@github.com:GwtMaterialDesign/gwt-material.git scm:git:git@github.com:GwtMaterialDesign/gwt-material.git http://github.com/GwtMaterialDesign/gwt-material - v2.1 + v2.1.1-SNAPSHOT From 4b7d8e1fa835e9c1aaeb230886d9039601821a04 Mon Sep 17 00:00:00 2001 From: BenDol Date: Fri, 3 Aug 2018 03:07:06 +1200 Subject: [PATCH 2/8] Improve MaterialToast and added MaterialListValueBox#getIndexByString Also some minor clean up --- .../client/base/helper/EventHelper.java | 19 +++--- .../design/client/ui/MaterialDatePicker.java | 27 +++----- .../client/ui/MaterialListValueBox.java | 28 ++++++++- .../design/client/ui/MaterialRange.java | 43 ++----------- .../design/client/ui/MaterialSwitch.java | 20 ------ .../design/client/ui/MaterialToast.java | 63 +++++++++++++++---- 6 files changed, 104 insertions(+), 96 deletions(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/helper/EventHelper.java b/gwt-material/src/main/java/gwt/material/design/client/base/helper/EventHelper.java index fb676bf26..01020739b 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/base/helper/EventHelper.java +++ b/gwt-material/src/main/java/gwt/material/design/client/base/helper/EventHelper.java @@ -30,14 +30,19 @@ public final class EventHelper { public static void onAttachOnce(HasAttachHandlers has, AttachEvent.Handler handler) { HandlerRegistration[] reg = new HandlerRegistration[1]; - reg[0] = has.addAttachHandler(event -> { - if(event.isAttached()) { - handler.onAttachOrDetach(event); - if (reg[0] != null) { - reg[0].removeHandler(); + if (has.isAttached()) { + handler.onAttachOrDetach(null); + } else { + reg[0] = has.addAttachHandler(event -> { + if (event.isAttached()) { + handler.onAttachOrDetach(event); + + if (reg[0] != null) { + reg[0].removeHandler(); + } } - } - }); + }); + } } } diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java index 663e9d01f..6a2746db4 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java @@ -190,8 +190,6 @@ public void reload() { /** * As of now use {@link MaterialDatePicker#setSelectionType(MaterialDatePickerType)} - * - * @param type */ @Deprecated public void setDateSelectionType(MaterialDatePickerType type) { @@ -399,12 +397,7 @@ public void setFormat(String format) { @Override public Date getValue() { - if (isAttached()) { - return getPickerDate(); - } - else { - return this.date; - } + return isAttached() ? getPickerDate() : this.date; } @Override @@ -412,15 +405,15 @@ public void setValue(Date value, boolean fireEvents) { this.date = value; if (value == null) { clear(); - return; - } - if (isAttached()) { - suppressChangeEvent = !fireEvents; - setPickerDate(JsDate.create((double) value.getTime()), pickatizedDateInput); - suppressChangeEvent = false; - label.addStyleName(CssName.ACTIVE); + } else { + if (isAttached()) { + suppressChangeEvent = !fireEvents; + setPickerDate(JsDate.create((double) value.getTime()), pickatizedDateInput); + suppressChangeEvent = false; + label.addStyleName(CssName.ACTIVE); + } + super.setValue(value, fireEvents); } - super.setValue(value, fireEvents); } @Override @@ -476,7 +469,7 @@ protected void setupLanguage(DatePickerLanguage language) { if (language.getJs() != null) { ScriptInjector.fromString(language.getJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); getPicker().stop(); - Scheduler.get().scheduleDeferred(() -> load()); + Scheduler.get().scheduleDeferred(this::load); } } diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java index 83710493b..bf140617d 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java @@ -627,7 +627,11 @@ public void setValue(T value) { @Override public void setValue(T value, boolean fireEvents) { int index = values.indexOf(value); - if (index >= 0) { + if (index < 0 && value instanceof String) { + index = getIndexByString((String) value); + } + + if (index > -1) { T before = getValue(); setSelectedIndexInternal(index); @@ -637,6 +641,28 @@ public void setValue(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; + } + public boolean isOld() { return getToggleOldMixin().isOn(); } diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialRange.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialRange.java index f661dc514..b864e303c 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialRange.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialRange.java @@ -53,13 +53,15 @@ //@formatter:on public class MaterialRange extends AbstractValueWidget implements HasChangeHandlers, HasStatusText { + private static String VALUE = "value"; + private static String MAX = "max"; + private static String MIN = "min"; + private Paragraph paragraph = new Paragraph(); private MaterialInput rangeInputElement = new MaterialInput(); private Span thumb = new Span(); private Span value = new Span(); - private static String VALUE = "value"; - private static String MAX = "max"; - private static String MIN = "min"; + private MaterialLabel errorLabel = new MaterialLabel(); private StatusTextMixin statusTextMixin; @@ -195,41 +197,6 @@ public void setMax(Integer max) { setIntToRangeElement(MAX, max); } - @Override - public void setErrorText(String errorText) { - getStatusTextMixin().setErrorText(errorText); - } - - @Override - public void setSuccessText(String successText) { - getStatusTextMixin().setSuccessText(successText); - } - - @Override - public void setHelperText(String helperText) { - getStatusTextMixin().setHelperText(helperText); - } - - @Override - public void clearStatusText() { - getStatusTextMixin().clearStatusText(); - } - - @Override - public void clearErrorText() { - getStatusTextMixin().clearErrorText(); - } - - @Override - public void clearHelperText() { - getStatusTextMixin().clearHelperText(); - } - - @Override - public void clearSuccessText() { - getStatusTextMixin().clearSuccessText(); - } - public MaterialLabel getErrorLabel() { return errorLabel; } diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSwitch.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSwitch.java index ca20cf030..137bd04b9 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSwitch.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSwitch.java @@ -198,26 +198,6 @@ public void setLabel(Label label) { this.label = label; } - @Override - public void setErrorText(String errorText) { - getStatusTextMixin().setErrorText(errorText); - } - - @Override - public void setSuccessText(String successText) { - getStatusTextMixin().setSuccessText(successText); - } - - @Override - public void setHelperText(String helperText) { - getStatusTextMixin().setHelperText(helperText); - } - - @Override - public void clearStatusText() { - getStatusTextMixin().clearStatusText(); - } - /** * Set the On State Label of the switch component */ diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialToast.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialToast.java index 4ea4d1970..c69272e88 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialToast.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialToast.java @@ -19,12 +19,14 @@ */ package gwt.material.design.client.ui; +import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.Widget; import gwt.material.design.client.js.JsMaterialElement; import gwt.material.design.jquery.client.api.Functions; +import gwt.material.design.jquery.client.api.JQueryElement; import static gwt.material.design.jquery.client.api.JQuery.$; @@ -58,6 +60,8 @@ public class MaterialToast { private Functions.Func callback; private Widget[] widgets; + private JQueryElement element; + public MaterialToast(Widget... widgets) { this.widgets = widgets; } @@ -140,23 +144,19 @@ public void toast(String msg, String className) { * @param className class name to custom style your toast. */ public void toast(String msg, int lifeMillis, String className) { - String genId = DOM.createUniqueId(); - if (className == null) { - className = genId; + String id; + if (element != null) { + id = (String) element.attr("id"); } else { - className += ' ' + genId; + id = DOM.createUniqueId(); } - toast(msg, lifeMillis, genId, className, callback); - if (widgets != null) { - for (Widget widget : widgets) { - widget.getElement().getStyle().setPaddingLeft(30, Unit.PX); - RootPanel.get(genId).add(widget); - } + if (className == null) { + className = id; + } else { + className += ' ' + id; } - } - protected void toast(String msg, int lifeMillis, String id, String className, Functions.Func callback) { Object duration = lifeMillis; if (lifeMillis <= 0) { duration = "unlimited"; @@ -168,6 +168,43 @@ protected void toast(String msg, int lifeMillis, String id, String className, Fu } }); - $(".toast." + id).attr("id", id); + element = $(".toast." + id); + element.attr("id", id); + //element.toggleClass(className, true); + + if (widgets != null) { + RootPanel toast = RootPanel.get(id); + for (Widget widget : widgets) { + widget.getElement().getStyle().setPaddingLeft(20, Unit.PX); + toast.add(widget); + } + } + } + + public void close() { + String id = getId(); + if (id != null && !id.isEmpty()) { + Widget toast = RootPanel.get(id); + if (toast != null && toast.isAttached()) { + element.remove(); + } + } + } + + public boolean isOpen() { + String id = getId(); + if (id != null && !id.isEmpty()) { + Widget toast = RootPanel.get(id); + return toast.isAttached() && toast.isVisible(); + } + return false; + } + + public String getId() { + return element != null ? (String) element.attr("id") : null; + } + + public JQueryElement getElement() { + return element; } } From 82e59a1bd6b0b85fbc6d185a62904765b061af2b Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Tue, 7 Aug 2018 17:16:21 +0800 Subject: [PATCH 3/8] Fixed regression on SideNavigation can't close on mobile --- .../gwt/material/design/client/base/AbstractSideNav.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java b/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java index 7badf6640..1a57369b5 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java +++ b/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java @@ -242,6 +242,7 @@ public void load() { @Override public void unload() { + $("#sidenav-overlay").remove(); activator = null; } @@ -411,10 +412,6 @@ protected void onClosed() { protected void onOpening() { open = true; SideNavOpeningEvent.fire(this); - // Ensure to clean all the overlays attached before opening - // This will fixed multiple sidenav implementations with edge support. - $(".drag-target").remove(); - $("#sidenav-overlay").each((param1, element) -> element.removeFromParent()); } protected void onOpened() { From 8b284e2dc3b493ab87c52ea4e708e3da6ba9dad4 Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Tue, 7 Aug 2018 17:21:00 +0800 Subject: [PATCH 4/8] Fixed Theming issue on ResourcesBasic.gwt.xml --- .../main/resources/gwt/material/design/ResourcesBasic.gwt.xml | 2 +- .../{client/resources => public}/css/material-icons.min.css | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename gwt-material/src/main/resources/gwt/material/design/{client/resources => public}/css/material-icons.min.css (100%) diff --git a/gwt-material/src/main/resources/gwt/material/design/ResourcesBasic.gwt.xml b/gwt-material/src/main/resources/gwt/material/design/ResourcesBasic.gwt.xml index c6af4795c..d7d44265f 100644 --- a/gwt-material/src/main/resources/gwt/material/design/ResourcesBasic.gwt.xml +++ b/gwt-material/src/main/resources/gwt/material/design/ResourcesBasic.gwt.xml @@ -30,5 +30,5 @@ - + diff --git a/gwt-material/src/main/resources/gwt/material/design/client/resources/css/material-icons.min.css b/gwt-material/src/main/resources/gwt/material/design/public/css/material-icons.min.css similarity index 100% rename from gwt-material/src/main/resources/gwt/material/design/client/resources/css/material-icons.min.css rename to gwt-material/src/main/resources/gwt/material/design/public/css/material-icons.min.css From 2daa0ab6e4bdff762376cf62bc291429819880aa Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Tue, 14 Aug 2018 13:59:58 +0800 Subject: [PATCH 5/8] Proper fixed for multiple sidenav implemenations (Edges) --- .../design/client/base/AbstractSideNav.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java b/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java index 1a57369b5..aa4ed3d75 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java +++ b/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,6 +38,7 @@ import gwt.material.design.client.js.JsSideNavOptions; import gwt.material.design.client.ui.*; import gwt.material.design.client.ui.html.ListItem; +import gwt.material.design.jquery.client.api.JQueryElement; import static gwt.material.design.client.js.JsMaterialElement.$; @@ -242,7 +243,6 @@ public void load() { @Override public void unload() { - $("#sidenav-overlay").remove(); activator = null; } @@ -402,6 +402,7 @@ protected MaterialWidget getNavMenu() { protected void onClosing() { open = false; + $("#sidenav-overlay").remove(); SideNavClosingEvent.fire(this); } @@ -411,6 +412,8 @@ protected void onClosed() { protected void onOpening() { open = true; + + $("#sidenav-overlay").each((param1, element) -> element.removeFromParent()); SideNavOpeningEvent.fire(this); } @@ -418,6 +421,9 @@ protected void onOpened() { if (allowBodyScroll) { RootPanel.getBodyElement().getStyle().clearOverflow(); } + + String overlayZIndex = $("#sidenav-overlay").css("zIndex"); + $(".drag-target").css("zIndex", (overlayZIndex != null ? Integer.parseInt(overlayZIndex) : 1) + ""); SideNavOpenedEvent.fire(this); } @@ -552,6 +558,14 @@ public Element getActivator() { return activator; } + public JQueryElement getOverlayElement() { + return $("#sidenav-overlay"); + } + + public JQueryElement getDragTargetElement() { + return $(".drag-target"); + } + @Override public HandlerRegistration addOpeningHandler(SideNavOpeningEvent.SideNavOpeningHandler handler) { return addHandler(handler, SideNavOpeningEvent.TYPE); From 8695fde4dcf29b426dae14159488df5e98c2a03f Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Mon, 27 Aug 2018 05:41:00 +0800 Subject: [PATCH 6/8] Fixed MaterialCollapsible Issue programatically setting more than one active #869 --- .../gwt/material/design/client/ui/MaterialCollapsible.java | 4 +++- .../material/design/client/ui/MaterialCollapsibleItem.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java index f08534141..2bdbfa032 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java @@ -236,7 +236,9 @@ public boolean isAccordion() { @Override public void setActive(int index) { - clearActive(); + if (!isAccordion()) { + clearActive(); + } setActive(index, true); } diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java index 5a01bebd9..290ee0db6 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java @@ -156,7 +156,7 @@ public void setActive(boolean active) { header.removeStyleName(CssName.ACTIVE); } if (active) { - if (parent != null) { + if (parent != null && !parent.isAccordion()) { parent.clearActive(); } addStyleName(CssName.ACTIVE); From 80ae695d95dc0d64ccb6ab76513883a6226a9051 Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Mon, 27 Aug 2018 10:12:05 +0800 Subject: [PATCH 7/8] Added test case for #869 Improve active support for both accordion and expandable collapsibles. --- .../design/client/ui/MaterialCollapsible.java | 18 +++++++++++++++--- .../client/ui/MaterialCollapsibleItem.java | 2 +- .../client/ui/MaterialCollapsibleTest.java | 16 +++++++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java index 2bdbfa032..0ec7999f5 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java @@ -23,16 +23,17 @@ import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import gwt.material.design.client.base.*; import gwt.material.design.client.base.mixin.CssTypeMixin; import gwt.material.design.client.constants.CollapsibleType; import gwt.material.design.client.constants.CssName; +import gwt.material.design.client.constants.Display; import gwt.material.design.client.events.ClearActiveEvent; import gwt.material.design.client.events.ClearActiveEvent.ClearActiveHandler; import gwt.material.design.client.events.CollapseEvent; import gwt.material.design.client.events.ExpandEvent; -import gwt.material.design.client.base.HasCollapsibleHandlers; import static gwt.material.design.client.js.JsMaterialElement.$; @@ -173,13 +174,24 @@ public void clearActive() { ClearActiveEvent.fire(this); } + @Override + protected void clearActiveClass(HasWidgets widget) { + super.clearActiveClass(widget); + + for (Widget child : widget) { + if (child instanceof MaterialCollapsibleBody) { + ((MaterialCollapsibleBody) child).setDisplay(Display.NONE); + } + } + } + /** * Open the given collapsible item. * * @param index the one-based collapsible item index. */ public void open(int index) { - setActive(index, true); + setActive(index); } /** @@ -236,7 +248,7 @@ public boolean isAccordion() { @Override public void setActive(int index) { - if (!isAccordion()) { + if (isAccordion()) { clearActive(); } setActive(index, true); diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java index 290ee0db6..0b86c0d0d 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java @@ -156,7 +156,7 @@ public void setActive(boolean active) { header.removeStyleName(CssName.ACTIVE); } if (active) { - if (parent != null && !parent.isAccordion()) { + if (parent != null && parent.isAccordion()) { parent.clearActive(); } addStyleName(CssName.ACTIVE); diff --git a/gwt-material/src/test/java/gwt/material/design/client/ui/MaterialCollapsibleTest.java b/gwt-material/src/test/java/gwt/material/design/client/ui/MaterialCollapsibleTest.java index 75e335edd..70046c821 100644 --- a/gwt-material/src/test/java/gwt/material/design/client/ui/MaterialCollapsibleTest.java +++ b/gwt-material/src/test/java/gwt/material/design/client/ui/MaterialCollapsibleTest.java @@ -19,7 +19,6 @@ */ package gwt.material.design.client.ui; -import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.user.client.ui.Widget; import gwt.material.design.client.base.MaterialWidget; import gwt.material.design.client.constants.*; @@ -129,6 +128,7 @@ public void testMultipleExpansion() { // when / then collapsible.setAccordion(false); + assertFalse(collapsible.isAccordion()); assertTrue(collapsible.getWidget(FIRST_ITEM) instanceof MaterialCollapsibleItem); assertTrue(collapsible.getWidget(SECOND_ITEM) instanceof MaterialCollapsibleItem); @@ -145,6 +145,20 @@ public void testMultipleExpansion() { assertTrue(item2.getElement().hasClassName(CssName.ACTIVE)); item2.collapse(); assertFalse(item2.getElement().hasClassName(CssName.ACTIVE)); + + // Test case for MaterialCollapsible Issue programtically setting more than one active + // https://github.com/GwtMaterialDesign/gwt-material/issues/869 + item1.expand(); + assertTrue(item1.getElement().hasClassName(CssName.ACTIVE)); + item2.expand(); + assertTrue(item2.getElement().hasClassName(CssName.ACTIVE)); + assertTrue(item1.getElement().hasClassName(CssName.ACTIVE)); + item1.collapse(); + assertFalse(item1.getElement().hasClassName(CssName.ACTIVE)); + assertTrue(item2.getElement().hasClassName(CssName.ACTIVE)); + item2.collapse(); + assertFalse(item1.getElement().hasClassName(CssName.ACTIVE)); + assertFalse(item1.getElement().hasClassName(CssName.ACTIVE)); } public void testProgress() { From 424a651d25987145623ae52f2ae3c3e9e1ad9c9c Mon Sep 17 00:00:00 2001 From: "mark.baldemor" Date: Thu, 30 Aug 2018 14:01:48 +0800 Subject: [PATCH 8/8] Preparation for 2.1.1 release --- README.md | 10 +++++----- gwt-material/pom.xml | 4 ++-- .../material/design/client/base/AbstractSideNav.java | 4 ++-- pom.xml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d16e13f56..63f23080e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ - [PWA Support](https://github.com/GwtMaterialDesign/gwt-material/wiki/PWA-:-Service-Worker-Automation) ## Demo -* [2.1 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/) +* [2.1.1 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/) * [2.2 Snapshot Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/snapshot/) ## Documentation @@ -20,20 +20,20 @@ We created com.github.gwtmaterialdesign gwt-material-parent - 2.1.1-SNAPSHOT + 2.1.1 pom gwt-material