diff --git a/.travis.yml b/.travis.yml
index 66252d383..3397d055d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ cache:
- $HOME/.m2
before_install:
# install the gwt-material-jquery because it will depends on built in jquery
-- 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 ..
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 c3e1ccf60..15553da90 100644
--- a/README.md
+++ b/README.md
@@ -20,12 +20,12 @@ We created accessibilityHandlerRegistration;
+ protected boolean enabled = true;
+ protected boolean loaded;
+
+ public AccessibilityControl() {
+ accessibilityHandlerRegistration = new HashMap<>();
+ }
+
+ public void load(boolean debug) {
+ TextResource resource;
+ if (!loaded) {
+ if (debug) {
+ resource = MaterialDebugResources.INSTANCE.focusVisibleJsDebug();
+ } else {
+ resource = MaterialResources.INSTANCE.focusVisibleJs();
+ }
+ injectJs(resource);
+ loaded = true;
+ }
+ }
+
+ protected void injectJs(TextResource resource) {
+ String text = resource.getText() + ("//# sourceURL=" + resource.getName() + ".js");
+
+ // Inject the script resource
+ resourceUrlObject = ScriptInjector.fromString(text)
+ .setWindow(ScriptInjector.TOP_WINDOW)
+ .inject();
+ }
+
+ /**
+ * This will register the accessibility control for a widget provided with keycodes
+ */
+ public void registerWidget(MaterialWidget widget, int key) {
+ registerWidget(widget, key, null);
+ }
+
+ /**
+ * This will register the accessibility control for a widget provided with default KeyCodes.ENTER
+ */
+ public void registerWidget(MaterialWidget widget) {
+ registerWidget(widget, KeyCodes.KEY_ENTER);
+ }
+
+ public void registerWidget(MaterialWidget widget, TriggerCallback callback) {
+ registerWidget(widget, KeyCodes.KEY_ENTER, callback);
+ }
+
+ /**
+ * This will register the accessibility control for a widget provided with keycodes and
+ * TriggerCallback
+ */
+ public void registerWidget(MaterialWidget widget, int key, TriggerCallback callback) {
+ if (widget != null) {
+ HandlerRegistration handlerRegistration = widget.registerHandler(widget.addKeyUpHandler(event -> {
+ if (isEnabled() && event.getNativeKeyCode() == key) {
+ if (callback != null) {
+ callback.call(event);
+ } else {
+ triggerClick(widget);
+ }
+ }
+ }));
+ if (enabled) {
+ widget.setTabIndex(0);
+ } else {
+ widget.getElement().removeAttribute("tabIndex");
+ }
+ accessibilityHandlerRegistration.put(handlerRegistration, widget);
+ }
+ }
+
+ /**
+ * This will unregister any accessibility control to a widget
+ * @param widget
+ */
+ public void unregisterWidget(Widget widget) {
+ if (widget != null) {
+ if (widget.getElement().hasClassName(FOCUS_VISIBLE_WIDGET)) {
+ widget.removeStyleName(FOCUS_VISIBLE_WIDGET);
+ }
+
+ if (widget.getElement().hasAttribute(DATA_FOCUS_ADDED_ATTRIBUTE)) {
+ widget.getElement().removeAttribute(DATA_FOCUS_ADDED_ATTRIBUTE);
+ }
+ accessibilityHandlerRegistration.forEach((handlerRegistration, currentWidget) -> {
+ if (widget == currentWidget) {
+ handlerRegistration.removeHandler();
+ }
+ });
+ }
+ }
+
+ public void unload() {
+ JsMaterialElement html = $("html");
+ if (html != null) {
+ if (html.hasClass(FOCUS_VISIBILITY_CLASSNAME)) {
+ html.removeClass(FOCUS_VISIBILITY_CLASSNAME);
+ }
+ html.removeAttr(FOCUS_VISIBILITY_ATTRIBUTE);
+ }
+
+ if (resourceUrlObject != null) {
+ JsMaterialElement scriptTag = $(resourceUrlObject.cast());
+ scriptTag.remove();
+ }
+ loaded = false;
+ }
+
+ public void triggerClick(Widget widget) {
+ if (widget != null) {
+ JQuery.$(widget.getElement()).click();
+ }
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public static AccessibilityControl get() {
+ if (instance == null) {
+ instance = new AccessibilityControl();
+ }
+ return instance;
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/accessibility/TriggerCallback.java b/gwt-material/src/main/java/gwt/material/design/client/accessibility/TriggerCallback.java
new file mode 100644
index 000000000..085bab617
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/accessibility/TriggerCallback.java
@@ -0,0 +1,27 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.accessibility;
+
+import com.google.gwt.event.dom.client.KeyUpEvent;
+
+public interface TriggerCallback {
+
+ void call(KeyUpEvent event);
+}
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 7a975d4ac..fbfa8956b 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
@@ -28,6 +28,7 @@
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
+import gwt.material.design.client.accessibility.AccessibilityControl;
import gwt.material.design.client.base.density.Density;
import gwt.material.design.client.base.helper.DOMHelper;
import gwt.material.design.client.base.mixin.DensityMixin;
@@ -281,6 +282,9 @@ protected void load(boolean strict) {
navMenu.setHideOn(HideOn.HIDE_ON_LARGE);
}
navMenu.removeStyleName(CssName.NAVMENU_PERMANENT);
+
+ // Register Nav Menu Accessibility
+ AccessibilityControl.get().registerWidget(navMenu);
}
} catch (Exception ex) {
if (strict) {
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/AbstractValueWidget.java b/gwt-material/src/main/java/gwt/material/design/client/base/AbstractValueWidget.java
index 674e1f3b7..340022fbf 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/AbstractValueWidget.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/AbstractValueWidget.java
@@ -38,13 +38,14 @@
import gwt.material.design.client.base.validator.Validator;
import gwt.material.design.client.constants.Position;
import gwt.material.design.client.constants.StatusDisplayType;
+import gwt.material.design.client.ui.MaterialIcon;
import gwt.material.design.client.ui.MaterialLabel;
+import gwt.material.design.client.ui.MaterialValueBox;
import java.util.List;
-//TODO: HasRawValue
public abstract class AbstractValueWidget extends MaterialWidget implements HasValue, LeafValueEditor,
- HasEditorErrors, HasErrorHandler, HasStatusText, HasValidators, HasRequiredField, HasClearOnKeyUp {
+ HasEditorErrors, HasErrorHandler, HasStatusText, HasValidators, HasRequiredField, HasClearOnKeyUp, HasCopyCommand {
private boolean allowBlank = true;
private boolean autoValidate;
@@ -55,6 +56,7 @@ public abstract class AbstractValueWidget extends MaterialWidget implements H
private RequiredFieldMixin requiredFieldMixin;
private ClearOnKeyUpMixin clearOnKeyUpMixin;
private HandlerRegistration attachHandler, blurHandler;
+ protected CopyCommandMixin copyCommandMixin;
public AbstractValueWidget(Element element) {
super(element);
@@ -81,7 +83,7 @@ public void setValue(V value, boolean fireEvents, boolean reload) {
if (this instanceof HasReload) {
if (reload) {
- ((HasReload)this).reload();
+ ((HasReload) this).reload();
}
}
}
@@ -146,6 +148,11 @@ public StatusDisplayType getStatusDisplayType() {
return getStatusTextMixin().getStatusDisplayType();
}
+ @Override
+ public void setStatusShowByDefault(boolean showByDefault) {
+ getStatusTextMixin().setStatusShowByDefault(showByDefault);
+ }
+
@Override
public void updateStatusDisplay(StatusDisplayMixin.StatusType statusType) {
getStatusTextMixin().updateStatusDisplay(statusType);
@@ -265,7 +272,7 @@ protected BlankValidator createBlankValidator() {
protected void setupBlurValidation() {
final AbstractValueWidget inputWidget = getValidatorMixin().getInputWidget();
if (!inputWidget.isAttached()) {
- if(attachHandler == null) {
+ if (attachHandler == null) {
attachHandler = inputWidget.addAttachHandler(event -> {
if (blurHandler == null) {
blurHandler = inputWidget.addBlurHandler(blurEvent -> {
@@ -275,7 +282,7 @@ protected void setupBlurValidation() {
});
}
} else {
- if(blurHandler == null) {
+ if (blurHandler == null) {
blurHandler = inputWidget.addBlurHandler(event -> validate(isValidateOnBlur()));
}
}
@@ -331,6 +338,36 @@ public void setStatusDisplayPosition(Position position) {
getStatusTextMixin().setStatusDisplayPosition(position);
}
+ @Override
+ public void setCopyCommand(CopyCommand copyCommand) {
+ getCopyCommandMixin().setCopyCommand(copyCommand);
+ }
+
+ @Override
+ public CopyCommand getCopyCommand() {
+ return getCopyCommandMixin().getCopyCommand();
+ }
+
+ @Override
+ public void setCopyCommandCallback(CopyCommandCallback callback) {
+ getCopyCommandMixin().setCopyCommandCallback(callback);
+ }
+
+ @Override
+ public void setCopyCommandLocale(CopyCommandLocale locale) {
+ getCopyCommandMixin().setCopyCommandLocale(locale);
+ }
+
+ @Override
+ public void setCopyCommandIcon(MaterialIcon icon) {
+ getCopyCommandMixin().setCopyCommandIcon(icon);
+ }
+
+ @Override
+ public MaterialIcon getCopyCommandIcon() {
+ return getCopyCommandMixin().getCopyCommandIcon();
+ }
+
@Override
public HandlerRegistration addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler) {
return getValidatorMixin().addValidationChangedHandler(handler);
@@ -371,8 +408,15 @@ protected RequiredFieldMixin getRequiredFieldMixi
public ClearOnKeyUpMixin getClearOnKeyUpMixin() {
if (clearOnKeyUpMixin == null) {
- clearOnKeyUpMixin = new ClearOnKeyUpMixin(this, getStatusTextMixin().getPlaceholder());
+ clearOnKeyUpMixin = new ClearOnKeyUpMixin(this, getStatusTextMixin().getPlaceholder());
}
return clearOnKeyUpMixin;
}
+
+ protected CopyCommandMixin getCopyCommandMixin() {
+ if (copyCommandMixin == null) {
+ copyCommandMixin = new CopyCommandMixin(this);
+ }
+ return copyCommandMixin;
+ }
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/BaseCheckBox.java b/gwt-material/src/main/java/gwt/material/design/client/base/BaseCheckBox.java
index 60a02dee6..15cf77bcd 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/BaseCheckBox.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/BaseCheckBox.java
@@ -53,8 +53,11 @@
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.*;
+import gwt.material.design.client.accessibility.AccessibilityControl;
import gwt.material.design.client.constants.CssName;
+import static gwt.material.design.jquery.client.api.JQuery.$;
+
/**
* A standard check box widget.
*
@@ -87,16 +90,17 @@
*
*/
public class BaseCheckBox extends AbstractValueWidget implements HasName, HasValue,
- HasWordWrap, HasDirectionalSafeHtml, HasDirectionEstimator, IsEditor>, HasLabel {
+ HasWordWrap, HasDirectionalSafeHtml, HasDirectionEstimator, IsEditor>, HasLabel {
public static final DirectionEstimator DEFAULT_DIRECTION_ESTIMATOR =
- DirectionalTextHelper.DEFAULT_DIRECTION_ESTIMATOR;
+ DirectionalTextHelper.DEFAULT_DIRECTION_ESTIMATOR;
DirectionalTextHelper directionalTextHelper;
InputElement inputElem;
LabelElement labelElem;
private LeafValueEditor editor;
private boolean valueChangeHandlerInitialized;
+ private SelectionToggleHandler selectionToggleHandler;
/**
* Creates a check box with no label.
@@ -205,18 +209,14 @@ protected BaseCheckBox(Element elem) {
labelElem.setHtmlFor(uid);
directionalTextHelper = new DirectionalTextHelper(labelElem, true);
+ selectionToggleHandler = new SelectionToggleHandler<>(this);
- // Accessibility: setting tab index to be 0 by default, ensuring element
- // appears in tab sequence. FocusWidget's setElement method already
- // calls setTabIndex, which is overridden below. However, at the time
- // that this call is made, inputElem has not been created. So, we have
- // to call setTabIndex again, once inputElem has been created.
setTabIndex(0);
}
@Override
public HandlerRegistration addValueChangeHandler(
- final ValueChangeHandler handler) {
+ final ValueChangeHandler handler) {
// Is this the first value change handler? If so, time to add handlers
if (!valueChangeHandlerInitialized) {
ensureDomEventHandlers();
@@ -349,6 +349,7 @@ public void setEnabled(boolean enabled) {
} else {
addStyleDependentName(CssName.DISABLED);
}
+ getEnabledMixin().setEnabled(enabled);
}
@Override
@@ -385,17 +386,6 @@ public void setName(String name) {
inputElem.setName(name);
}
- @Override
- public void setTabIndex(int index) {
- // Need to guard against call to setTabIndex before inputElem is
- // initialized. This happens because FocusWidget's (a superclass of
- // CheckBox) setElement method calls setTabIndex before inputElem is
- // initialized. See CheckBox's protected constructor for more information.
- if (inputElem != null) {
- inputElem.setTabIndex(index);
- }
- }
-
@Override
public void setText(String text) {
directionalTextHelper.setTextOrHtml(text, false);
@@ -460,7 +450,7 @@ public void setWordWrap(boolean wrap) {
public void sinkEvents(int eventBitsToAdd) {
if (isOrWasAttached()) {
Event.sinkEvents(inputElem, eventBitsToAdd
- | Event.getEventsSunk(inputElem));
+ | Event.getEventsSunk(inputElem));
} else {
super.sinkEvents(eventBitsToAdd);
}
@@ -499,7 +489,9 @@ protected void onEnsureDebugId(String baseID) {
@Override
protected void onLoad() {
super.onLoad();
+
DOM.setEventListener(inputElem, this);
+ selectionToggleHandler.load();
}
/**
@@ -512,6 +504,7 @@ protected void onUnload() {
// Clear out the inputElem's event listener (breaking the circular
// reference between it and the widget).
DOM.setEventListener(inputElem, null);
+ selectionToggleHandler.unload();
setValue(getValue());
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommand.java b/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommand.java
new file mode 100644
index 000000000..437be3114
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommand.java
@@ -0,0 +1,39 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public enum CopyCommand {
+
+ OFF("off"),
+ ON_ALWAYS("on-always"),
+ ON_READONLY("on-readonly"),
+ ON_READONLY_HOVER("on-readonly-hover"),
+ ON_ALWAYS_HOVER("on-always-hover");
+
+ private String name;
+
+ CopyCommand(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommandCallback.java b/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommandCallback.java
new file mode 100644
index 000000000..df1e55954
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommandCallback.java
@@ -0,0 +1,30 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+import gwt.material.design.client.js.CopyCommandData;
+import gwt.material.design.client.ui.MaterialIcon;
+
+public interface CopyCommandCallback {
+
+ void success(T widget, MaterialIcon clipboardIcon, CopyCommandData data);
+
+ void error(CopyCommandData data);
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommandLocale.java b/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommandLocale.java
new file mode 100644
index 000000000..982dc5876
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/CopyCommandLocale.java
@@ -0,0 +1,31 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public interface CopyCommandLocale {
+
+ default String Copied() {
+ return "Copied";
+ }
+
+ default String CopyToClipboard() {
+ return "Copy to Clipboard";
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/DefaultSearchMatcher.java b/gwt-material/src/main/java/gwt/material/design/client/base/DefaultSearchMatcher.java
new file mode 100644
index 000000000..69f0c191a
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/DefaultSearchMatcher.java
@@ -0,0 +1,28 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public class DefaultSearchMatcher implements SearchMatcher {
+
+ @Override
+ public boolean match(SearchObject obj, String keyword) {
+ return obj.getKeyword().toLowerCase().contains(keyword.toLowerCase());
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/DeferredPrompt.java b/gwt-material/src/main/java/gwt/material/design/client/base/DeferredPrompt.java
new file mode 100644
index 000000000..917a1d57b
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/DeferredPrompt.java
@@ -0,0 +1,27 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+import jsinterop.annotations.JsType;
+
+@JsType
+public class DeferredPrompt {
+
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasContentEditable.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasContentEditable.java
new file mode 100644
index 000000000..28d5203f1
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasContentEditable.java
@@ -0,0 +1,33 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+/**
+ * The contentEditable property sets or returns whether the content of an element is editable or not.
+ *
+ * @author kevzlou7979
+ * @see Documentation
+ */
+public interface HasContentEditable {
+
+ void setContentEditable(boolean value);
+
+ boolean isContentEditable();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasCopyCommand.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasCopyCommand.java
new file mode 100644
index 000000000..e42ee81db
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasCopyCommand.java
@@ -0,0 +1,49 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+import gwt.material.design.client.ui.MaterialIcon;
+
+public interface HasCopyCommand {
+
+ /**
+ * Will append a copy to clipboard icon to the referenced widget.
+ */
+ void setCopyCommand(CopyCommand copyCommand);
+
+ CopyCommand getCopyCommand();
+
+ /**
+ * Will set the copy command callback. Which contains the text, widget and the icon.
+ */
+ void setCopyCommandCallback(CopyCommandCallback callback);
+
+ /**
+ * Support copy command localization specially tooltips.
+ */
+ void setCopyCommandLocale(CopyCommandLocale locale);
+
+ /**
+ * Apply a different icon to your copy command
+ */
+ void setCopyCommandIcon(MaterialIcon icon);
+
+ MaterialIcon getCopyCommandIcon();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasFieldSensitivity.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasFieldSensitivity.java
index c9e32391a..7a09a2a06 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/HasFieldSensitivity.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasFieldSensitivity.java
@@ -19,8 +19,16 @@
*/
package gwt.material.design.client.base;
+import com.google.gwt.event.shared.HandlerRegistration;
+import gwt.material.design.client.events.SensitivityChangedEvent;
+
public interface HasFieldSensitivity {
void setSensitive(boolean sensitive);
+
+ void setSensitive(boolean sensitive, boolean fireEvents);
+
boolean isSensitive();
+
+ HandlerRegistration addSensitivityChangedHandler(SensitivityChangedEvent.SensitivityChangedHandler handler);
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasFlexbox.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasFlexbox.java
index 013d40601..6171ffc7c 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/HasFlexbox.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasFlexbox.java
@@ -41,6 +41,8 @@ public interface HasFlexbox {
void setFlex(Flex flex);
+ void setFlexValue(String value);
+
void setFlexGrow(Integer flexGrow);
void setFlexShrink(Integer flexShrink);
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasGridLayout.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasGridLayout.java
new file mode 100644
index 000000000..89d6c5e3c
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasGridLayout.java
@@ -0,0 +1,307 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+/**
+ * CSS Grid Layout introduces a two-dimensional grid system to CSS. Grids can be used to lay out major page areas or small
+ * user interface elements. This article introduces the CSS Grid Layout and the new terminology that is part of the CSS
+ * Grid Layout Level 1 specification. The features shown in this overview will then be explained in greater detail in the
+ * rest of this guide.
+ *
+ * Documentation
+ *
+ * @author kevzlou7979
+ */
+public interface HasGridLayout {
+
+ String GRID = "grid";
+ String GRID_AREA = "gridArea";
+ String GRID_AUTO_COLUMNS = "gridAutoColumns";
+ String GRID_AUTO_FLOW = "gridAutoFlow";
+ String GRID_AUTO_ROWS = "gridAutoRows";
+ String GRID_COLUMN = "gridColumn";
+ String GRID_COLUMN_END = "gridColumnEnd";
+ String GRID_COLUMN_GAP = "gridColumnGap";
+ String GRID_COLUMN_START = "gridColumnStart";
+ String GRID_GAP = "gridGap";
+ String GRID_ROW = "gridRow";
+ String GRID_ROW_END = "gridRowEnd";
+ String GRID_ROW_GAP = "gridRowGap";
+ String GRID_ROW_START = "gridRowStart";
+ String GRID_TEMPLATE = "gridTemplate";
+ String GRID_TEMPLATE_AREAS = "gridTemplateAreas";
+ String GRID_TEMPLATE_COLUMNS = "gridTemplateColumns";
+ String GRID_TEMPLATE_ROWS = "gridTemplateRows";
+ String ALIGN_CONTENT = "alignContent";
+ String ALIGN_ITEMS = "alignItems";
+ String ALIGN_SELF = "alignSelf";
+ String COLUMN_GAP = "columnGap";
+ String GAP = "gap";
+ String JUSTIFY_CONTENT = "justifyContent";
+ String JUSTIFY_ITEMS = "justifyItems";
+ String JUSTIFY_SELF = "justifySelf";
+ String PLACE_CONTENT = "placeContent";
+ String PLACE_ITEMS = "placeItems";
+ String PLACE_SELF = "placeSelf";
+ String ROW_GAP = "rowGap";
+ String ASPECT_RATIO = "aspectRatio";
+
+ /**
+ * The grid CSS property is a shorthand property that sets all of the explicit grid properties (grid-template-rows,
+ * grid-template-columns, and grid-template-areas), and all the implicit grid properties (grid-auto-rows, grid-auto-columns,
+ * and grid-auto-flow), in a single declaration.
+ */
+ void setGridLayout(String value);
+
+ String getGridLayout();
+
+ /**
+ * The grid-area CSS property is a shorthand property for grid-row-start, grid-column-start, grid-row-end and grid-column-end,
+ * specifying a grid item’s size and location within the grid by contributing a line, a span, or nothing (automatic)
+ * to its grid placement, thereby specifying the edges of its grid area.
+ */
+ void setGridArea(String value);
+
+ String getGridArea();
+
+ /**
+ * The grid-auto-columns CSS property specifies the size of an implicitly-created grid column track or pattern of tracks.
+ */
+ void setGridAutoColumns(String value);
+
+ String getGridAutoColumns();
+
+ /**
+ * The grid-auto-flow CSS property controls how the auto-placement algorithm works, specifying exactly how auto-placed
+ * items get flowed into the grid.
+ */
+ void setGridAutoFlow(String value);
+
+ String getGridAutoFlow();
+
+ /**
+ * The grid-auto-rows CSS property specifies the size of an implicitly-created grid row track or pattern of tracks.
+ */
+ void setGridAutoRows(String value);
+
+ String getGridAutoRows();
+
+ /**
+ * The grid-column CSS property is a shorthand property for grid-column-start and grid-column-end specifying a grid
+ * item's size and location within the grid column by contributing a line, a span, or nothing (automatic) to its grid
+ * placement, thereby specifying the inline-start and inline-end edge of its grid area.
+ */
+ void setGridColumn(String value);
+
+ String getGridColumn();
+
+ /**
+ * The grid-column-end CSS property specifies a grid item’s end position within the grid column by contributing a
+ * line, a span, or nothing (automatic) to its grid placement, thereby specifying the block-end edge of its grid area.
+ */
+ void setGridColumnEnd(String value);
+
+ String getGridColumnEnd();
+
+ /**
+ * The column-gap CSS property sets the size of the gap (gutter) between an element's columns.
+ */
+ void setGridColumnGap(String value);
+
+ String getGridColumnGap();
+
+ /**
+ * The grid-column-start CSS property specifies a grid item’s start position within the grid column by contributing
+ * a line, a span, or nothing (automatic) to its grid placement. This start position defines the block-start edge of
+ * the grid area.
+ */
+ void setGridColumnStart(String value);
+
+ String getGridColumnStart();
+
+ /**
+ * The gap CSS property sets the gaps (gutters) between rows and columns. It is a shorthand for row-gap and column-gap.
+ */
+ void setGridGap(String value);
+
+ String getGridGap();
+
+ /**
+ * The grid-row CSS property is a shorthand property for grid-row-start and grid-row-end specifying a grid item’s
+ * size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement,
+ * thereby specifying the inline-start and inline-end edge of its grid area.
+ */
+ void setGridRow(String value);
+
+ String getGridRow();
+
+ /**
+ * The grid-row-end CSS property specifies a grid item’s end position within the grid row by contributing a line,
+ * a span, or nothing (automatic) to its grid placement, thereby specifying the inline-end edge of its grid area.
+ */
+ void setGridRowEnd(String value);
+
+ String getGridRowEnd();
+
+ /**
+ * The row-gap CSS property sets the size of the gap (gutter) between an element's grid rows.
+ */
+ void setGridRowGap(String value);
+
+ String getGridRowGap();
+
+ /**
+ * The grid-row-start CSS property specifies a grid item’s start position within the grid row by contributing a line,
+ * a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start edge of its grid area.
+ */
+ void setGridRowStart(String value);
+
+ String getGridRowStart();
+
+ /**
+ * The grid-template CSS property is a shorthand property for defining grid columns, rows, and areas.
+ */
+ void setGridTemplate(String value);
+
+ String getGridTemplate();
+
+ /**
+ * The grid-template-areas CSS property specifies named grid areas, establishing the cells in the grid and assigning them names.
+ */
+ void setGridTemplateAreas(String value);
+
+ String getGridTemplateAreas();
+
+ /**
+ * The grid-template-columns CSS property defines the line names and track sizing functions of the grid columns.
+ */
+ void setGridTemplateColumns(String value);
+
+ String getGridTemplateColumns();
+
+ /**
+ * The grid-template-rows CSS property defines the line names and track sizing functions of the grid rows.
+ */
+ void setGridTemplateRows(String value);
+
+ String getGridTemplateRows();
+
+ /**
+ * The CSS align-content property sets the distribution of space between and around content items along a flexbox's
+ * cross-axis or a grid's block axis.
+ */
+ void setAlignContent(String value);
+
+ String getAlignContent();
+
+ /**
+ * The CSS align-items property sets the align-self value on all direct children as a group. In Flexbox, it controls
+ * the alignment of items on the Cross Axis. In Grid Layout, it controls the alignment of items on the Block Axis
+ * within their grid area.
+ */
+ void setAlignItems(String value);
+
+ String getAlignItems();
+
+ /**
+ * The align-self CSS property overrides a grid or flex item's align-items value. In Grid, it aligns the item inside
+ * the grid area. In Flexbox, it aligns the item on the cross axis.
+ */
+ void setAlignSelf(String value);
+
+ String getAlignSelf();
+
+ /**
+ * The column-gap CSS property sets the size of the gap (gutter) between an element's columns.
+ */
+ void setColumnGap(String value);
+
+ String getColumnGap();
+
+ /**
+ * The gap CSS property sets the gaps (gutters) between rows and columns. It is a shorthand for row-gap and column-gap.
+ */
+ void setGap(String value);
+
+ String getGap();
+
+ /**
+ * The CSS justify-content property defines how the browser distributes space between and around content items along
+ * the main-axis of a flex container, and the inline axis of a grid container.
+ */
+ void setJustifyContent(String value);
+
+ String getJustifyContent();
+
+ /**
+ * The CSS justify-items property defines the default justify-self for all items of the box, giving them all a default
+ * way of justifying each box along the appropriate axis.
+ */
+ void setJustifyItems(String value);
+
+ String getJustifyItems();
+
+ /**
+ * The CSS justify-self property sets the way a box is justified inside its alignment container along the appropriate axis.
+ */
+ void setJustifySelf(String value);
+
+ String getJustifySelf();
+
+ /**
+ * The place-content CSS property is a shorthand for align-content and justify-content. It can be used in any layout
+ * method which utilizes both of these alignment values.
+ */
+ void setPlaceContent(String value);
+
+ String getPlaceContent();
+
+ /**
+ * The CSS place-items shorthand property sets the align-items and justify-items properties, respectively.
+ * If the second value is not set, the first value is also used for it.
+ */
+ void setPlaceItems(String value);
+
+ String getPlaceItems();
+
+ /**
+ * The place-self CSS property is a shorthand property sets both the align-self and justify-self properties.
+ * The first value is the align-self property value, the second the justify-self one. If the second value is not present,
+ * the first value is also used for it.
+ */
+ void setPlaceSelf(String value);
+
+ String getPlaceSelf();
+
+ /**
+ * The row-gap CSS property sets the size of the gap (gutter) between an element's grid rows.
+ */
+ void setRowGap(String value);
+
+ String getRowGap();
+
+ /**
+ * The aspect-ratio CSS property sets a preferred aspect ratio for the box, which will be used in the calculation
+ * of auto sizes and some other layout functions.
+ */
+ void setAspectRatio(String value);
+
+ String getAspectRatio();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasRegex.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasRegex.java
new file mode 100644
index 000000000..a234f29c8
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasRegex.java
@@ -0,0 +1,38 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public interface HasRegex extends HasRegexHandlers {
+
+ /**
+ * The regex to be matched on value boxe's value. To be validated
+ * on KeyPress and Paste Events.
+ */
+ void setRegex(String regex);
+
+ /**
+ * The regex to be matched on value boxe's value. To be validated
+ * on KeyPress and Paste Events. The second parameter will
+ * clean all pasted value with provided regex replace expression
+ */
+ void setRegex(String regex, String replaceRegex);
+
+ String getRegex();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasRegexHandlers.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasRegexHandlers.java
new file mode 100644
index 000000000..b4dbfe34f
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasRegexHandlers.java
@@ -0,0 +1,28 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import gwt.material.design.client.events.RegexValidationEvent;
+
+public interface HasRegexHandlers {
+
+ HandlerRegistration addRegexValidationHandler(RegexValidationEvent.RegexValidationHandler handler);
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasResize.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasResize.java
new file mode 100644
index 000000000..01e17a667
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasResize.java
@@ -0,0 +1,46 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public interface HasResize {
+
+ enum Resizable {
+ NONE("none"),
+ BOTH("both"),
+ HORIZONTAL("horizontal"),
+ VERTICAL("vertical"),
+ INITIAL("initial"),
+ INHERIT("inherit");
+
+ String name;
+
+ Resizable(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+ }
+
+ void setResize(Resizable value);
+
+ String getResize();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasSingleValue.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasSingleValue.java
new file mode 100644
index 000000000..be64ea33e
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasSingleValue.java
@@ -0,0 +1,29 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public interface HasSingleValue {
+
+ void setSingleValue(T value);
+
+ void setSingleValue(T value, boolean fireEvents);
+
+ T getSingleValue();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasStatusDisplayType.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasStatusDisplayType.java
index e6f6ef62f..47909c9e3 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/HasStatusDisplayType.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasStatusDisplayType.java
@@ -32,4 +32,6 @@ public interface HasStatusDisplayType {
void updateStatusDisplay(StatusDisplayMixin.StatusType statusType);
void setStatusDisplayPosition(Position position);
+
+ void setStatusShowByDefault(boolean showByDefault);
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasTooltip.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasTooltip.java
index 2ad2bbc43..3baf7153e 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/HasTooltip.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasTooltip.java
@@ -79,4 +79,9 @@ public interface HasTooltip {
* Get the Tooltip element to ease of customization
*/
JQueryElement getTooltipElement();
+
+ /**
+ * This will detach or remove the tooltip element
+ */
+ void removeTooltip();
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/MaterialWidget.java b/gwt-material/src/main/java/gwt/material/design/client/base/MaterialWidget.java
index 72c687818..a191c639a 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/MaterialWidget.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/MaterialWidget.java
@@ -27,7 +27,6 @@
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.*;
-import gwt.material.design.client.MaterialDesign;
import gwt.material.design.client.base.helper.StyleHelper;
import gwt.material.design.client.base.mixin.*;
import gwt.material.design.client.base.validator.HasValidators;
@@ -55,7 +54,7 @@ public class MaterialWidget extends ComplexPanel implements HasId, HasEnabled, H
HasShadow, Focusable, HasInlineStyle, HasSeparator, HasScrollspy, HasHideOn, HasShowOn, HasCenterOn, HasCircle, HasWaves,
HasDataAttributes, HasFloat, HasTooltip, HasFlexbox, HasHoverable, HasFontWeight, HasFontSize, HasDepth, HasInitialClasses,
HasInteractionHandlers, HasAllFocusHandlers, HasFilterStyle, HasBorder, HasVerticalAlign, HasTransform, HasOrientation,
- HasContainer, HasWordBreak, HasZoom {
+ HasContainer, HasWordBreak, HasZoom, HasGridLayout, HasResize, HasContentEditable {
private static JQueryElement window = null;
private static JQueryElement body = null;
@@ -134,8 +133,10 @@ public Appender(Widget widget) {
private TransformMixin transformMixin;
private OrientationMixin orientationMixin;
private ContainerMixin containerMixin;
+ private GridLayoutMixin gridLayoutMixin;
- public MaterialWidget() {}
+ public MaterialWidget() {
+ }
public MaterialWidget(JQueryElement jQueryElement) {
this();
@@ -331,16 +332,330 @@ public void setFocus(boolean focused) {
getFocusableMixin().setFocus(focused);
}
+ public void setFocus(boolean focused, boolean appendFocusStyleName) {
+ getFocusableMixin().setFocus(focused, appendFocusStyleName);
+ }
+
@Override
public void setTabIndex(int index) {
getFocusableMixin().setTabIndex(index);
}
+ @Override
+ public String getGridLayout() {
+ return getGridLayoutMixin().getGridLayout();
+ }
+
+ @Override
+ public void setGridArea(String value) {
+ getGridLayoutMixin().setGridArea(value);
+ }
+
+ @Override
+ public String getGridArea() {
+ return getGridLayoutMixin().getGridArea();
+ }
+
+ @Override
+ public void setGridAutoColumns(String value) {
+ getGridLayoutMixin().setGridAutoColumns(value);
+ }
+
+ @Override
+ public String getGridAutoColumns() {
+ return getGridLayoutMixin().getGridAutoColumns();
+ }
+
+ @Override
+ public void setGridAutoFlow(String value) {
+ getGridLayoutMixin().setGridAutoFlow(value);
+ }
+
+ @Override
+ public String getGridAutoFlow() {
+ return getGridLayoutMixin().getGridAutoFlow();
+ }
+
+ @Override
+ public void setGridAutoRows(String value) {
+ getGridLayoutMixin().setGridAutoRows(value);
+ }
+
+ @Override
+ public String getGridAutoRows() {
+ return getGridLayoutMixin().getGridAutoRows();
+ }
+
+ @Override
+ public void setGridColumn(String value) {
+ getGridLayoutMixin().setGridColumn(value);
+ }
+
+ @Override
+ public String getGridColumn() {
+ return getGridLayoutMixin().getGridColumn();
+ }
+
+ @Override
+ public void setGridColumnEnd(String value) {
+ getGridLayoutMixin().setGridColumnEnd(value);
+ }
+
+ @Override
+ public String getGridColumnEnd() {
+ return getGridLayoutMixin().getGridColumnEnd();
+ }
+
+ @Override
+ public void setGridColumnGap(String value) {
+ getGridLayoutMixin().setGridColumnGap(value);
+ }
+
+ @Override
+ public String getGridColumnGap() {
+ return getGridLayoutMixin().getGridColumnGap();
+ }
+
+ @Override
+ public void setGridColumnStart(String value) {
+ getGridLayoutMixin().setGridColumnStart(value);
+ }
+
+ @Override
+ public String getGridColumnStart() {
+ return getGridLayoutMixin().getGridColumnStart();
+ }
+
+ @Override
+ public void setGridGap(String value) {
+ getGridLayoutMixin().setGridGap(value);
+ }
+
+ @Override
+ public String getGridGap() {
+ return getGridLayoutMixin().getGridGap();
+ }
+
+ @Override
+ public void setGridRow(String value) {
+ getGridLayoutMixin().setGridRow(value);
+ }
+
+ @Override
+ public String getGridRow() {
+ return getGridLayoutMixin().getGridRow();
+ }
+
+ @Override
+ public void setGridRowEnd(String value) {
+ getGridLayoutMixin().setGridRowEnd(value);
+ }
+
+ @Override
+ public String getGridRowEnd() {
+ return getGridLayoutMixin().getGridRowEnd();
+ }
+
+ @Override
+ public void setGridRowGap(String value) {
+ getGridLayoutMixin().setGridRowGap(value);
+ }
+
+ @Override
+ public String getGridRowGap() {
+ return getGridLayoutMixin().getGridRowGap();
+ }
+
+ @Override
+ public void setGridRowStart(String value) {
+ getGridLayoutMixin().setGridRowStart(value);
+ }
+
+ @Override
+ public String getGridRowStart() {
+ return getGridLayoutMixin().getGridRowStart();
+ }
+
+ @Override
+ public void setGridTemplate(String value) {
+ getGridLayoutMixin().setGridTemplate(value);
+ }
+
+ @Override
+ public String getGridTemplate() {
+ return getGridLayoutMixin().getGridTemplate();
+ }
+
+ @Override
+ public void setGridTemplateAreas(String value) {
+ getGridLayoutMixin().setGridTemplateAreas(value);
+ }
+
+ @Override
+ public String getGridTemplateAreas() {
+ return getGridLayoutMixin().getGridTemplateAreas();
+ }
+
+ @Override
+ public void setGridTemplateColumns(String value) {
+ getGridLayoutMixin().setGridTemplateColumns(value);
+ }
+
+ @Override
+ public String getGridTemplateColumns() {
+ return getGridLayoutMixin().getGridTemplateColumns();
+ }
+
+ @Override
+ public void setGridTemplateRows(String value) {
+ getGridLayoutMixin().setGridTemplateRows(value);
+ }
+
+ @Override
+ public String getGridTemplateRows() {
+ return getGridLayoutMixin().getGridTemplateRows();
+ }
+
+ @Override
+ public void setAlignContent(String value) {
+ getGridLayoutMixin().setAlignContent(value);
+ }
+
+ @Override
+ public String getAlignContent() {
+ return getGridLayoutMixin().getAlignContent();
+ }
+
+ @Override
+ public void setAlignItems(String value) {
+ getGridLayoutMixin().setAlignItems(value);
+ }
+
+ @Override
+ public String getAlignItems() {
+ return getGridLayoutMixin().getAlignItems();
+ }
+
+ @Override
+ public void setAlignSelf(String value) {
+ getGridLayoutMixin().setAlignSelf(value);
+ }
+
+ @Override
+ public String getAlignSelf() {
+ return getGridLayoutMixin().getAlignSelf();
+ }
+
+ @Override
+ public void setColumnGap(String value) {
+ getGridLayoutMixin().setColumnGap(value);
+ }
+
+ @Override
+ public String getColumnGap() {
+ return getGridLayoutMixin().getColumnGap();
+ }
+
+ @Override
+ public void setGap(String value) {
+ getGridLayoutMixin().setGap(value);
+ }
+
+ @Override
+ public String getGap() {
+ return getGridLayoutMixin().getGap();
+ }
+
+ @Override
+ public void setJustifyContent(String value) {
+ getGridLayoutMixin().setJustifyContent(value);
+ }
+
+ @Override
+ public String getJustifyContent() {
+ return getGridLayoutMixin().getJustifyContent();
+ }
+
+ @Override
+ public void setJustifyItems(String value) {
+ getGridLayoutMixin().setJustifyItems(value);
+ }
+
+ @Override
+ public String getJustifyItems() {
+ return getGridLayoutMixin().getJustifyItems();
+ }
+
+ @Override
+ public void setJustifySelf(String value) {
+ getGridLayoutMixin().setJustifySelf(value);
+ }
+
+ @Override
+ public String getJustifySelf() {
+ return getGridLayoutMixin().getJustifySelf();
+ }
+
+ @Override
+ public void setPlaceContent(String value) {
+ getGridLayoutMixin().setPlaceContent(value);
+ }
+
+ @Override
+ public String getPlaceContent() {
+ return getGridLayoutMixin().getPlaceContent();
+ }
+
+ @Override
+ public void setPlaceItems(String value) {
+ getGridLayoutMixin().setPlaceItems(value);
+ }
+
+ @Override
+ public String getPlaceItems() {
+ return getGridLayoutMixin().getPlaceItems();
+ }
+
+ @Override
+ public void setPlaceSelf(String value) {
+ getGridLayoutMixin().setPlaceSelf(value);
+ }
+
+ @Override
+ public String getPlaceSelf() {
+ return getGridLayoutMixin().getPlaceSelf();
+ }
+
+ @Override
+ public void setRowGap(String value) {
+ getGridLayoutMixin().setRowGap(value);
+ }
+
+ @Override
+ public String getRowGap() {
+ return getGridLayoutMixin().getRowGap();
+ }
+
+ @Override
+ public void setAspectRatio(String value) {
+ getGridLayoutMixin().setAspectRatio(value);
+ }
+
+ @Override
+ public String getAspectRatio() {
+ return getGridLayoutMixin().getAspectRatio();
+ }
+
@Override
public void setGrid(String grid) {
getGridMixin().setGrid(grid);
}
+ @Override
+ public void setGridLayout(String value) {
+ getGridLayoutMixin().setGridLayout(value);
+ }
+
@Override
public void setOffset(String offset) {
getGridMixin().setOffset(offset);
@@ -580,6 +895,11 @@ public JQueryElement getTooltipElement() {
return getTooltipMixin().getTooltipElement();
}
+ @Override
+ public void removeTooltip() {
+ getTooltipMixin().removeTooltip();
+ }
+
public void setVisibility(Style.Visibility visibility) {
getElement().getStyle().setVisibility(visibility);
}
@@ -610,6 +930,11 @@ public void setFlex(Flex flex) {
getFlexboxMixin().setFlex(flex);
}
+ @Override
+ public void setFlexValue(String value) {
+ getElement().getStyle().setProperty("flex", value);
+ }
+
@Override
public void setFlexGrow(Integer flexGrow) {
getFlexboxMixin().setFlexGrow(flexGrow);
@@ -1030,6 +1355,36 @@ public void setZoom(Double level) {
getElement().getStyle().setProperty("zoom", level != null ? String.valueOf(level) : "");
}
+ @Override
+ public void setResize(Resizable value) {
+ getElement().getStyle().setProperty("resize", value != null ? value.getName() : "");
+ }
+
+ @Override
+ public String getResize() {
+ return getElement().getStyle().getProperty("resize");
+ }
+
+ @Override
+ public void setContentEditable(boolean value) {
+ getElement().setAttribute("contenteditable", String.valueOf(value));
+ }
+
+ @Override
+ public boolean isContentEditable() {
+ return Boolean.parseBoolean(getElement().getAttribute("contenteditable"));
+ }
+
+ @Override
+ public void setWidth(String width) {
+ getElement().getStyle().setProperty("width", width);
+ }
+
+ @Override
+ public void setHeight(String height) {
+ getElement().getStyle().setProperty("height", height);
+ }
+
/**
* Add an {@code AttachHandler} for attachment events.
*
@@ -1581,6 +1936,13 @@ public ContainerMixin getContainerMixin() {
return containerMixin;
}
+ public GridLayoutMixin getGridLayoutMixin() {
+ if (gridLayoutMixin == null) {
+ gridLayoutMixin = new GridLayoutMixin<>(this);
+ }
+ return gridLayoutMixin;
+ }
+
public void setTranslationKey(String key) {
this.translationKey = key;
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/SearchMatcher.java b/gwt-material/src/main/java/gwt/material/design/client/base/SearchMatcher.java
new file mode 100644
index 000000000..594f91510
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/SearchMatcher.java
@@ -0,0 +1,25 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+public interface SearchMatcher {
+
+ boolean match(SearchObject obj, String keyword);
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/SelectionToggleHandler.java b/gwt-material/src/main/java/gwt/material/design/client/base/SelectionToggleHandler.java
new file mode 100644
index 000000000..94cdb1484
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/SelectionToggleHandler.java
@@ -0,0 +1,51 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base;
+
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.Widget;
+
+import static gwt.material.design.jquery.client.api.JQuery.$;
+
+public class SelectionToggleHandler> {
+
+ protected T widget;
+
+ protected SelectionToggleHandler() {
+ }
+
+ public SelectionToggleHandler(T widget) {
+ this.widget = widget;
+ }
+
+ public void load() {
+ $(widget.getElement()).keydown(e -> {
+ if (e.getKeyCode() == KeyCodes.KEY_ENTER) {
+ widget.setValue(!widget.getValue(), true);
+ }
+ return true;
+ });
+ }
+
+ public void unload() {
+ $(widget.getElement()).off("keydown");
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/CopyCommandMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/CopyCommandMixin.java
new file mode 100644
index 000000000..3be85daec
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/CopyCommandMixin.java
@@ -0,0 +1,164 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base.mixin;
+
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.user.client.DOM;
+import gwt.material.design.client.base.*;
+import gwt.material.design.client.base.helper.EventHelper;
+import gwt.material.design.client.constants.IconType;
+import gwt.material.design.client.constants.Position;
+import gwt.material.design.client.js.ClipboardJS;
+import gwt.material.design.client.js.CopyCommandData;
+import gwt.material.design.client.ui.MaterialIcon;
+import gwt.material.design.client.ui.MaterialValueBox;
+
+import static gwt.material.design.jquery.client.api.JQuery.$;
+
+public class CopyCommandMixin extends AbstractMixin implements HasCopyCommand {
+
+ public static final String COPY_COMMAND = "copy-command";
+ public static final String COPY_COMMAND_PARENT = "copy-command-parent";
+ public static final String DATA_CLIPBOARD_TEXT = "data-clipboard-text";
+ public static final String DATA_CLIPBOARD_ACTION = "data-clipboard-action";
+
+ protected T copyCommandParent;
+ protected ClipboardJS clipboardJS;
+ protected CopyCommand copyCommand = CopyCommand.OFF;
+ protected MaterialIcon icon = new MaterialIcon(IconType.CONTENT_COPY);
+ protected CopyCommandLocale locale = new CopyCommandLocale() {
+ };
+ protected CopyCommandCallback callback;
+
+ public CopyCommandMixin(T copyCommandParent) {
+ super(copyCommandParent);
+
+ this.copyCommandParent = copyCommandParent;
+ EventHelper.onAttachOnce(uiObject, attachEvent -> setup());
+ }
+
+ protected void setup() {
+ if (copyCommand != null && copyCommand != CopyCommand.OFF) {
+ setupCopyIcon();
+ setupValueBox();
+ setupClipboardJs();
+ } else {
+ detachIcon();
+ }
+ }
+
+ protected void setupCopyIcon() {
+ // Setup Widget and Icon
+ icon.addStyleName(COPY_COMMAND);
+ icon.setId(DOM.createUniqueId());
+ copyCommandParent.addStyleName(COPY_COMMAND_PARENT);
+ copyCommandParent.add(icon);
+ icon.addStyleName(copyCommand.getName());
+ icon.addMouseOutHandler(event -> updateTooltip(locale.CopyToClipboard()));
+ icon.addClickHandler(event -> {
+ icon.getElement().setAttribute(DATA_CLIPBOARD_TEXT, copyCommandParent.getValue() != null ? copyCommandParent.getValue().toString() : "");
+ });
+ }
+
+ protected void setupValueBox() {
+ // Will be checking if we have a value box as parent.
+ if (copyCommandParent instanceof MaterialValueBox) {
+ MaterialValueBox> valueBox = (MaterialValueBox) this.copyCommandParent;
+ valueBox.addToggleReadOnlyHandler(event -> checkReadyOnly(valueBox));
+ valueBox.addSensitivityChangedHandler(event -> checkReadyOnly(valueBox));
+ checkReadyOnly(valueBox);
+ }
+ }
+
+ protected void setupClipboardJs() {
+ updateTooltip(locale.CopyToClipboard());
+ clipboardJS = new ClipboardJS("#" + icon.getId());
+ clipboardJS.on("success", this::onSuccess);
+ clipboardJS.on("error", this::onError);
+ }
+
+ protected void checkReadyOnly(MaterialValueBox> valueBox) {
+ boolean visible = (copyCommand == CopyCommand.ON_READONLY || copyCommand == CopyCommand.ON_READONLY_HOVER)
+ && !valueBox.isSensitive()
+ && valueBox.isReadOnly();
+ icon.getElement().getStyle().setVisibility(visible ? Style.Visibility.VISIBLE : Style.Visibility.HIDDEN);
+ Scheduler.get().scheduleDeferred(() -> icon.setEnabled(visible));
+ }
+
+ protected void detachIcon() {
+ if (icon.isAttached()) {
+ icon.removeFromParent();
+ }
+ }
+
+ protected void updateTooltip(String tooltip) {
+ icon.setTooltipPosition(Position.TOP);
+ icon.setTooltipDelayMs(0);
+ icon.setTooltip(tooltip);
+ }
+
+ protected String getStringValue() {
+ return copyCommandParent != null && copyCommandParent.getValue() != null ? copyCommandParent.getValue().toString() : "";
+ }
+
+ protected boolean onSuccess(CopyCommandData data) {
+ if (callback != null) callback.success(copyCommandParent, icon, data);
+ updateTooltip(locale.Copied() + ":" + getStringValue());
+ $(icon.getElement()).trigger("mouseover", null);
+ data.clearSelection();
+ return true;
+ }
+
+ protected boolean onError(CopyCommandData data) {
+ if (callback != null) callback.error(data);
+ return false;
+ }
+
+ @Override
+ public void setCopyCommand(CopyCommand copyCommand) {
+ this.copyCommand = copyCommand;
+ }
+
+ @Override
+ public CopyCommand getCopyCommand() {
+ return copyCommand;
+ }
+
+ @Override
+ public void setCopyCommandCallback(CopyCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void setCopyCommandLocale(CopyCommandLocale locale) {
+ this.locale = locale;
+ }
+
+ @Override
+ public void setCopyCommandIcon(MaterialIcon icon) {
+ this.icon = icon;
+ }
+
+ @Override
+ public MaterialIcon getCopyCommandIcon() {
+ return icon;
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/EnabledMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/EnabledMixin.java
index 6f495a079..b75797918 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/EnabledMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/EnabledMixin.java
@@ -31,7 +31,10 @@
* @author kevzlou7979
*/
public class EnabledMixin extends AbstractMixin implements HasEnabled {
+
+ private static final String TAB_INDEX = "tabIndex";
private static final String DISABLED = "disabled";
+ private String initialTabIndex;
private HandlerRegistration handler;
@@ -50,6 +53,8 @@ public void setUiObject(T uiObject) {
handler.removeHandler();
handler = null;
}
+
+ initialTabIndex = uiObject.getElement().getAttribute("tabIndex");
}
@Override
@@ -58,8 +63,13 @@ public boolean isEnabled() {
}
@Override
- public void setEnabled(boolean enabled) {
- if (!uiObject.isAttached() && handler == null) {
+ public void setEnabled(final boolean enabled) {
+ if (!uiObject.isAttached()) {
+ if (handler != null) {
+ handler.removeHandler();
+ handler = null;
+ }
+
handler = uiObject.addAttachHandler(event -> {
if (event.isAttached()) {
applyEnabled(enabled, uiObject);
@@ -76,7 +86,7 @@ public void setEnabled(boolean enabled) {
public void setEnabled(MaterialWidget widget, boolean enabled) {
setEnabled(enabled);
- if(isPropagateToChildren()) {
+ if (isPropagateToChildren()) {
for (Widget child : widget.getChildren()) {
if (child instanceof MaterialWidget) {
((MaterialWidget) child).setEnabled(enabled);
@@ -97,6 +107,7 @@ private void applyEnabled(boolean enabled, UIObject obj) {
}
updateWaves(enabled, obj);
+ updateTabIndex(enabled, obj);
}
public void updateWaves(boolean enabled, UIObject obj) {
@@ -112,6 +123,17 @@ public void updateWaves(boolean enabled, UIObject obj) {
}
}
+ public void updateTabIndex(boolean enabled, UIObject obj) {
+ if (obj instanceof MaterialWidget) {
+ MaterialWidget widget = (MaterialWidget) obj;
+ if (enabled) {
+ if (initialTabIndex != null) widget.getElement().setAttribute(TAB_INDEX, initialTabIndex);
+ } else {
+ widget.getElement().setAttribute(TAB_INDEX, "-1");
+ }
+ }
+ }
+
public boolean isPropagateToChildren() {
return propagateToChildren;
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FieldSensitivityMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FieldSensitivityMixin.java
index 7d655efb3..792ae8939 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FieldSensitivityMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FieldSensitivityMixin.java
@@ -19,15 +19,19 @@
*/
package gwt.material.design.client.base.mixin;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
import com.google.gwt.user.client.ui.UIObject;
import gwt.material.design.client.base.HasFieldSensitivity;
import gwt.material.design.client.base.HasInputType;
import gwt.material.design.client.constants.InputType;
+import gwt.material.design.client.events.SensitivityChangedEvent;
/**
* @author Ben Dol
*/
-public class FieldSensitivityMixin extends AbstractMixin implements HasFieldSensitivity {
+public class FieldSensitivityMixin extends AbstractMixin
+ implements HasFieldSensitivity {
protected final InputType defaultInputType;
@@ -39,11 +43,24 @@ public FieldSensitivityMixin(T uiObject) {
@Override
public void setSensitive(boolean sensitive) {
+ setSensitive(sensitive, false);
+ }
+
+ @Override
+ public void setSensitive(boolean sensitive, boolean fireEvents) {
uiObject.setType(sensitive ? InputType.PASSWORD : defaultInputType);
+ if (fireEvents) {
+ SensitivityChangedEvent.fire((HasHandlers) uiObject, sensitive);
+ }
}
@Override
public boolean isSensitive() {
return uiObject.getType().equals(InputType.PASSWORD);
}
+
+ @Override
+ public HandlerRegistration addSensitivityChangedHandler(SensitivityChangedEvent.SensitivityChangedHandler handler) {
+ return uiObject.addSensitivityChangedHandler(handler);
+ }
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FlexboxMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FlexboxMixin.java
index 68551d232..2dd44b984 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FlexboxMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FlexboxMixin.java
@@ -63,6 +63,11 @@ public void setDisplay(Display display) {
return;
}
+ if (display.equals(Display.GRID) || display.equals(Display.INLINE_GRID)) {
+ uiObject.getElement().getStyle().setProperty("display", display.getCssName());
+ return;
+ }
+
if (display.getGwtDisplay() != null) {
uiObject.getElement().getStyle().setDisplay(display.getGwtDisplay());
} else {
@@ -89,8 +94,8 @@ public void setFlexDirection(FlexDirection flexDirection) {
setDisplay(Display.FLEX);
}
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- new String[]{"MsFlexDirection", "WebkitFlexDirection", "MozFlexDirection", "flexDirection"},
- flexDirection != null ? flexDirection.getValue() : null);
+ new String[]{"MsFlexDirection", "WebkitFlexDirection", "MozFlexDirection", "flexDirection"},
+ flexDirection != null ? flexDirection.getValue() : null);
// Updating the display to Flex will set display:flex and override the visibility of the control
// this ensures that if you setVisible(false) it will not become visible unless calling setVisible(true)
@@ -113,61 +118,66 @@ public void setFlex(Flex flex) {
setFlexBasis(flex.getBasis());
}
+ @Override
+ public void setFlexValue(String value) {
+ uiObject.getElement().getStyle().setProperty("flex", value);
+ }
+
@Override
public void setFlexGrow(Integer flexGrow) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- new String[]{"MsFlexGrow", "WebkitFlexGrow", "MozFlexGrow", "flexGrow"},
- flexGrow != null ? flexGrow.toString() : null);
+ new String[]{"MsFlexGrow", "WebkitFlexGrow", "MozFlexGrow", "flexGrow"},
+ flexGrow != null ? flexGrow.toString() : null);
}
@Override
public void setFlexShrink(Integer flexShrink) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- new String[]{"MsFlexShrink", "WebkitFlexShrink", "MozFlexShrink", "flexShrink"},
- flexShrink != null ? flexShrink.toString() : null);
+ new String[]{"MsFlexShrink", "WebkitFlexShrink", "MozFlexShrink", "flexShrink"},
+ flexShrink != null ? flexShrink.toString() : null);
}
@Override
public void setFlexBasis(String flexBasis) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- new String[]{"MsFlexBasis", "WebkitFlexBasis", "MozFlexBasis", "flexBasis"}, flexBasis);
+ new String[]{"MsFlexBasis", "WebkitFlexBasis", "MozFlexBasis", "flexBasis"}, flexBasis);
}
@Override
public void setFlexOrder(Integer flexOrder) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- new String[]{"MsFlexOrder", "WebkitOrder", "MozFlexOrder", "order"},
- flexOrder != null ? flexOrder.toString() : null);
+ new String[]{"MsFlexOrder", "WebkitOrder", "MozFlexOrder", "order"},
+ flexOrder != null ? flexOrder.toString() : null);
}
@Override
public void setFlexWrap(FlexWrap flexWrap) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- new String[]{"MsFlexWrap", "WebkitFlexWrap", "MozFlexWrap", "flexWrap"},
- flexWrap != null ? flexWrap.getValue() : null);
+ new String[]{"MsFlexWrap", "WebkitFlexWrap", "MozFlexWrap", "flexWrap"},
+ flexWrap != null ? flexWrap.getValue() : null);
}
@Override
public void setFlexAlignContent(FlexAlignContent flexAlignContent) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- "MsFlexLinePack", new String[]{"WebkitAlignContent", "MozFlexAlignContent", "alignContent"}, flexAlignContent);
+ "MsFlexLinePack", new String[]{"WebkitAlignContent", "MozFlexAlignContent", "alignContent"}, flexAlignContent);
}
@Override
public void setFlexAlignSelf(FlexAlignSelf flexAlignSelf) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- "MsFlexItemAlign", new String[]{"WebkitAlignSelf", "MozFlexItemAlign", "alignSelf"}, flexAlignSelf);
+ "MsFlexItemAlign", new String[]{"WebkitAlignSelf", "MozFlexItemAlign", "alignSelf"}, flexAlignSelf);
}
@Override
public void setFlexAlignItems(FlexAlignItems flexAlignItems) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- "MsFlexAlign", new String[]{"WebkitAlignItems", "MozFlexAlign", "alignItems"}, flexAlignItems);
+ "MsFlexAlign", new String[]{"WebkitAlignItems", "MozFlexAlign", "alignItems"}, flexAlignItems);
}
@Override
public void setFlexJustifyContent(FlexJustifyContent flexJustifyContent) {
BrowserPrefixHelper.updateStyleProperties(uiObject.getElement(),
- "MsFlexPack", new String[]{"WebkitJustifyContent", "MozJustifyContent", "justifyContent"}, flexJustifyContent);
+ "MsFlexPack", new String[]{"WebkitJustifyContent", "MozJustifyContent", "justifyContent"}, flexJustifyContent);
}
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FocusableMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FocusableMixin.java
index 5f342e70d..440d149ce 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FocusableMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/FocusableMixin.java
@@ -24,14 +24,19 @@
import com.google.gwt.dom.client.ButtonElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.InputElement;
+import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.UIObject;
+import com.google.gwt.user.client.ui.Widget;
+import gwt.material.design.client.accessibility.AccessibilityControl;
/**
* @author Sven Jacobs
*/
public class FocusableMixin extends AbstractMixin implements Focusable {
+ protected static final String FOCUS_VISIBLE = "focus-visible";
+
public FocusableMixin(final T uiObject) {
super(uiObject);
}
@@ -44,6 +49,13 @@ public int getTabIndex() {
@Override
public void setTabIndex(final int index) {
uiObject.getElement().setTabIndex(index);
+
+ if (index > -1) {
+ if (uiObject instanceof HasClickHandlers && uiObject instanceof Widget) {
+ ((HasClickHandlers) uiObject).addClickHandler(event ->
+ AccessibilityControl.get().unregisterWidget((Widget) uiObject));
+ }
+ }
}
@Override
@@ -62,10 +74,16 @@ public void setAccessKey(final char key) {
@Override
public void setFocus(final boolean focused) {
+ setFocus(focused, false);
+ }
+
+ public void setFocus(boolean focused, boolean appendFocusStyleName) {
if (focused) {
uiObject.getElement().focus();
+ if (appendFocusStyleName) uiObject.addStyleName(FOCUS_VISIBLE);
} else {
uiObject.getElement().blur();
+ if (appendFocusStyleName) uiObject.removeStyleName(FOCUS_VISIBLE);
}
}
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/GridLayoutMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/GridLayoutMixin.java
new file mode 100644
index 000000000..3573e09fb
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/GridLayoutMixin.java
@@ -0,0 +1,347 @@
+/*
+ * #%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.client.base.mixin;
+
+import com.google.gwt.user.client.ui.Widget;
+import gwt.material.design.client.base.HasGridLayout;
+
+/**
+ * A mixin for constructing modern css grid layouts.
+ *
+ * @author kevzlou7979
+ * @see HasGridLayout
+ */
+public class GridLayoutMixin extends StylePropertyMixin implements HasGridLayout {
+
+
+ public GridLayoutMixin(T uiObject) {
+ super(uiObject);
+ }
+
+ @Override
+ public void setGridLayout(String value) {
+ setProperty(GRID, value);
+ }
+
+ @Override
+ public String getGridLayout() {
+ return getProperty(GRID);
+ }
+
+ @Override
+ public void setGridArea(String value) {
+ setProperty(GRID_AREA, value);
+ }
+
+ @Override
+ public String getGridArea() {
+ return getProperty(GRID_AREA);
+ }
+
+ @Override
+ public void setGridAutoColumns(String value) {
+ setProperty(GRID_AUTO_COLUMNS, value);
+ }
+
+ @Override
+ public String getGridAutoColumns() {
+ return getProperty(GRID_AUTO_COLUMNS);
+ }
+
+ @Override
+ public void setGridAutoFlow(String value) {
+ setProperty(GRID_AUTO_FLOW, value);
+ }
+
+ @Override
+ public String getGridAutoFlow() {
+ return getProperty(GRID_AUTO_FLOW);
+ }
+
+ @Override
+ public void setGridAutoRows(String value) {
+ setProperty(GRID_AUTO_ROWS, value);
+ }
+
+ @Override
+ public String getGridAutoRows() {
+ return getProperty(GRID_AUTO_ROWS);
+ }
+
+ @Override
+ public void setGridColumn(String value) {
+ setProperty(GRID_COLUMN, value);
+ }
+
+ @Override
+ public String getGridColumn() {
+ return getProperty(GRID_COLUMN);
+ }
+
+ @Override
+ public void setGridColumnEnd(String value) {
+ setProperty(GRID_COLUMN_END, value);
+ }
+
+ @Override
+ public String getGridColumnEnd() {
+ return getProperty(GRID_COLUMN_END);
+ }
+
+ @Override
+ public void setGridColumnGap(String value) {
+ setProperty(GRID_COLUMN_GAP, value);
+ }
+
+ @Override
+ public String getGridColumnGap() {
+ return getProperty(GRID_COLUMN_GAP);
+ }
+
+ @Override
+ public void setGridColumnStart(String value) {
+ setProperty(GRID_COLUMN_START, value);
+ }
+
+ @Override
+ public String getGridColumnStart() {
+ return getProperty(GRID_COLUMN_START);
+ }
+
+ @Override
+ public void setGridGap(String value) {
+ setProperty(GRID_GAP, value);
+ }
+
+ @Override
+ public String getGridGap() {
+ return getProperty(GRID_GAP);
+ }
+
+ @Override
+ public void setGridRow(String value) {
+ setProperty(GRID_ROW, value);
+ }
+
+ @Override
+ public String getGridRow() {
+ return getProperty(GRID_ROW);
+ }
+
+ @Override
+ public void setGridRowEnd(String value) {
+ setProperty(GRID_ROW_END, value);
+ }
+
+ @Override
+ public String getGridRowEnd() {
+ return getProperty(GRID_ROW_END);
+ }
+
+ @Override
+ public void setGridRowGap(String value) {
+ setProperty(GRID_ROW_GAP, value);
+ }
+
+ @Override
+ public String getGridRowGap() {
+ return getProperty(GRID_ROW_GAP);
+ }
+
+ @Override
+ public void setGridRowStart(String value) {
+ setProperty(GRID_ROW_START, value);
+ }
+
+ @Override
+ public String getGridRowStart() {
+ return getProperty(GRID_ROW_START);
+ }
+
+ @Override
+ public void setGridTemplate(String value) {
+ setProperty(GRID_TEMPLATE, value);
+ }
+
+ @Override
+ public String getGridTemplate() {
+ return getProperty(GRID_TEMPLATE);
+ }
+
+ @Override
+ public void setGridTemplateAreas(String value) {
+ setProperty(GRID_TEMPLATE_AREAS, value);
+ }
+
+ @Override
+ public String getGridTemplateAreas() {
+ return getProperty(GRID_TEMPLATE_AREAS);
+ }
+
+ @Override
+ public void setGridTemplateColumns(String value) {
+ setProperty(GRID_TEMPLATE_COLUMNS, value);
+ }
+
+ @Override
+ public String getGridTemplateColumns() {
+ return getProperty(GRID_TEMPLATE_COLUMNS);
+ }
+
+ @Override
+ public void setGridTemplateRows(String value) {
+ setProperty(GRID_TEMPLATE_ROWS, value);
+ }
+
+ @Override
+ public String getGridTemplateRows() {
+ return getProperty(GRID_TEMPLATE_ROWS);
+ }
+
+ @Override
+ public void setAlignContent(String value) {
+ setProperty(ALIGN_CONTENT, value);
+ }
+
+ @Override
+ public String getAlignContent() {
+ return getProperty(ALIGN_CONTENT);
+ }
+
+ @Override
+ public void setAlignItems(String value) {
+ setProperty(ALIGN_ITEMS, value);
+ }
+
+ @Override
+ public String getAlignItems() {
+ return getProperty(ALIGN_ITEMS);
+ }
+
+ @Override
+ public void setAlignSelf(String value) {
+ setProperty(ALIGN_SELF, value);
+ }
+
+ @Override
+ public String getAlignSelf() {
+ return getProperty(ALIGN_SELF);
+ }
+
+ @Override
+ public void setColumnGap(String value) {
+ setProperty(COLUMN_GAP, value);
+ }
+
+ @Override
+ public String getColumnGap() {
+ return getProperty(COLUMN_GAP);
+ }
+
+ @Override
+ public void setGap(String value) {
+ setProperty(GAP, value);
+ }
+
+ @Override
+ public String getGap() {
+ return getProperty(GAP);
+ }
+
+ @Override
+ public void setJustifyContent(String value) {
+ setProperty(JUSTIFY_CONTENT, value);
+ }
+
+ @Override
+ public String getJustifyContent() {
+ return getProperty(JUSTIFY_CONTENT);
+ }
+
+ @Override
+ public void setJustifyItems(String value) {
+ setProperty(JUSTIFY_ITEMS, value);
+ }
+
+ @Override
+ public String getJustifyItems() {
+ return getProperty(JUSTIFY_ITEMS);
+ }
+
+ @Override
+ public void setJustifySelf(String value) {
+ setProperty(JUSTIFY_SELF, value);
+ }
+
+ @Override
+ public String getJustifySelf() {
+ return getProperty(JUSTIFY_SELF);
+ }
+
+ @Override
+ public void setPlaceContent(String value) {
+ setProperty(PLACE_CONTENT, value);
+ }
+
+ @Override
+ public String getPlaceContent() {
+ return getProperty(PLACE_CONTENT);
+ }
+
+ @Override
+ public void setPlaceItems(String value) {
+ setProperty(PLACE_ITEMS, value);
+ }
+
+ @Override
+ public String getPlaceItems() {
+ return getProperty(PLACE_ITEMS);
+ }
+
+ @Override
+ public void setPlaceSelf(String value) {
+ setProperty(PLACE_SELF, value);
+ }
+
+ @Override
+ public String getPlaceSelf() {
+ return getProperty(PLACE_SELF);
+ }
+
+ @Override
+ public void setRowGap(String value) {
+ setProperty(ROW_GAP, value);
+ }
+
+ @Override
+ public String getRowGap() {
+ return getProperty(ROW_GAP);
+ }
+
+ @Override
+ public void setAspectRatio(String value) {
+ setProperty(ASPECT_RATIO, value);
+ }
+
+ @Override
+ public String getAspectRatio() {
+ return getProperty(ASPECT_RATIO);
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/OverlayStyleMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/OverlayStyleMixin.java
index 271558e23..346854ad5 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/OverlayStyleMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/OverlayStyleMixin.java
@@ -81,6 +81,10 @@ protected void applyBlur(Blur blur, boolean reset) {
blurValue = "";
}
target.css("filter", blurValue != null ? blurValue : "");
+
+ if (blur.isFixedTarget()) {
+ target.css("height", "100" + Style.Unit.PCT);
+ }
}
}
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/RegexMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/RegexMixin.java
new file mode 100644
index 000000000..735b47a26
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/RegexMixin.java
@@ -0,0 +1,107 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.base.mixin;
+
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import gwt.material.design.client.base.HasRegex;
+import gwt.material.design.client.base.helper.EventHelper;
+import gwt.material.design.client.events.PasteEvent;
+import gwt.material.design.client.events.RegexValidationEvent;
+import gwt.material.design.client.ui.MaterialValueBox;
+
+public class RegexMixin extends AbstractMixin implements HasRegex {
+
+ protected String regex;
+ protected String replaceRegex;
+ protected HandlerRegistration keyPressHandler, pasteHandler, blurHandler;
+
+ public RegexMixin(final T uiObject) {
+ super(uiObject);
+
+ EventHelper.onAttachOnce(uiObject, attachEvent -> setup());
+ }
+
+ protected void setup() {
+ if (regex != null && !regex.isEmpty()) {
+ keyPressHandler = uiObject.addKeyPressHandler(this::matchRegexOnKeyPress);
+ pasteHandler = uiObject.addPasteHandler(this::matchRegexOnPaste);
+ blurHandler = uiObject.addBlurHandler(this::matchRegexOnBlur);
+ } else {
+ if (keyPressHandler != null) keyPressHandler.removeHandler();
+ if (pasteHandler != null) pasteHandler.removeHandler();
+ }
+ }
+
+ protected void matchRegexOnKeyPress(KeyPressEvent event) {
+ String value = String.valueOf(event.getCharCode());
+ boolean matches = value.matches(regex);
+ if (!matches) {
+ uiObject.getValueBoxBase().cancelKey();
+ }
+ RegexValidationEvent.fire(uiObject, event, value, regex, matches);
+ }
+
+ protected void matchRegexOnPaste(PasteEvent event) {
+ Scheduler.get().scheduleDeferred(() -> {
+ String value = event.getValue().replaceAll(replaceRegex, "");
+ boolean matches = value.matches(regex);
+ uiObject.clear();
+ if (matches) {
+ uiObject.setText(value);
+ }
+ RegexValidationEvent.fire(uiObject, event, event.getValue(), regex, matches);
+ });
+ }
+
+ protected void matchRegexOnBlur(BlurEvent event) {
+ String value = uiObject.getText();
+ if (value != null) {
+ boolean matches = value.matches(regex);
+ if (!matches) {
+ uiObject.clear();
+ }
+ RegexValidationEvent.fire(uiObject, event, value, regex, matches);
+ }
+ }
+
+ @Override
+ public void setRegex(String regex) {
+ this.regex = regex;
+ }
+
+ @Override
+ public void setRegex(String regex, String replaceRegex) {
+ this.regex = regex;
+ this.replaceRegex = replaceRegex;
+ }
+
+ @Override
+ public String getRegex() {
+ return regex;
+ }
+
+ @Override
+ public HandlerRegistration addRegexValidationHandler(RegexValidationEvent.RegexValidationHandler handler) {
+ return uiObject.addHandler(handler, RegexValidationEvent.getType());
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusDisplayMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusDisplayMixin.java
index e9228b9e0..9354afc91 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusDisplayMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusDisplayMixin.java
@@ -19,6 +19,7 @@
*/
package gwt.material.design.client.base.mixin;
+import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.ui.HasText;
@@ -32,7 +33,7 @@
import gwt.material.design.client.ui.MaterialIcon;
public class StatusDisplayMixin
- extends AbstractMixin implements HasStatusDisplayType {
+ extends AbstractMixin implements HasStatusDisplayType {
public enum StatusType {
ERROR,
@@ -44,6 +45,7 @@ public enum StatusType {
private MaterialIcon statusIcon = new MaterialIcon();
private Widget container;
private Position position;
+ private boolean showByDefault = false;
private CssNameMixin statusCssNameMixin;
private CssNameMixin positionCssNameMixin;
@@ -91,6 +93,8 @@ public void updateStatusDisplay(StatusType statusType) {
registerHandlers();
}
+
+ if (showByDefault) Scheduler.get().scheduleDeferred(this::showStatus);
} else {
resetStatusDisplay();
}
@@ -102,6 +106,11 @@ public void setStatusDisplayPosition(Position position) {
updatePosition(position);
}
+ @Override
+ public void setStatusShowByDefault(boolean showByDefault) {
+ this.showByDefault = showByDefault;
+ }
+
protected void registerHandlers() {
MaterialWidget widget = (MaterialWidget) uiObject;
statusIcon.getHandlerRegistry().clearHandlers();
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusTextMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusTextMixin.java
index 11857cf67..511f04121 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusTextMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/StatusTextMixin.java
@@ -61,7 +61,7 @@ public StatusTextMixin(final T widget, final H textObject, UIObject target, UIOb
@Override
public void setErrorText(String errorText) {
clearSuccessText();
- clearHelperText();
+ hideHelperText();
updateStatusDisplay(StatusDisplayMixin.StatusType.ERROR);
if (textObject != null) {
@@ -85,7 +85,7 @@ public void setErrorText(String errorText) {
@Override
public void setSuccessText(String successText) {
clearErrorText();
- clearHelperText();
+ hideHelperText();
updateStatusDisplay(StatusDisplayMixin.StatusType.SUCCESS);
if (textObject != null) {
@@ -106,6 +106,7 @@ public void setSuccessText(String successText) {
}
}
+
@Override
public void setHelperText(String helperText) {
this.helperText = helperText;
@@ -173,6 +174,11 @@ public void clearSuccessText() {
@Override
public void clearHelperText() {
+ helperText="";
+ hideHelperText();
+ }
+
+ protected void hideHelperText() {
if (textObject != null) {
textObject.setText("");
textObject.setVisible(false);
@@ -230,10 +236,19 @@ public void setStatusDisplayPosition(Position position) {
getStatusDisplayMixin().setStatusDisplayPosition(position);
}
+ @Override
+ public void setStatusShowByDefault(boolean showByDefault) {
+ getStatusDisplayMixin().setStatusShowByDefault(showByDefault);
+ }
+
public void resetStatusDisplay() {
getStatusDisplayMixin().resetStatusDisplay();
}
+ public H getTextObject() {
+ return textObject;
+ }
+
public StatusDisplayMixin getStatusDisplayMixin() {
if (statusDisplayMixin == null) {
statusDisplayMixin = new StatusDisplayMixin<>(uiObject, textObject);
diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/TooltipMixin.java b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/TooltipMixin.java
index 649b781a2..e696b361b 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/base/mixin/TooltipMixin.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/base/mixin/TooltipMixin.java
@@ -126,4 +126,14 @@ public String getTooltipHTML() {
public JQueryElement getTooltipElement() {
return tooltip.getTooltipElement();
}
+
+ @Override
+ public void removeTooltip() {
+ if (tooltip != null) {
+ JQueryElement tooltipElement = tooltip.getTooltipElement();
+ if (tooltipElement != null) {
+ tooltipElement.remove();
+ }
+ }
+ }
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/constants/Blur.java b/gwt-material/src/main/java/gwt/material/design/client/constants/Blur.java
index 5d119d54e..f22546dbd 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/constants/Blur.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/constants/Blur.java
@@ -29,6 +29,7 @@
public class Blur {
private int value;
+ private boolean fixedTarget;
private JQueryElement[] targets;
public Blur() {
@@ -66,4 +67,16 @@ public JQueryElement[] getTargets() {
public void setTargets(JQueryElement... targets) {
this.targets = targets;
}
+
+ public boolean isFixedTarget() {
+ return fixedTarget;
+ }
+
+ /**
+ * Will apply a height of 100% to a fix target. This is a recommended fixed
+ * fixed position element applying a blur.
+ */
+ public void setFixedTarget(boolean fixedTarget) {
+ this.fixedTarget = fixedTarget;
+ }
}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/constants/CssName.java b/gwt-material/src/main/java/gwt/material/design/client/constants/CssName.java
index 5ff36ae2e..f289ca7db 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/constants/CssName.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/constants/CssName.java
@@ -27,7 +27,6 @@
public interface CssName {
String BADGE = "badge";
- String SIDEBAR_BADGE = "sideBarBadge";
String BREADCRUMB = "breadcrumb";
String CARD = "card";
String CARD_ACTION = "card-action";
diff --git a/gwt-material/src/main/java/gwt/material/design/client/constants/Display.java b/gwt-material/src/main/java/gwt/material/design/client/constants/Display.java
index 057a556e9..445129561 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/constants/Display.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/constants/Display.java
@@ -26,10 +26,11 @@
* @author chriswjones
*/
public enum Display implements HasCssName {
- FLEX("flex"),
- NONE(Style.Display.NONE),
- BLOCK(Style.Display.BLOCK),
INLINE(Style.Display.INLINE),
+ BLOCK(Style.Display.BLOCK),
+ FLEX("flex"),
+ GRID("grid"),
+ INLINE_GRID("inline-grid"),
INLINE_BLOCK(Style.Display.INLINE_BLOCK),
INLINE_TABLE(Style.Display.INLINE_TABLE),
LIST_ITEM(Style.Display.LIST_ITEM),
@@ -43,6 +44,7 @@ public enum Display implements HasCssName {
TABLE_CELL(Style.Display.TABLE_CELL),
TABLE_COLUMN(Style.Display.TABLE_COLUMN),
TABLE_ROW(Style.Display.TABLE_ROW),
+ NONE(Style.Display.NONE),
INITIAL(Style.Display.INITIAL);
private final String cssName;
diff --git a/gwt-material/src/main/java/gwt/material/design/client/events/RegexValidationEvent.java b/gwt-material/src/main/java/gwt/material/design/client/events/RegexValidationEvent.java
new file mode 100644
index 000000000..73a75845e
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/events/RegexValidationEvent.java
@@ -0,0 +1,80 @@
+/*
+ * #%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.client.events;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HasHandlers;
+import gwt.material.design.client.events.RegexValidationEvent.RegexValidationHandler;
+
+public class RegexValidationEvent extends GwtEvent {
+
+ protected String value;
+ protected String regex;
+ protected boolean match;
+ protected GwtEvent eventSource;
+
+ public interface RegexValidationHandler extends EventHandler {
+ void onRegexValidation(RegexValidationEvent event);
+ }
+
+ public RegexValidationEvent(GwtEvent eventSource, String value, String regex, boolean match) {
+ this.eventSource = eventSource;
+ this.value = value;
+ this.regex = regex;
+ this.match = match;
+ }
+
+ public static final Type TYPE = new Type<>();
+
+ public static void fire(HasHandlers source, GwtEvent eventSource, String value, String regex, boolean match) {
+ source.fireEvent(new RegexValidationEvent(eventSource, value, regex, match));
+ }
+
+ @Override
+ public Type getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(RegexValidationHandler handler) {
+ handler.onRegexValidation(this);
+ }
+
+ public static Type getType() {
+ return TYPE;
+ }
+
+ public GwtEvent getEventSource() {
+ return eventSource;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getRegex() {
+ return regex;
+ }
+
+ public boolean isMatch() {
+ return match;
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/events/SensitivityChangedEvent.java b/gwt-material/src/main/java/gwt/material/design/client/events/SensitivityChangedEvent.java
new file mode 100644
index 000000000..31a0d0f23
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/events/SensitivityChangedEvent.java
@@ -0,0 +1,58 @@
+/*
+ * #%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.client.events;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HasHandlers;
+import gwt.material.design.client.events.SensitivityChangedEvent.SensitivityChangedHandler;
+
+public class SensitivityChangedEvent extends GwtEvent {
+
+ public interface SensitivityChangedHandler extends EventHandler {
+ void onSensitivityChanged(SensitivityChangedEvent event);
+ }
+
+ private final boolean sensitive;
+
+ public SensitivityChangedEvent(boolean sensitive) {
+ this.sensitive = sensitive;
+ }
+
+ public static final Type TYPE = new Type<>();
+
+ public static void fire(HasHandlers source, boolean sensitive) {
+ source.fireEvent(new SensitivityChangedEvent(sensitive));
+ }
+
+ @Override
+ public Type getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ protected void dispatch(SensitivityChangedHandler handler) {
+ handler.onSensitivityChanged(this);
+ }
+
+ public boolean isSensitive() {
+ return sensitive;
+ }
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/js/ClipboardJS.java b/gwt-material/src/main/java/gwt/material/design/client/js/ClipboardJS.java
new file mode 100644
index 000000000..f25948c8e
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/js/ClipboardJS.java
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.js;
+
+import gwt.material.design.jquery.client.api.Functions;
+import gwt.material.design.jquery.client.api.JQueryElement;
+import jsinterop.annotations.JsConstructor;
+import jsinterop.annotations.JsPackage;
+import jsinterop.annotations.JsType;
+
+@JsType(isNative = true, namespace = JsPackage.GLOBAL)
+public class ClipboardJS {
+
+ @JsConstructor
+ public ClipboardJS(String className) {
+ }
+
+ public native JQueryElement on(String eventName, Functions.Func1 event);
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/js/CopyCommandData.java b/gwt-material/src/main/java/gwt/material/design/client/js/CopyCommandData.java
new file mode 100644
index 000000000..943acebaa
--- /dev/null
+++ b/gwt-material/src/main/java/gwt/material/design/client/js/CopyCommandData.java
@@ -0,0 +1,41 @@
+/*
+ * #%L
+ * GwtMaterial
+ * %%
+ * Copyright (C) 2015 - 2020 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.client.js;
+
+import jsinterop.annotations.JsMethod;
+import jsinterop.annotations.JsPackage;
+import jsinterop.annotations.JsProperty;
+import jsinterop.annotations.JsType;
+
+@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
+public class CopyCommandData {
+
+ @JsProperty
+ public String action;
+
+ @JsProperty
+ public String text;
+
+ @JsProperty
+ public String trigger;
+
+ @JsMethod
+ public native void clearSelection();
+}
diff --git a/gwt-material/src/main/java/gwt/material/design/client/js/JsMaterialElement.java b/gwt-material/src/main/java/gwt/material/design/client/js/JsMaterialElement.java
index 7c2ab2342..82ac35f7a 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/js/JsMaterialElement.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/js/JsMaterialElement.java
@@ -232,6 +232,9 @@ public class JsMaterialElement extends JQueryElement {
@JsMethod(namespace = "Materialize")
public static native double showStaggeredList(Object selector);
+ @JsMethod(namespace = "Materialize")
+ public static native double hideStaggeredList(Object selector);
+
@JsMethod(namespace = "Waves")
public static native void displayEffect();
diff --git a/gwt-material/src/main/java/gwt/material/design/client/js/Window.java b/gwt-material/src/main/java/gwt/material/design/client/js/Window.java
index dd41f57f5..ef7967a8f 100644
--- a/gwt-material/src/main/java/gwt/material/design/client/js/Window.java
+++ b/gwt-material/src/main/java/gwt/material/design/client/js/Window.java
@@ -21,6 +21,9 @@
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
+import gwt.material.design.client.base.DeferredPrompt;
+import gwt.material.design.jquery.client.api.Functions;
+import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsType;
@JsType
@@ -36,6 +39,12 @@ public static native MediaQueryList getMediaQueryList(String query) /*-{
return $wnd.window.matchMedia(query);
}-*/;
+ @JsMethod(namespace = "window")
+ public static native void addEventListener(String eventName, Functions.Func1