diff --git a/.travis.yml b/.travis.yml index 26d526dff..02e501ec5 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.7.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git +- git clone -b release_2.8.0 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 44ac15065..71dc1f398 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.7.1" ]; then +if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.8.0" ]; 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 28b039c7d..938d197dd 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ Support documentation can be found [here](https://github.com/GwtMaterialDesign/g We created Java Docs for developers ## Maven -### Current Version 2.7.1 +### Current Version 2.8.0 ```xml com.github.gwtmaterialdesign gwt-material - 2.7.1 + 2.8.0 ``` ### Snapshot Version 2.8.0-SNAPSHOT diff --git a/gwt-material/pom.xml b/gwt-material/pom.xml index 89afafb2e..123716408 100644 --- a/gwt-material/pom.xml +++ b/gwt-material/pom.xml @@ -4,7 +4,7 @@ gwt-material-parent com.github.gwtmaterialdesign - 2.7.1 + 2.8.0 4.0.0 diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/HasSymbols.java b/gwt-material/src/main/java/gwt/material/design/client/base/HasSymbols.java new file mode 100644 index 000000000..90f35c1f0 --- /dev/null +++ b/gwt-material/src/main/java/gwt/material/design/client/base/HasSymbols.java @@ -0,0 +1,42 @@ +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 - 2023 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.constants.Color; +import gwt.material.design.client.constants.SymbolType; + +public interface HasSymbols { + + void setType(SymbolType type); + + void setSymbol(String symbol); + + void setColor(Color color); + + void setSymbolSize(String size); + + void setFilled(boolean filled); + + void setWeight(int weight); + + void setGrade(int grade); + + void setOpticalSize(int size); +} diff --git a/gwt-material/src/main/java/gwt/material/design/client/base/viewport/Resolution.java b/gwt-material/src/main/java/gwt/material/design/client/base/viewport/Resolution.java index 89aafc536..fdaca7169 100644 --- a/gwt-material/src/main/java/gwt/material/design/client/base/viewport/Resolution.java +++ b/gwt-material/src/main/java/gwt/material/design/client/base/viewport/Resolution.java @@ -22,7 +22,7 @@ public enum Resolution implements Boundary { ALL_DEVICES(new WidthBoundary(0, 2560)), ALL_MOBILE(new WidthBoundary(0, 425)), - ALL_LAPTOP(new WidthBoundary(769, 2560)), + ALL_LAPTOP(new WidthBoundary(769, 25000)), MOBILE_SMALL(new WidthBoundary(0, 320)), MOBILE_MEDIUM(new WidthBoundary(321, 375)), MOBILE_LARGE(new WidthBoundary(376, 425)), @@ -30,7 +30,7 @@ public enum Resolution implements Boundary { TABLET_AND_MOBILE(new WidthBoundary(0, 768)), LAPTOP(new WidthBoundary(769, 1024)), LAPTOP_LARGE(new WidthBoundary(1025, 1440)), - LAPTOP_4K(new WidthBoundary(1441, 2560)); + LAPTOP_4K(new WidthBoundary(1441, 25000)); private final WidthBoundary boundary; diff --git a/gwt-material/src/main/java/gwt/material/design/client/constants/SymbolType.java b/gwt-material/src/main/java/gwt/material/design/client/constants/SymbolType.java new file mode 100644 index 000000000..74f4d4148 --- /dev/null +++ b/gwt-material/src/main/java/gwt/material/design/client/constants/SymbolType.java @@ -0,0 +1,50 @@ +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 - 2023 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.constants; + +import gwt.material.design.client.base.helper.EnumHelper; + +public enum SymbolType implements CssType { + + OUTLINED("material-symbols-outlined", "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"), + ROUNDED("material-symbols-rounded", "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"), + SHARP("material-symbols-sharp", "https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"); + + protected String name; + protected String cssLink; + + SymbolType(String name, String cssLink) { + this.name = name; + this.cssLink = cssLink; + } + + @Override + public String getCssName() { + return name; + } + + public String getCssLink() { + return cssLink; + } + + public static SymbolType fromStyleName(final String styleName) { + return EnumHelper.fromStyleName(styleName, SymbolType.class, OUTLINED); + } +} diff --git a/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSymbol.java b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSymbol.java new file mode 100644 index 000000000..4c48682ec --- /dev/null +++ b/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSymbol.java @@ -0,0 +1,119 @@ +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 - 2023 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.ui; + +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.LinkElement; +import gwt.material.design.client.base.HasSymbols; +import gwt.material.design.client.base.MaterialWidget; +import gwt.material.design.client.base.mixin.ColorsMixin; +import gwt.material.design.client.base.mixin.CssNameMixin; +import gwt.material.design.client.constants.Color; +import gwt.material.design.client.constants.SymbolType; +import gwt.material.design.client.ui.html.Span; + +public class MaterialSymbol extends MaterialWidget implements HasSymbols { + + protected Span span = new Span(); + protected static LinkElement linkElement = Document.get().createLinkElement(); + protected CssNameMixin symbolTypeMixin; + protected ColorsMixin symbolColorsMixin; + protected boolean filled; + protected int weight = 400; + protected int grade = 0; + protected int opticalSize = 48; + + static { + linkElement.setRel("stylesheet"); + body().append(linkElement); + } + + public MaterialSymbol() { + super(Document.get().createElement("div")); + setType(SymbolType.OUTLINED); + } + + @Override + protected void onLoad() { + super.onLoad(); + + load(); + add(span); + } + + @Override + public void setSymbol(String symbol) { + span.setText(symbol); + } + + @Override + public void setColor(Color color) { + getSymbolColorsMixin().setTextColor(color); + } + + @Override + public void setSymbolSize(String size) { + span.getElement().getStyle().setProperty("fontSize", size); + } + + @Override + public void setType(SymbolType type) { + getSymbolTypeMixin().setCssName(type); + linkElement.setHref(type.getCssLink()); + } + + @Override + public void setFilled(boolean filled) { + this.filled = filled; + } + + @Override + public void setWeight(int weight) { + this.weight = weight; + } + + @Override + public void setGrade(int grade) { + this.grade = grade; + } + + @Override + public void setOpticalSize(int size) { + this.opticalSize = size; + } + + protected void load() { + span.getElement().getStyle().setProperty("fontVariationSettings", "'FILL' " + (filled ? 1 : 0) + ", 'wght' " + weight + ", 'GRAD' " + grade + ", 'opsz' " + opticalSize); + } + + public ColorsMixin getSymbolColorsMixin() { + if (symbolColorsMixin == null) { + symbolColorsMixin = new ColorsMixin<>(this); + } + return symbolColorsMixin; + } + + public CssNameMixin getSymbolTypeMixin() { + if (symbolTypeMixin == null) { + symbolTypeMixin = new CssNameMixin<>(span); + } + return symbolTypeMixin; + } +} diff --git a/pom.xml b/pom.xml index d8f769000..3b83a2c85 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.gwtmaterialdesign gwt-material-parent - 2.7.1 + 2.8.0 pom gwt-material @@ -75,7 +75,7 @@ scm:git:git@github.com:GwtMaterialDesign/gwt-material.git scm:git:git@github.com:GwtMaterialDesign/gwt-material.git http://github.com/GwtMaterialDesign/gwt-material - v2.7.1 + v2.8.0