diff --git a/.travis.yml b/.travis.yml index d066fe1a4..f38aefaac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,17 +8,17 @@ cache: - $HOME/.m2 before_install: # install the gwt-material-jquery library before we build the demo -- git clone -b release_2.4.2 https://github.com/GwtMaterialDesign/gwt-material-jquery.git +- git clone -b release_2.5.0_rc1 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 release_2.4.2 https://github.com/GwtMaterialDesign/gwt-material.git +- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material.git - cd gwt-material - mvn install -DskipTests=true -DdryRun=true - cd .. # install the gwt-material-table library before we build the demo -- git clone -b release_2.4.2 https://github.com/GwtMaterialDesign/gwt-material-table.git +- git clone -b release_2.5.0_rc1 https://github.com/GwtMaterialDesign/gwt-material-table.git - cd gwt-material-table - mvn install -DskipTests=true -DdryRun=true - cd .. diff --git a/.utility/deploy.sh b/.utility/deploy.sh index c45c40d91..04a6e5acb 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" == "release_2.4.2" ]; then +if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.5.0_rc1" ]; then echo "ossrh\${env.OSSRH_USER}\${env.OSSRH_PASS}" > ~/settings.xml mvn deploy -DskipTests --settings ~/settings.xml fi \ No newline at end of file diff --git a/README.md b/README.md index 72cb73ebb..10d644a12 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,12 @@ Gwt Material Design Extra Components for https://github.com/GwtMaterialDesign/gwt-material
-## Current Version 2.4.2 +## Current Version 2.5.0-rc1 ```xml com.github.gwtmaterialdesign gwt-material-addins - 2.4.2 + 2.5.0-rc1 ``` diff --git a/pom.xml b/pom.xml index 6bfd1d23a..8a79fa488 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ gwt-material-parent com.github.gwtmaterialdesign - 2.4.2 + 2.5.0-rc1 gwt-material-addins @@ -24,7 +24,7 @@ scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git scm:git:git@github.com:GwtMaterialDesign/gwt-material-addins.git http://github.com/GwtMaterialDesign/gwt-material-addins - v2.4.2 + v2.5.0-rc1 diff --git a/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java b/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java index afab6d65a..367c45524 100644 --- a/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java +++ b/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java @@ -99,7 +99,7 @@ */ //@formatter:on public class MaterialComboBox extends AbstractValueWidget> implements JsLoader, HasPlaceholder, - HasComboBoxHandlers, HasReadOnly, HasFieldTypes, IsAsyncWidget>, HasLabel, HasOpenClose { + HasComboBoxHandlers, HasReadOnly, HasFieldTypes, IsAsyncWidget>, HasLabel, HasOpenClose, HasSingleValue { static { if (MaterialAddins.isDebug()) { @@ -583,17 +583,6 @@ public List getSelectedValue() { return getValue(); } - /** - * Only return a single value even if multi support is activate. - */ - public T getSingleValue() { - List values = getSelectedValue(); - if (values != null && !values.isEmpty()) { - return values.get(0); - } - return null; - } - @Override public void setValue(List value) { setValue(value, false); @@ -603,31 +592,16 @@ public void setValue(List value) { * Set the selected value using a single item, generally used * in single selection mode. */ + @Override public void setSingleValue(T value) { setValue(Collections.singletonList(value)); } - @Override - public void setValue(List values, boolean fireEvents) { - if (values == null) { - reset(); - - if (fireEvents) { - ValueChangeEvent.fire(this, null); - } - } else if (!isMultiple()) { - if (!values.isEmpty()) { - setSingleValue(values.get(0), fireEvents); - } - } else { - setValues(values, fireEvents); - } - } - /** * Set the selected value using a single item, generally used * in single selection mode. */ + @Override public void setSingleValue(T value, boolean fireEvents) { int index = this.values.indexOf(value); if (index < 0 && value instanceof String) { @@ -644,6 +618,35 @@ public void setSingleValue(T value, boolean fireEvents) { } } + /** + * Only return a single value even if multi support is activate. + */ + @Override + public T getSingleValue() { + List values = getSelectedValue(); + if (values != null && !values.isEmpty()) { + return values.get(0); + } + return null; + } + + @Override + public void setValue(List values, boolean fireEvents) { + if (values == null) { + reset(); + + if (fireEvents) { + ValueChangeEvent.fire(this, null); + } + } else if (!isMultiple()) { + if (!values.isEmpty()) { + setSingleValue(values.get(0), fireEvents); + } + } else { + setValues(values, fireEvents); + } + } + // TODO: Optimize performance (maybe use a map) public T getValueByString(String key) { for (T value : values) { @@ -1222,6 +1225,10 @@ public AsyncWidgetCallback> getAsyncCallback() { return getAsyncWidgetMixin().getAsyncCallback(); } + public List getOptions() { + return values; + } + @Override public void setAsyncDisplayLoader(AsyncDisplayLoader displayLoader) { getAsyncWidgetMixin().setAsyncDisplayLoader(displayLoader); diff --git a/src/main/java/gwt/material/design/addins/client/iconmorph/IconMorphedEvent.java b/src/main/java/gwt/material/design/addins/client/iconmorph/IconMorphedEvent.java new file mode 100644 index 000000000..91d657277 --- /dev/null +++ b/src/main/java/gwt/material/design/addins/client/iconmorph/IconMorphedEvent.java @@ -0,0 +1,61 @@ +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 - 2017 GwtMaterialDesign + * %% + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package gwt.material.design.addins.client.iconmorph; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HasHandlers; + +public class IconMorphedEvent extends GwtEvent { + + protected boolean morphed; + + public IconMorphedEvent(boolean morphed) { + this.morphed = morphed; + } + + public interface IconMorphedHandler extends EventHandler { + void onIconMorphed(IconMorphedEvent event); + } + + public static final Type TYPE = new Type<>(); + + public static void fire(HasHandlers source, boolean morphed) { + source.fireEvent(new IconMorphedEvent(morphed)); + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(IconMorphedHandler handler) { + handler.onIconMorphed(this); + } + + public boolean isMorphed() { + return morphed; + } + + public void setMorphed(boolean morphed) { + this.morphed = morphed; + } +} diff --git a/src/main/java/gwt/material/design/addins/client/iconmorph/MaterialIconMorph.java b/src/main/java/gwt/material/design/addins/client/iconmorph/MaterialIconMorph.java index 30670a8cc..fbb478c2b 100644 --- a/src/main/java/gwt/material/design/addins/client/iconmorph/MaterialIconMorph.java +++ b/src/main/java/gwt/material/design/addins/client/iconmorph/MaterialIconMorph.java @@ -20,6 +20,7 @@ package gwt.material.design.addins.client.iconmorph; import com.google.gwt.dom.client.Document; +import com.google.gwt.event.shared.HandlerRegistration; import gwt.material.design.addins.client.MaterialAddins; import gwt.material.design.addins.client.base.constants.AddinsCssName; import gwt.material.design.client.MaterialDesignBase; @@ -30,6 +31,8 @@ import gwt.material.design.client.constants.IconSize; import gwt.material.design.client.ui.MaterialIcon; +import static gwt.material.design.jquery.client.api.JQuery.$; + //@formatter:off /** @@ -67,30 +70,76 @@ public class MaterialIconMorph extends MaterialWidget implements HasDurationTran } } - private CssNameMixin sizeMixin; - private MaterialIcon source, target; + protected static final String ICON_MORPH = "icon-morph"; + protected static final String MORPHED = "morphed"; + protected CssNameMixin sizeMixin; + protected String customSize; + protected MaterialIcon source, target; public MaterialIconMorph() { - super(Document.get().createDivElement(), AddinsCssName.ANIM_CONTAINER); - getElement().setAttribute("onclick", "this.classList.toggle('morphed')"); + super(Document.get().createDivElement(), AddinsCssName.ANIM_CONTAINER, ICON_MORPH); } @Override protected void onLoad() { super.onLoad(); - if (getWidgetCount() >= 2) { - source = (MaterialIcon) getWidget(0); + registerHandler(addClickHandler(event -> { + $(getElement()).toggleClass(MORPHED); + IconMorphedEvent.fire(this, getElement().hasClassName(MORPHED)); + })); + + // Check if we add the source and target icons thru ui binder + if (source == null && target == null) { + if (getWidgetCount() == 2) { + source = (MaterialIcon) getWidget(0); + target = (MaterialIcon) getWidget(1); + } + } + + if (source != null) { source.addStyleName(AddinsCssName.ICONS + " " + AddinsCssName.SOURCE); - target = (MaterialIcon) getWidget(1); + if (!source.isAttached()) add(source); + } + if (target != null) { target.addStyleName(AddinsCssName.ICONS + " " + AddinsCssName.TARGET); + if (!target.isAttached()) add(target); + } + + applyCustomSize(customSize); + } + + protected void applyCustomSize(String customSize) { + if (customSize != null) { + setWidth(customSize); + setHeight(customSize); + + if (source != null) { + source.setWidth(customSize); + source.setHeight(customSize); + source.setFontSize(customSize); + } + + if (target != null) { + target.setWidth(customSize); + target.setHeight(customSize); + target.setFontSize(customSize); + } } } + public void reset() { + getElement().removeClassName(MORPHED); + } + public void setIconSize(IconSize size) { getSizeMixin().setCssName(size); } + public void setCustomSize(String customSize) { + this.customSize = customSize; + } + @Override public void setDuration(int duration) { setTransition(new TransitionConfig(duration, "all")); @@ -101,6 +150,14 @@ public int getDuration() { return 0; } + public void setSource(MaterialIcon source) { + this.source = source; + } + + public void setTarget(MaterialIcon target) { + this.target = target; + } + public MaterialIcon getSource() { return source; } @@ -115,4 +172,8 @@ public CssNameMixin getSizeMixin() { } return sizeMixin; } + + public HandlerRegistration addIconMorphedHandler(IconMorphedEvent.IconMorphedHandler handler) { + return addHandler(handler, IconMorphedEvent.TYPE); + } } diff --git a/src/main/java/gwt/material/design/addins/client/moment/Moment.java b/src/main/java/gwt/material/design/addins/client/moment/Moment.java index f45665ceb..6d5c1bd8f 100644 --- a/src/main/java/gwt/material/design/addins/client/moment/Moment.java +++ b/src/main/java/gwt/material/design/addins/client/moment/Moment.java @@ -24,10 +24,11 @@ import gwt.material.design.addins.client.moment.option.CalendarFormat; import gwt.material.design.addins.client.moment.option.CreationData; import gwt.material.design.addins.client.moment.option.Duration; +import gwt.material.design.addins.client.moment.resources.MomentClientBundle; import gwt.material.design.jquery.client.api.Functions; import jsinterop.annotations.*; -@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL) +@JsType(isNative = true, namespace = JsPackage.GLOBAL) public class Moment { @JsOverlay @@ -49,48 +50,48 @@ public class Moment { // Parse : String - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String value); // Parse : String + Format - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String format); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String format, String locale); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String format, Boolean strict); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String format, String locale, Boolean strict); // Parse : String + Formats - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String[] format); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String[] format, String locale); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String[] format, Boolean strict); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String date, String[] format, String locale, Boolean strict); - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(String s, JavaScriptObject special_format); // Parse : Special Formats - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(JavaScriptObject object); // Parse : Unix Timestamp (milliseconds) - @JsMethod(namespace = "moment") + @JsMethod(namespace = JsPackage.GLOBAL) public static native Moment moment(double milliseconds); // Parse : Unix Timestamp (seconds) @@ -915,4 +916,31 @@ public class Moment { @JsMethod public native static Moment invalid(Object object); + + /** + * Plugins for JDateParser + * @see Documentation + * Formats the moment with a java date format. + * Note: You must inject the js resource independently @see {@link MomentClientBundle#momentJDateConverterJs()} + */ + @JsMethod + public native String formatWithJDF(String format); + + /** + * Plugins for JDateParser + * @see Documentation + * Translates the java date format to a momentjs format. + * Note: You must inject the js resource independently @see {@link MomentClientBundle#momentJDateConverterJs()} + */ + @JsMethod + public native String toMomentFormatString(String format); + + /** + * Plugins for JDateParser + * @see Documentation + * Translates the momentjs format to a java date format. + * Note: You must inject the js resource independently @see {@link MomentClientBundle#momentJDateConverterJs()} + */ + @JsMethod + public native String toJDFString(String format); } diff --git a/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientBundle.java b/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientBundle.java index 852f4b6f3..0de68f0a3 100644 --- a/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientBundle.java +++ b/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientBundle.java @@ -29,4 +29,7 @@ public interface MomentClientBundle extends ClientBundle { @Source("js/moment.min.js") TextResource momentJs(); + + @Source("js/moment-jdateformatparser.min.js") + TextResource momentJDateConverterJs(); } diff --git a/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientDebugBundle.java b/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientDebugBundle.java index c3805ee13..b13ad69c0 100644 --- a/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientDebugBundle.java +++ b/src/main/java/gwt/material/design/addins/client/moment/resources/MomentClientDebugBundle.java @@ -29,4 +29,7 @@ public interface MomentClientDebugBundle extends ClientBundle { @Source("js/moment.js") TextResource momentDebugJs(); + + @Source("js/moment-jdateformatparser.js") + TextResource momentJDateConverterDebugJs(); } diff --git a/src/main/java/gwt/material/design/addins/client/stepper/MaterialStep.java b/src/main/java/gwt/material/design/addins/client/stepper/MaterialStep.java index 0167dcc75..5c75a6bef 100644 --- a/src/main/java/gwt/material/design/addins/client/stepper/MaterialStep.java +++ b/src/main/java/gwt/material/design/addins/client/stepper/MaterialStep.java @@ -66,7 +66,7 @@ */ // @formatter:on public class MaterialStep extends MaterialWidget implements HasActive, HasTitle, HasStatusText, HasAxis, - HasSelectionHandlers { + HasSelectionHandlers { private int step; private String title; @@ -258,6 +258,11 @@ public void setStatusDisplayPosition(Position position) { // Nothing for now } + @Override + public void setStatusShowByDefault(boolean showByDefault) { + // Nothing for now + } + protected void applyIconStatus(MaterialIcon icon, String description) { iconError.removeFromParent(); iconSuccess.removeFromParent(); diff --git a/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java b/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java index 828e34339..e47a6b05c 100644 --- a/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java +++ b/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java @@ -467,6 +467,11 @@ public void setStatusDisplayPosition(Position position) { getCurrentStep().setStatusDisplayPosition(position); } + @Override + public void setStatusShowByDefault(boolean showByDefault) { + getCurrentStep().setStatusShowByDefault(showByDefault); + } + /** * Get feedback message. */ diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/DateRangeOptions.java b/src/main/java/gwt/material/design/incubator/client/daterange/DateRangeOptions.java index 2e3ab33d4..7577d07e2 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/DateRangeOptions.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/DateRangeOptions.java @@ -20,8 +20,7 @@ package gwt.material.design.incubator.client.daterange; import com.google.gwt.core.client.JsDate; -import gwt.material.design.addins.client.moment.Moment; -import gwt.material.design.client.ui.MaterialToast; +import gwt.material.design.incubator.client.daterange.js.DateRangeLocale; import gwt.material.design.incubator.client.daterange.js.DropdownAlignment; import gwt.material.design.jquery.client.api.Functions; import jsinterop.annotations.JsOverlay; @@ -31,8 +30,6 @@ import java.util.Date; -import static gwt.material.design.addins.client.moment.Moment.moment; - @JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL) public class DateRangeOptions { @@ -106,7 +103,7 @@ public class DateRangeOptions { protected String cancelButtonClasses; @JsProperty - protected Object locale; + protected DateRangeLocale locale; @JsProperty protected boolean singleDatePicker; @@ -128,7 +125,7 @@ public class DateRangeOptions { @JsProperty protected String parentEl; - + @JsOverlay public final void setStartDate(Date startDate) { @@ -241,7 +238,7 @@ public final void setCancelButtonClasses(String cancelButtonClasses) { } @JsOverlay - public final void setLocale(Object locale) { + public final void setLocale(DateRangeLocale locale) { this.locale = locale; } diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java b/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java index 198f033fe..295d2415c 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/DateRangePicker.java @@ -23,23 +23,21 @@ import com.google.gwt.dom.client.Style; import com.google.gwt.event.logical.shared.*; import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.ui.TextBox; import gwt.material.design.addins.client.combobox.MaterialComboBoxDebugClientBundle; import gwt.material.design.addins.client.combobox.js.JsComboBox; import gwt.material.design.addins.client.combobox.js.JsComboBoxOptions; +import gwt.material.design.addins.client.inputmask.MaterialInputMask; +import gwt.material.design.addins.client.moment.Moment; import gwt.material.design.addins.client.moment.resources.MomentClientBundle; import gwt.material.design.addins.client.moment.resources.MomentClientDebugBundle; import gwt.material.design.client.MaterialDesignBase; import gwt.material.design.client.base.*; import gwt.material.design.client.base.helper.ScrollHelper; -import gwt.material.design.client.base.mixin.FieldTypeMixin; -import gwt.material.design.client.base.mixin.NativeBrowserStyleMixin; -import gwt.material.design.client.base.mixin.ReadOnlyMixin; -import gwt.material.design.client.base.mixin.StatusTextMixin; +import gwt.material.design.client.base.mixin.*; import gwt.material.design.client.base.viewport.Resolution; import gwt.material.design.client.constants.*; +import gwt.material.design.client.events.RegexValidationEvent; import gwt.material.design.client.js.Window; import gwt.material.design.client.ui.MaterialIcon; import gwt.material.design.client.ui.MaterialLabel; @@ -59,18 +57,21 @@ import static gwt.material.design.incubator.client.daterange.js.JsDateRangePicker.$; - public class DateRangePicker extends AbstractValueWidget implements HasDateRangeHandlers, HasFieldTypes, - HasDateRangeOptions, HasIcon, HasReadOnly, HasPlaceholder, HasNativeBrowserStyle, HasLabel { + HasDateRangeOptions, HasIcon, HasReadOnly, HasPlaceholder, HasNativeBrowserStyle, HasLabel, HasSingleValue, HasRegex { + + private static final String DATE_RANGE_STYLENAME = "date-range-picker"; static { if (AddinsIncubator.isDebug()) { MaterialDesignBase.injectDebugJs(MomentClientDebugBundle.INSTANCE.momentDebugJs()); + MaterialDesignBase.injectDebugJs(MomentClientDebugBundle.INSTANCE.momentJDateConverterDebugJs()); MaterialDesignBase.injectDebugJs(DateRangeClientDebugBundle.INSTANCE.dateRangePickerDebugJs()); MaterialDesignBase.injectCss(DateRangeClientDebugBundle.INSTANCE.dateRangePickerDebugCss()); MaterialDesignBase.injectCss(DateRangeClientDebugBundle.INSTANCE.dateRangePickerOverrideDebugCss()); } else { MaterialDesignBase.injectJs(MomentClientBundle.INSTANCE.momentJs()); + MaterialDesignBase.injectJs(MomentClientBundle.INSTANCE.momentJDateConverterJs()); MaterialDesignBase.injectJs(DateRangeClientBundle.INSTANCE.dateRangePickerJs()); MaterialDesignBase.injectCss(DateRangeClientBundle.INSTANCE.dateRangePickerCss()); MaterialDesignBase.injectCss(DateRangeClientBundle.INSTANCE.dateRangePickerOverrideCss()); @@ -79,24 +80,25 @@ public class DateRangePicker extends AbstractValueWidget implements HasD MaterialDesignBase.injectCss(MaterialComboBoxDebugClientBundle.INSTANCE.select2DebugCss()); } - private static final String DATE_INPUT_FORMAT = "MM/dd/yyyy"; - private static final String DATE_RANGE_STYLENAME = "date-range-picker"; - private ScrollHelper scrollHelper = new ScrollHelper(); - private TextBox dateInput = new TextBox(); - private Label label = new Label(); - private MaterialLabel errorLabel = new MaterialLabel(); - private MaterialIcon icon = new MaterialIcon(); - private DateRangeOptions options = new DateRangeOptions(); + private final ScrollHelper scrollHelper = new ScrollHelper(); + private final MaterialInputMask dateInput = new MaterialInputMask(); + private final Label label = new Label(); + private final MaterialLabel errorLabel = new MaterialLabel(); + private final MaterialIcon icon = new MaterialIcon(); + private final DateRangeOptions options = new DateRangeOptions(); + private boolean open; private double addedOffsetHeight = 480; + private String mask; private Date startDate; private Date endDate; private Date[] value; private FieldTypeMixin fieldTypeMixin; private StatusTextMixin statusTextMixin; - private ReadOnlyMixin readOnlyMixin; + private ReadOnlyMixin readOnlyMixin; private NativeBrowserStyleMixin nativeBrowserStyleMixin; + private RegexMixin regexMixin; public DateRangePicker() { super(Document.get().createDivElement(), CssName.INPUT_FIELD, DATE_RANGE_STYLENAME); @@ -110,13 +112,13 @@ protected void onLoad() { } protected void load() { - + applyMasking(); add(dateInput); add(label); add(errorLabel); getInputElement().daterangepicker(options, (startDate, endDate) -> { - setValue(new Date[]{new Date(startDate.format()), new Date(endDate.format())}, true); + setValue(new Date[]{new Date(startDate.toString()), new Date(endDate.toString())}, true); }); getInputElement().on(DateRangeEvents.UPDATE_CALENDAR, (e, picker) -> { @@ -188,6 +190,12 @@ protected void load() { IncubatorDarkThemeReloader.get().reload(DateRangeDarkTheme.class); } + protected void applyMasking() { + if (mask != null) { + dateInput.setMask(mask); + } + } + protected void detectPosition() { if (!isInVerticalViewPort()) { getMethodProvider().setDrops(DropdownPosition.UP.getCssName()); @@ -265,7 +273,7 @@ public void reload() { } public JsDateRangePicker getInputElement() { - return $(dateInput.getElement()); + return $(dateInput.getValueBoxBase().getElement()); } protected JsDateRangeMethod getMethodProvider() { @@ -425,7 +433,7 @@ public void setCancelButtonClasses(String cancelButtonClasses) { @Override public void setLocale(DateRangeLocale locale) { - options.setLocale(locale != null ? locale : false); + options.setLocale(locale); } @Override @@ -487,14 +495,17 @@ public void setValue(Date[] value, boolean fireEvents) { super.setValue(value, fireEvents); } + @Override public void setSingleValue(Date value) { setValue(new Date[]{value}, false); } + @Override public void setSingleValue(Date value, boolean fireEvents) { setValue(new Date[]{value}, fireEvents); } + @Override public Date getSingleValue() { if (getValue().length >= 1) { return getValue()[0]; @@ -506,17 +517,44 @@ public Date getSingleValue() { * Call this if you have defined {@link DateRangePicker#setAutoUpdateInput(boolean)} to false. * This will be required in order to update the input date textfield manually. */ - public void setDateInputValue(Date creationDate, Date endDate, String format) { - if (dateInput != null && creationDate != null && endDate != null && format != null && !format.isEmpty()) { - dateInput.setValue(DateTimeFormat.getFormat(format).format(creationDate) + " - " + - DateTimeFormat.getFormat(format).format(endDate)); + public void setDateInputValue(Date creationDate, Date endDate) { + if (dateInput != null && creationDate != null && endDate != null) { + String betweenDelimiter = options != null && options.locale != null && options.locale.getToLabel() != null ? options.locale.getToLabel() : " - "; + String creationDateFormatted = Moment.moment(creationDate.getTime()).format(getFormat()); + String endDateFormatted = Moment.moment(endDate.getTime()).format(getFormat()); + dateInput.setValue(getOptions().singleDatePicker ? creationDateFormatted : + creationDateFormatted + " " + betweenDelimiter + " " + endDateFormatted); } else { clearInputValue(); } } - public void setDateInputValue(Date creationDate, Date endDate) { - setDateInputValue(creationDate, endDate, DATE_INPUT_FORMAT); + /** + * Set the format of the date range picker + * + * @param format Java Date format using {@link java.text.SimpleDateFormat}. + */ + public void setFormat(String format) { + if (options.locale == null) { + options.locale = new DateRangeLocale(); + } + options.locale.setFormat(format); + } + + /** + * Set the format of the date range picker + * + * @param format Moment js native format + */ + public void setMomentJsDateFormat(String format) { + if (options.locale == null) { + options.locale = new DateRangeLocale(); + } + options.locale.setMomentJsDateFormat(format); + } + + public String getFormat() { + return options != null && options.locale != null && options.locale.getFormat() != null ? options.locale.getFormat() : "MM/dd/yyyy"; } public void clearInputValue() { @@ -528,7 +566,7 @@ public Date[] getValue() { return value; } - public TextBox getDateInput() { + public MaterialInputMask getDateInput() { return dateInput; } @@ -667,7 +705,7 @@ public String getPlaceholder() { @Override public void setPlaceholder(String placeholder) { - dateInput.getElement().setAttribute("placeholder", placeholder); + dateInput.setPlaceholder(placeholder); } @Override @@ -685,6 +723,29 @@ public void setNativeBrowserStyle(boolean nativeBrowserStyle) { getNativeBrowserStyleMixin().setNativeBrowserStyle(nativeBrowserStyle); } + @Override + public void setRegex(String regex) { + getRegexMixin().setRegex(regex); + } + + @Override + public void setRegex(String regex, String replaceRegex) { + getRegexMixin().setRegex(regex, replaceRegex); + } + + @Override + public String getRegex() { + return getRegexMixin().getRegex(); + } + + public String getMask() { + return mask; + } + + public void setMask(String mask) { + this.mask = mask; + } + @Override public boolean isNativeBrowserStyle() { return getNativeBrowserStyleMixin().isNativeBrowserStyle(); @@ -740,6 +801,11 @@ public HandlerRegistration addValueChangeHandler(ValueChangeHandler hand return addHandler(handler, ValueChangeEvent.getType()); } + @Override + public HandlerRegistration addRegexValidationHandler(RegexValidationEvent.RegexValidationHandler handler) { + return addHandler(handler, RegexValidationEvent.getType()); + } + protected FieldTypeMixin getFieldTypeMixin() { if (fieldTypeMixin == null) { fieldTypeMixin = new FieldTypeMixin<>(this); @@ -755,7 +821,7 @@ public StatusTextMixin getStatusTextMixin() return statusTextMixin; } - protected ReadOnlyMixin getReadOnlyMixin() { + protected ReadOnlyMixin getReadOnlyMixin() { if (readOnlyMixin == null) { readOnlyMixin = new ReadOnlyMixin<>(this, dateInput); } @@ -768,4 +834,11 @@ protected NativeBrowserStyleMixin getNativeBrowserStyleMixin() } return nativeBrowserStyleMixin; } + + protected RegexMixin getRegexMixin() { + if (regexMixin == null) { + regexMixin = new RegexMixin<>(dateInput); + } + return regexMixin; + } } diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/js/DateRangeLocale.java b/src/main/java/gwt/material/design/incubator/client/daterange/js/DateRangeLocale.java index 7a6aadeb0..202b7b224 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/js/DateRangeLocale.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/js/DateRangeLocale.java @@ -20,15 +20,12 @@ package gwt.material.design.incubator.client.daterange.js; import com.google.gwt.core.client.GWT; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.json.client.JSONString; +import gwt.material.design.addins.client.moment.Moment; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsProperty; import jsinterop.annotations.JsType; -import java.util.List; - /** * @author kevzlou7979 * @see {@link gwt.material.design.incubator.client.daterange.DateRangePicker#setLocale(DateRangeLocale)} @@ -71,6 +68,11 @@ public class DateRangeLocale { @JsOverlay public final void setFormat(String format) { + this.format = Moment.moment().toMomentFormatString(format); + } + + @JsOverlay + public final void setMomentJsDateFormat(String format) { this.format = format; } @@ -122,8 +124,64 @@ public final void setMonthNames(LocaleString[] monthNames) { GWT.log("Months must be equal to seven (12) months", new IllegalArgumentException()); } } + @JsOverlay public final void setFirstDay(String firstDay) { this.firstDay = firstDay; } + + @JsOverlay + public final String getFormat() { + return format; + } + + @JsOverlay + public final String getSeparator() { + return separator; + } + + @JsOverlay + public final String getApplyLabel() { + return applyLabel; + } + + @JsOverlay + public final String getCancelLabel() { + return cancelLabel; + } + + @JsOverlay + public final String getFromLabel() { + return fromLabel; + } + + @JsOverlay + public final String getToLabel() { + return toLabel; + } + + @JsOverlay + public final String getCustomRangeLabel() { + return customRangeLabel; + } + + @JsOverlay + public final String getWeekLabel() { + return weekLabel; + } + + @JsOverlay + public final LocaleString[] getDaysOfWeek() { + return daysOfWeek; + } + + @JsOverlay + public final LocaleString[] getMonthNames() { + return monthNames; + } + + @JsOverlay + public final String getFirstDay() { + return firstDay; + } } diff --git a/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java b/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java index 97e85ecfe..0de7a69db 100644 --- a/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java +++ b/src/main/java/gwt/material/design/incubator/client/daterange/js/JsDateRangePicker.java @@ -19,6 +19,7 @@ */ package gwt.material.design.incubator.client.daterange.js; +import com.google.gwt.core.client.JsDate; import com.google.gwt.dom.client.Element; import gwt.material.design.addins.client.moment.Moment; import gwt.material.design.incubator.client.daterange.DateRangeOptions; @@ -34,7 +35,7 @@ * @author kevzlou7979 */ @JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL) -public class JsDateRangePicker { +public class JsDateRangePicker extends DateRangeOptions { @JsMethod(name = "$", namespace = JsPackage.GLOBAL) public static native JsDateRangePicker $(JQueryElement element); @@ -49,7 +50,7 @@ public class JsDateRangePicker { public native void daterangepicker(DateRangeOptions options); @JsMethod - public native void daterangepicker(DateRangeOptions options, Functions.Func2 callback); + public native void daterangepicker(DateRangeOptions options, Functions.Func2 callback); @JsMethod public native void daterangepicker(); diff --git a/src/main/java/gwt/material/design/incubator/client/infinitescroll/InfiniteScrollPanel.java b/src/main/java/gwt/material/design/incubator/client/infinitescroll/InfiniteScrollPanel.java index 3c7535256..85705f4fa 100644 --- a/src/main/java/gwt/material/design/incubator/client/infinitescroll/InfiniteScrollPanel.java +++ b/src/main/java/gwt/material/design/incubator/client/infinitescroll/InfiniteScrollPanel.java @@ -27,7 +27,7 @@ import gwt.material.design.client.data.loader.LoadCallback; import gwt.material.design.client.data.loader.LoadConfig; import gwt.material.design.client.data.loader.LoadResult; -import gwt.material.design.client.ui.MaterialPanel; +import gwt.material.design.client.ui.MaterialRow; import gwt.material.design.incubator.client.AddinsIncubator; import gwt.material.design.incubator.client.base.IncubatorWidget; import gwt.material.design.incubator.client.infinitescroll.events.*; @@ -53,7 +53,7 @@ * * @author kevzlou7979 */ -public class InfiniteScrollPanel extends MaterialPanel implements HasInfiniteScrollHandlers { +public class InfiniteScrollPanel extends MaterialRow implements HasInfiniteScrollHandlers { static { IncubatorWidget.showWarning(InfiniteScrollPanel.class); @@ -143,7 +143,7 @@ protected void load() { protected void load(int offset, int limit) { if (!completed) { LoadingEvent.fire(this, offset, offset + (limit - 1)); - dataSource.load(new LoadConfig<>(offset, limit, null, null), new LoadCallback() { + dataSource.load(new LoadConfig<>(offset, limit), new LoadCallback() { @Override public void onSuccess(LoadResult loadResult) { LoadedEvent.fire(InfiniteScrollPanel.this, loadResult); @@ -166,9 +166,9 @@ public void onFailure(Throwable caught) { * Will render the provided data result with the provided {@link Renderer}. * This method will also check if recycling is enabled (You can turn on recycling by setting {@link this#setRecycleManager(RecycleManager)}. */ - private void render(List data) { + private void render(List models) { List widgets = new ArrayList<>(); - for (T model : data) { + for (T model : models) { Widget widget = renderer.render(model); widget.getElement().setId("item-" + itemCount); add(widget); @@ -186,6 +186,9 @@ private void render(List data) { int height = $(widgets.get(0).getElement()).outerHeight(); getElement().getStyle().setHeight(height, Style.Unit.PX); } + + // Fire an event + WidgetRenderedEvent.fire(this, widgets); } /** @@ -374,6 +377,11 @@ public HandlerRegistration addLoadingHandler(LoadingEvent.LoadingHandler handler return addHandler(handler, LoadingEvent.getType()); } + @Override + public HandlerRegistration addDataRenderedHandler(WidgetRenderedEvent.WidgetsRenderedHandler handler) { + return addHandler(handler, WidgetRenderedEvent.getType()); + } + @Override public HandlerRegistration addLoadedHandler(LoadedEvent.LoadHandler handler) { return addHandler(handler, LoadedEvent.getType()); diff --git a/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/HasInfiniteScrollHandlers.java b/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/HasInfiniteScrollHandlers.java index 4ed25f84b..0c7d91902 100644 --- a/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/HasInfiniteScrollHandlers.java +++ b/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/HasInfiniteScrollHandlers.java @@ -32,6 +32,8 @@ public interface HasInfiniteScrollHandlers { HandlerRegistration addLoadingHandler(LoadingEvent.LoadingHandler handler); + HandlerRegistration addDataRenderedHandler(WidgetRenderedEvent.WidgetsRenderedHandler handler); + HandlerRegistration addLoadedHandler(LoadedEvent.LoadHandler handler); HandlerRegistration addCompleteHandler(CompleteEvent.CompleteHandler handler); diff --git a/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/WidgetRenderedEvent.java b/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/WidgetRenderedEvent.java new file mode 100644 index 000000000..375b8fa1a --- /dev/null +++ b/src/main/java/gwt/material/design/incubator/client/infinitescroll/events/WidgetRenderedEvent.java @@ -0,0 +1,68 @@ +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 - 2018 GwtMaterialDesign + * %% + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package gwt.material.design.incubator.client.infinitescroll.events; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HasHandlers; +import com.google.gwt.user.client.ui.Widget; + +import java.util.List; +//@formatter:off + +/** + * Fired whenever the list of widget is rendered by batch + * @author kevzlou7979 + */ +public class WidgetRenderedEvent extends GwtEvent> { + + private List widgets; + private static Type> TYPE; + + public WidgetRenderedEvent(List widgets) { + this.widgets = widgets; + } + + public static void fire(HasHandlers source, List result) { + source.fireEvent(new WidgetRenderedEvent(result)); + } + + @Override + public final Type> getAssociatedType() { + return (Type) TYPE; + } + + public static Type> getType() { + return TYPE != null ? TYPE : (TYPE = new Type<>()); + } + + @Override + protected void dispatch(WidgetsRenderedHandler handler) { + handler.onWidgetsRendered(this); + } + + public List getWidgets() { + return widgets; + } + + public interface WidgetsRenderedHandler extends EventHandler { + void onWidgetsRendered(WidgetRenderedEvent event); + } +} diff --git a/src/main/java/gwt/material/design/incubator/client/toggle/GroupToggleButton.java b/src/main/java/gwt/material/design/incubator/client/toggle/GroupToggleButton.java index 64f8b5e1b..49b8b6637 100644 --- a/src/main/java/gwt/material/design/incubator/client/toggle/GroupToggleButton.java +++ b/src/main/java/gwt/material/design/incubator/client/toggle/GroupToggleButton.java @@ -28,6 +28,7 @@ import gwt.material.design.addins.client.MaterialAddins; import gwt.material.design.client.MaterialDesignBase; import gwt.material.design.client.base.AbstractValueWidget; +import gwt.material.design.client.base.HasSingleValue; import gwt.material.design.client.base.HasStatusText; import gwt.material.design.client.base.mixin.StatusTextMixin; import gwt.material.design.client.constants.CssName; @@ -67,7 +68,7 @@ */ //@formatter:on public class GroupToggleButton extends AbstractValueWidget> implements HasSelectionHandlers, - HasStatusText { + HasStatusText, HasSingleValue { static { IncubatorWidget.showWarning(GroupToggleButton.class); @@ -179,6 +180,7 @@ public List getValue() { return items; } + @Override public T getSingleValue() { if (getSelectedIndexes().size() == 0) { @@ -188,10 +190,12 @@ public T getSingleValue() { return values.get(getSelectedIndexes().get(0)); } + @Override public void setSingleValue(T value) { setSingleValue(value, false); } + @Override public void setSingleValue(T value, boolean fireEvents) { setValue(Arrays.asList(value), fireEvents); } diff --git a/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.css b/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.css index bbdba8e88..c9542e02f 100644 --- a/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.css +++ b/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.css @@ -1,6 +1,6 @@ .material-carousel .carousel-next-arrow, .material-carousel .carousel-prev-arrow, -.slick-dots li.slick-active{ +ul.slick-dots li.slick-active{ background-color: #bb86fc; } @@ -9,6 +9,6 @@ color: black; } -.slick-dots li { +ul.slick-dots li { background-color: rgba(187, 134, 252, 0.23); } \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.min.css b/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.min.css index 33436ad07..2b4aee30f 100644 --- a/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.min.css +++ b/src/main/resources/gwt/material/design/addins/client/carousel/resources/css/slick-dark.min.css @@ -1 +1 @@ -.material-carousel .carousel-next-arrow,.material-carousel .carousel-prev-arrow,.slick-dots li.slick-active{background-color:#bb86fc}.material-carousel:not(.carousel-image) .carousel-next-arrow i,.material-carousel:not(.carousel-image) .carousel-prev-arrow i{color:#000}.slick-dots li{background-color:rgba(187,134,252,.23)} \ No newline at end of file +.material-carousel .carousel-next-arrow,.material-carousel .carousel-prev-arrow,ul.slick-dots li.slick-active{background-color:#bb86fc}.material-carousel:not(.carousel-image) .carousel-next-arrow i,.material-carousel:not(.carousel-image) .carousel-prev-arrow i{color:#000}ul.slick-dots li{background-color:rgba(187,134,252,.23)} \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css index 41ddba749..afe5e5ca7 100644 --- a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css +++ b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.css @@ -4,7 +4,7 @@ background: #fff; color: #4caf50; font-size: 4rem; - box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12) + box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); } .empty-state .preloader-wrapper { @@ -15,4 +15,8 @@ .empty-state .loader-wrapper { background: transparent !important; z-index: 1; +} + +.empty-state h4 { + overflow-wrap: break-word; } \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css index e774fd34a..be988c7ca 100644 --- a/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css +++ b/src/main/resources/gwt/material/design/addins/client/emptystate/resources/css/empty-state.min.css @@ -1 +1 @@ -.empty-state i.large{border-radius:100%;padding:20px;background:#fff;color:#4caf50;font-size:4rem;box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.empty-state .preloader-wrapper{width:100px;height:100px}.empty-state .loader-wrapper{background:0 0!important;z-index:1} \ No newline at end of file +.empty-state i.large{border-radius:100%;padding:20px;background:#fff;color:#4caf50;font-size:4rem;box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12)}.empty-state .preloader-wrapper{width:100px;height:100px}.empty-state .loader-wrapper{background:0 0!important;z-index:1}.empty-state h4{overflow-wrap:break-word} \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.css b/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.css index 00499db5c..dae2df9b0 100644 --- a/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.css +++ b/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.css @@ -12,7 +12,7 @@ -moz-transition: .3s; -webkit-transition: .3s; position: absolute; - font-size: 4em !important; + font-size: 4em; height: 1em; width: 1em; position: absolute; @@ -65,11 +65,11 @@ } .anim-container.tiny .icons{ - font-size: 2em !important; + font-size: 2em; } .anim-container.medium .icons{ - font-size: 8em !important; + font-size: 8em; } .anim-container.large .icons{ - font-size: 12em !important; + font-size: 12em; } \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.min.css b/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.min.css index 0ac2926fe..6c6b29082 100644 --- a/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.min.css +++ b/src/main/resources/gwt/material/design/addins/client/iconmorph/resources/css/morph.min.css @@ -1 +1 @@ -.anim-container{height:4rem;width:4rem;transition:.3s;-webkit-transition:.3s;-moz-transition:.3s;position:relative;cursor:pointer}.anim-container .icons.material-icons{transition:.3s;-moz-transition:.3s;-webkit-transition:.3s;position:absolute;font-size:4em!important;height:1em;width:1em;position:absolute;left:0;line-height:normal}.anim-container .source{transform:rotate(-135deg);-moz-transform:rotate(-135deg);-webkit-transform:rotate(-135deg);opacity:0}.anim-container.morphed{transform:rotate(135deg);-moz-transform:rotate(135deg);-webkit-transform:rotate(135deg)}.anim-container.morphed .source{opacity:1;visibility:visible}.anim-container.morphed .target{opacity:0;visibility:hidden}.anim-container.tiny{height:1rem;width:1rem;font-size:.5rem}.anim-container.small{height:2rem;width:2rem;font-size:.5rem}.anim-container.medium{height:4rem;width:4rem;font-size:.5rem}.anim-container.large{height:6rem;width:6rem;font-size:.5rem}.anim-container.tiny .icons{font-size:2em!important}.anim-container.medium .icons{font-size:8em!important}.anim-container.large .icons{font-size:12em!important} \ No newline at end of file +.anim-container{height:4rem;width:4rem;transition:.3s;-webkit-transition:.3s;-moz-transition:.3s;position:relative;cursor:pointer}.anim-container .icons.material-icons{transition:.3s;-moz-transition:.3s;-webkit-transition:.3s;position:absolute;font-size:4em;height:1em;width:1em;position:absolute;left:0;line-height:normal}.anim-container .source{transform:rotate(-135deg);-moz-transform:rotate(-135deg);-webkit-transform:rotate(-135deg);opacity:0}.anim-container.morphed{transform:rotate(135deg);-moz-transform:rotate(135deg);-webkit-transform:rotate(135deg)}.anim-container.morphed .source{opacity:1;visibility:visible}.anim-container.morphed .target{opacity:0;visibility:hidden}.anim-container.tiny{height:1rem;width:1rem;font-size:.5rem}.anim-container.small{height:2rem;width:2rem;font-size:.5rem}.anim-container.medium{height:4rem;width:4rem;font-size:.5rem}.anim-container.large{height:6rem;width:6rem;font-size:.5rem}.anim-container.tiny .icons{font-size:2em}.anim-container.medium .icons{font-size:8em}.anim-container.large .icons{font-size:12em} \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/moment/resources/js/moment-jdateformatparser.js b/src/main/resources/gwt/material/design/addins/client/moment/resources/js/moment-jdateformatparser.js new file mode 100644 index 000000000..bd3ae5c6b --- /dev/null +++ b/src/main/resources/gwt/material/design/addins/client/moment/resources/js/moment-jdateformatparser.js @@ -0,0 +1,262 @@ +// this loading routine is shamelessly copied from the "moment-duration-format" plugin +// @see https://github.com/jsmreese/moment-duration-format +(function loadMomentJS (root, factory) { + if (typeof define === 'function' && define.amd) { + // Detected AMD; + // will register as an anonymous module + define(['moment'], factory); + } else if (typeof exports === 'object') { + // Detected node.js; + // this does not work with strict CommonJS, but only CommonJS-like environments + // whicht support `module.exports`, like node.js does + try { + module.exports = factory(require('moment')); + } catch (ignore) { + // if `moment.js` is not available, leave the setup to the user; + // this is necessary if the user works with other plugins which will + // come with it's very own version of `moment.js` as a peer dependency + // @see https://github.com/icambron/twix.js/issues/102 + module.exports = factory; + } + } + + if (root) { + //working with globals; + root.momentJDateFormatParserSetup = root.moment ? factory(root.moment) : factory; + } +})(this, function loadPlugin (moment) { + /** + * The internal **Java** date formats cache. + * + * @property javaDateFormats + * @type {Object} + */ + var javaDateFormats = {}; + + /** + * The internal **moment.js** date formats cache. + * + * @property momentDateFormats + * @type {Object} + */ + var momentDateFormats = {}; + + /** + * The format pattern mapping from Java format to momentjs. + * + * @property javaFormatMapping + * @type {Object} + */ + var javaFormatMapping = { + d: 'D', + dd: 'DD', + y: 'YYYY', + yy: 'YY', + yyy: 'YYYY', + yyyy: 'YYYY', + a: 'a', + A: 'A', + M: 'M', + MM: 'MM', + MMM: 'MMM', + MMMM: 'MMMM', + h: 'h', + hh: 'hh', + H: 'H', + HH: 'HH', + m: 'm', + mm: 'mm', + s: 's', + ss: 'ss', + S: 'SSS', + SS: 'SSS', + SSS: 'SSS', + E: 'ddd', + EE: 'ddd', + EEE: 'ddd', + EEEE: 'dddd', + EEEEE: 'dddd', + EEEEEE: 'dddd', + D: 'DDD', + w: 'W', + ww: 'WW', + z: 'ZZ', + zzzz: 'Z', + Z: 'ZZ', + X: 'ZZ', + XX: 'ZZ', + XXX: 'Z', + u: 'E' + }; + + /** + * The format pattern mapping from Java format to moment.js. + * + * @property momentFormatMapping + * @type {Object} + */ + var momentFormatMapping = { + D: 'd', + DD: 'dd', + YY: 'yy', + YYY: 'yyyy', + YYYY: 'yyyy', + a: 'a', + A: 'a', + M: 'M', + MM: 'MM', + MMM: 'MMM', + MMMM: 'MMMM', + h: 'h', + hh: 'hh', + H: 'H', + HH: 'HH', + m: 'm', + mm: 'mm', + s: 's', + ss: 'ss', + S: 'S', + SS: 'S', + SSS: 'S', + ddd: 'E', + dddd: 'EEEE', + DDD: 'D', + W: 'w', + WW: 'ww', + ZZ: 'z', + Z: 'XXX', + E: 'u' + }; + + + /** + * Translates the java date format String to a momentjs format String. + * + * @function translateFormat + * @param {String} formatString The unmodified format string + * @param {Object} mapping The date format mapping object + * @returns {String} + */ + var translateFormat = function (formatString, mapping) { + var len = formatString.length; + var i = 0; + var startIndex = -1; + var lastChar = null; + var currentChar = ""; + var resultString = ""; + + for (; i < len; i++) { + currentChar = formatString.charAt(i); + + if (lastChar === null || lastChar !== currentChar) { + // change detected + resultString = _appendMappedString(formatString, mapping, startIndex, i, resultString); + + startIndex = i; + } + + lastChar = currentChar; + } + + return _appendMappedString(formatString, mapping, startIndex, i, resultString); + }; + + /** + * Checks if the substring is a mapped date format pattern and adds it to the result format String. + * + * @function _appendMappedString + * @param {String} formatString The unmodified format String. + * @param {Object} mapping The date format mapping Object. + * @param {Number} startIndex The begin index of the continuous format characters. + * @param {Number} currentIndex The last index of the continuous format characters. + * @param {String} resultString The result format String. + * @returns {String} + * @private + */ + var _appendMappedString = function (formatString, mapping, startIndex, currentIndex, resultString) { + if (startIndex !== -1) { + var tempString = formatString.substring(startIndex, currentIndex); + + // check if the temporary string has a known mapping + if (mapping[tempString]) { + tempString = mapping[tempString]; + } + + resultString += tempString; + } + + return resultString; + }; + +// init + function init (momentJS) { + if (!momentJS) { + throw new Error("Moment JDateFormatParser Plugin - Cannot find moment.js instance."); + } + + // register as private function (good for testing purposes) + momentJS.fn.__translateJavaFormat = translateFormat; + + /** + * Translates the momentjs format String to a java date format String. + * + * @function toJDFString + * @param {String} formatString The format String to be translated. + * @returns {String} + */ + momentJS.fn.toMomentFormatString = function (formatString) { + if (!javaDateFormats[formatString]) { + var mapped = ""; + var regexp = /[^']+|('[^']*')/g; + var part = ''; + + while ((part = regexp.exec(formatString))) { + part = part[0]; + + if (part.match(/'(.*?)'/)) { + mapped += "[" + part.substring(1, part.length - 1) + "]"; + } else { + mapped += translateFormat(part, javaFormatMapping); + } + } + + javaDateFormats[formatString] = mapped; + } + + return javaDateFormats[formatString]; + }; + + /** + * Format the moment with the given java date format String. + * + * @function formatWithJDF + * @param {String} formatString The format String to be translated. + * @returns {String} + */ + momentJS.fn.formatWithJDF = function (formatString) { + return this.format(this.toMomentFormatString(formatString)); + }; + + /** + * Translates the momentjs format string to a java date format string + * + * @function toJDFString + * @param {String} formatString The format String to be translated. + * @returns {String} + */ + momentJS.fn.toJDFString = function (formatString) { + if (!momentDateFormats[formatString]) { + momentDateFormats[formatString] = translateFormat(formatString, momentFormatMapping); + } + + return momentDateFormats[formatString]; + }; + } + + // Initialize JDateFormatParser Plugin on the global moment instance. + init(moment); + + // Return the init function so that the JDateFormatParser Plugin can be + // initialized on other moment instances. + return init; +}); \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/moment/resources/js/moment-jdateformatparser.min.js b/src/main/resources/gwt/material/design/addins/client/moment/resources/js/moment-jdateformatparser.min.js new file mode 100644 index 000000000..644736455 --- /dev/null +++ b/src/main/resources/gwt/material/design/addins/client/moment/resources/js/moment-jdateformatparser.min.js @@ -0,0 +1 @@ +!function(a,b){if("function"==typeof define&&define.amd)define(["moment"],b);else if("object"==typeof exports)try{module.exports=b(require("moment"))}catch(c){module.exports=b}a&&(a.momentJDateFormatParserSetup=a.moment?b(a.moment):b)}(this,function(a){function b(a){if(!a)throw new Error("Moment JDateFormatParser Plugin - Cannot find moment.js instance.");a.fn.__translateJavaFormat=g,a.fn.toMomentFormatString=function(a){if(!c[a]){for(var b="",d=/[^']+|('[^']*')/g,f="";f=d.exec(a);)f=f[0],b+=f.match(/'(.*?)'/)?"["+f.substring(1,f.length-1)+"]":g(f,e);c[a]=b}return c[a]},a.fn.formatWithJDF=function(a){return this.format(this.toMomentFormatString(a))},a.fn.toJDFString=function(a){return d[a]||(d[a]=g(a,f)),d[a]}}var c={},d={},e={d:"D",dd:"DD",y:"YYYY",yy:"YY",yyy:"YYYY",yyyy:"YYYY",a:"a",A:"A",M:"M",MM:"MM",MMM:"MMM",MMMM:"MMMM",h:"h",hh:"hh",H:"H",HH:"HH",m:"m",mm:"mm",s:"s",ss:"ss",S:"SSS",SS:"SSS",SSS:"SSS",E:"ddd",EE:"ddd",EEE:"ddd",EEEE:"dddd",EEEEE:"dddd",EEEEEE:"dddd",D:"DDD",w:"W",ww:"WW",z:"ZZ",zzzz:"Z",Z:"ZZ",X:"ZZ",XX:"ZZ",XXX:"Z",u:"E"},f={D:"d",DD:"dd",YY:"yy",YYY:"yyyy",YYYY:"yyyy",a:"a",A:"a",M:"M",MM:"MM",MMM:"MMM",MMMM:"MMMM",h:"h",hh:"hh",H:"H",HH:"HH",m:"m",mm:"mm",s:"s",ss:"ss",S:"S",SS:"S",SSS:"S",ddd:"E",dddd:"EEEE",DDD:"D",W:"w",WW:"ww",ZZ:"z",Z:"XXX",E:"u"},g=function(a,b){for(var c=a.length,d=0,e=-1,f=null,g="",i="";c>d;d++)g=a.charAt(d),(null===f||f!==g)&&(i=h(a,b,e,d,i),e=d),f=g;return h(a,b,e,d,i)},h=function(a,b,c,d,e){if(-1!==c){var f=a.substring(c,d);b[f]&&(f=b[f]),e+=f}return e};return b(a),b}); \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.css b/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.css index 92f97d884..98c50ba66 100644 --- a/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.css +++ b/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.css @@ -1,4 +1,4 @@ -.window .window-toolbar { +div.window .window-toolbar { background-color: #1e1e1e; } diff --git a/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.min.css b/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.min.css index e69de29bb..f5ab59369 100644 --- a/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.min.css +++ b/src/main/resources/gwt/material/design/addins/client/window/resources/css/window-dark.min.css @@ -0,0 +1 @@ +div.window .window-toolbar{background-color:#1e1e1e}.window .content{background-color:#383838} \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css index d69f1a1df..50c4cabb3 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.css @@ -1,79 +1,83 @@ -.daterangepicker, -.daterangepicker .calendar-table, -.daterangepicker td.off, -.daterangepicker td.off.in-range, -.daterangepicker td.off.start-date, -.daterangepicker td.off.end-date { +div.daterangepicker, +div.daterangepicker .calendar-table, +div.daterangepicker td.off, +div.daterangepicker td.off.in-range, +div.daterangepicker td.off.start-date, +div.daterangepicker td.off.end-date { background-color: #2e3033; border-color: #2e3033; } -.daterangepicker:after { +div.daterangepicker:after { border-bottom: 6px solid #2e3033; } -.daterangepicker:before { +div.daterangepicker:before { border-bottom: 7px solid #2e3033; } -.daterangepicker.drop-up:before { +div.daterangepicker.drop-up:before { border-top: 7px solid #2e3033; } -.daterangepicker.drop-up:after { +div.daterangepicker.drop-up:after { border-top: 6px solid #2e3033; } -.daterangepicker th.month { +div.daterangepicker th.month { color: #ffffff; } -.daterangepicker .calendar-table .next span, -.daterangepicker .calendar-table .prev span { +div.daterangepicker .calendar-table .next span, +div.daterangepicker .calendar-table .prev span { border: solid white; border-width: 0 2px 2px 0; } -.daterangepicker .drp-buttons { +div.daterangepicker .drp-buttons { border-top: 1px solid #3d3d3d; } -.daterangepicker td.active, -.daterangepicker td.active:hover, -.daterangepicker td.in-range.active:not(.off) { +div.daterangepicker td.active, +div.daterangepicker td.active:hover, +div.daterangepicker td.in-range.active:not(.off) { background-color: #bb86fc; color: #292929; } -.daterangepicker td:not(.active).available:hover, -.daterangepicker th.available:hover { +div.daterangepicker td:not(.active).available:hover, +div.daterangepicker th.available:hover { background-color: #2e3033; } -.daterangepicker td.available:hover:after { +div.daterangepicker td.available:hover:after { border: 2px solid #bb86fc; } -.daterangepicker td.in-range, -.daterangepicker td.available.in-range:hover:not(.active) { +div.daterangepicker td.in-range, +div.daterangepicker td.available.in-range:hover:not(.active) { background-color: rgba(187, 134, 252, .08); color: #bb86fc; } -button.cancelBtn { +div.drp-buttons button.cancelBtn { color: #bb86fc; } -.daterangepicker:not(.single) .drp-buttons { +div.drp-buttons button.cancelBtn:hover { + color: #000000; +} + +div.daterangepicker:not(.single) .drp-buttons { background-color: #2e3033; } -.daterangepicker .calendar-time { +div.daterangepicker .calendar-time { background: #292929; border: 1px solid #292929; } -.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered { +div.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered { color: white; } @@ -87,24 +91,24 @@ button.cancelBtn { background-color: #292929; } -.daterangepicker .select2-container--disabled .select2-selection__rendered { +div.daterangepicker .select2-container--disabled .select2-selection__rendered { color: #9c9c9c !important; } /** Ranges **/ -.daterangepicker .ranges li.active { +div.daterangepicker .ranges li.active { background-color: #bb86fc !important; color: #000000; } -.daterangepicker .ranges li:not(.active):hover { +div.daterangepicker .ranges li:not(.active):hover { background-color: #292929; } -.daterangepicker .ranges li:hover { +div.daterangepicker .ranges li:hover { background-color: #292929; } -.daterangepicker.show-ranges .drp-calendar.left { +div.daterangepicker.show-ranges .drp-calendar.left { border-left: 1px solid #292929 !important; } \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css index e3185a493..b6ab35edb 100644 --- a/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css +++ b/src/main/resources/gwt/material/design/incubator/client/daterange/resources/css/daterangepicker-dark.min.css @@ -1 +1 @@ -.daterangepicker,.daterangepicker .calendar-table,.daterangepicker td.off,.daterangepicker td.off.end-date,.daterangepicker td.off.in-range,.daterangepicker td.off.start-date{background-color:#2e3033;border-color:#2e3033}.daterangepicker:after{border-bottom:6px solid #2e3033}.daterangepicker:before{border-bottom:7px solid #2e3033}.daterangepicker th.month{color:#fff}.daterangepicker .calendar-table .next span,.daterangepicker .calendar-table .prev span{border:solid #fff;border-width:0 2px 2px 0}.daterangepicker .drp-buttons{border-top:1px solid #3d3d3d}.daterangepicker td.active,.daterangepicker td.active:hover,.daterangepicker td.in-range.active:not(.off){background-color:#bb86fc;color:#292929}.daterangepicker td:not(.active).available:hover,.daterangepicker th.available:hover{background-color:#2e3033}.daterangepicker td.available:hover:after{border:2px solid #bb86fc}.daterangepicker td.available.in-range:hover:not(.active),.daterangepicker td.in-range{background-color:rgba(187,134,252,.08);color:#bb86fc}button.cancelBtn{color:#bb86fc}.daterangepicker:not(.single) .drp-buttons{background-color:#2e3033}.daterangepicker .calendar-time{background:#292929;border:1px solid #292929}.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered{color:#fff}.date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field,.date-range-picker .select2-results__option,.select2-container--default .select2-results__option[aria-selected=true]{background:#2f2f2f}.date-range-picker .select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#292929}.daterangepicker .select2-container--disabled .select2-selection__rendered{color:#9c9c9c!important}.daterangepicker .ranges li.active{background-color:#bb86fc!important;color:#000}.daterangepicker .ranges li:not(.active):hover{background-color:#292929}.daterangepicker .ranges li:hover{background-color:#292929}.daterangepicker.show-ranges .drp-calendar.left{border-left:1px solid #292929!important} \ No newline at end of file +div.daterangepicker,div.daterangepicker .calendar-table,div.daterangepicker td.off,div.daterangepicker td.off.end-date,div.daterangepicker td.off.in-range,div.daterangepicker td.off.start-date{background-color:#2e3033;border-color:#2e3033}div.daterangepicker:after{border-bottom:6px solid #2e3033}div.daterangepicker:before{border-bottom:7px solid #2e3033}div.daterangepicker.drop-up:before{border-top:7px solid #2e3033}div.daterangepicker.drop-up:after{border-top:6px solid #2e3033}div.daterangepicker th.month{color:#fff}div.daterangepicker .calendar-table .next span,div.daterangepicker .calendar-table .prev span{border:solid #fff;border-width:0 2px 2px 0}div.daterangepicker .drp-buttons{border-top:1px solid #3d3d3d}div.daterangepicker td.active,div.daterangepicker td.active:hover,div.daterangepicker td.in-range.active:not(.off){background-color:#bb86fc;color:#292929}div.daterangepicker td:not(.active).available:hover,div.daterangepicker th.available:hover{background-color:#2e3033}div.daterangepicker td.available:hover:after{border:2px solid #bb86fc}div.daterangepicker td.available.in-range:hover:not(.active),div.daterangepicker td.in-range{background-color:rgba(187,134,252,.08);color:#bb86fc}div.drp-buttons button.cancelBtn{color:#bb86fc}div.drp-buttons button.cancelBtn:hover{color:#000}div.daterangepicker:not(.single) .drp-buttons{background-color:#2e3033}div.daterangepicker .calendar-time{background:#292929;border:1px solid #292929}div.daterangepicker .select2-container--default .select2-selection--single .select2-selection__rendered{color:#fff}.date-range-picker .select2-container--default .select2-search--dropdown .select2-search__field,.date-range-picker .select2-results__option,.select2-container--default .select2-results__option[aria-selected=true]{background:#2f2f2f}.date-range-picker .select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#292929}div.daterangepicker .select2-container--disabled .select2-selection__rendered{color:#9c9c9c!important}div.daterangepicker .ranges li.active{background-color:#bb86fc!important;color:#000}div.daterangepicker .ranges li:not(.active):hover{background-color:#292929}div.daterangepicker .ranges li:hover{background-color:#292929}div.daterangepicker.show-ranges .drp-calendar.left{border-left:1px solid #292929!important} \ No newline at end of file diff --git a/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.css b/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.css index 4f7095960..a4e5c5bb0 100644 --- a/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.css +++ b/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.css @@ -2,8 +2,8 @@ background: #424242; } -.group-toggle-button .wrapper button.active, -.group-toggle-button .wrapper button:not(.active):hover{ +.group-toggle-button .wrapper button.btn.active, +.group-toggle-button .wrapper button.btn:not(.active):hover{ background: #bb86fc; color: #1e1e1e; } diff --git a/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.min.css b/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.min.css index c52b62099..2c94a7d0c 100644 --- a/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.min.css +++ b/src/main/resources/gwt/material/design/incubator/client/toggle/resources/css/group-toggle-button-dark.min.css @@ -1 +1 @@ -.group-toggle-button .wrapper{background:#424242}.group-toggle-button .wrapper button.active,.group-toggle-button .wrapper button:not(.active):hover{background:#bb86fc;color:#1e1e1e}.group-toggle-button .wrapper button:not(.active):hover{background-color:#525252}.group-toggle-button .wrapper button{color:#8e8e8e;background-color:#424242;border-right:1px solid #292929} \ No newline at end of file +.group-toggle-button .wrapper{background:#424242}.group-toggle-button .wrapper button.btn.active,.group-toggle-button .wrapper button.btn:not(.active):hover{background:#bb86fc;color:#1e1e1e}.group-toggle-button .wrapper button:not(.active):hover{background-color:#525252}.group-toggle-button .wrapper button{color:#8e8e8e;background-color:#424242;border-right:1px solid #292929} \ No newline at end of file diff --git a/src/test/java/gwt/material/design/addins/client/ui/MaterialIconMorphTest.java b/src/test/java/gwt/material/design/addins/client/ui/MaterialIconMorphTest.java index 85919b6b1..fcd823e42 100644 --- a/src/test/java/gwt/material/design/addins/client/ui/MaterialIconMorphTest.java +++ b/src/test/java/gwt/material/design/addins/client/ui/MaterialIconMorphTest.java @@ -89,7 +89,5 @@ public void testStructure() { // when / then fireClickEvent(iconMorph); assertTrue(isClicked[0]); - assertTrue(iconMorph.getElement().hasAttribute("onclick")); - assertEquals("this.classList.toggle('morphed')", iconMorph.getElement().getAttribute("onclick")); } } diff --git a/src/test/java/gwt/material/design/addins/client/ui/MaterialTimePickerTest.java b/src/test/java/gwt/material/design/addins/client/ui/MaterialTimePickerTest.java index 6695bb04e..cab91411c 100644 --- a/src/test/java/gwt/material/design/addins/client/ui/MaterialTimePickerTest.java +++ b/src/test/java/gwt/material/design/addins/client/ui/MaterialTimePickerTest.java @@ -150,14 +150,7 @@ protected void checkOrientation(MaterialTimePicker timePicker) { @Override public void testEnabled() { // given - MaterialTimePicker timePicker = getWidget(false); - - // when / then - checkEnabled(timePicker, timePicker.getTimeInput()); - - // Standard - // given - attachWidget(); + MaterialTimePicker timePicker = getWidget(); // when / then checkEnabled(timePicker, timePicker.getTimeInput());