Skip to content

Commit

Permalink
Merge pull request #1039 from GwtMaterialDesign/release_2.8.0
Browse files Browse the repository at this point in the history
Release 2.8.0
  • Loading branch information
kevzlou7979 authored Jul 27, 2023
2 parents cc738db + 737a3f9 commit 1f812f9
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
2 changes: 1 addition & 1 deletion .utility/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.7.1" ]; then
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.8.0" ]; then
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy -DskipTests --settings ~/settings.xml
fi
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ Support documentation can be found [here](https://github.com/GwtMaterialDesign/g
We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs" > Java Docs </a> for developers

## Maven
### Current Version 2.7.1
### Current Version 2.8.0
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>2.7.1</version>
<version>2.8.0</version>
</dependency>
```
### Snapshot Version 2.8.0-SNAPSHOT
Expand Down
2 changes: 1 addition & 1 deletion gwt-material/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.7.1</version>
<version>2.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
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)),
TABLET(new WidthBoundary(426, 768)),
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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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<Span, SymbolType> symbolTypeMixin;
protected ColorsMixin<MaterialSymbol> 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<MaterialSymbol> getSymbolColorsMixin() {
if (symbolColorsMixin == null) {
symbolColorsMixin = new ColorsMixin<>(this);
}
return symbolColorsMixin;
}

public CssNameMixin<Span, SymbolType> getSymbolTypeMixin() {
if (symbolTypeMixin == null) {
symbolTypeMixin = new CssNameMixin<>(span);
}
return symbolTypeMixin;
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-parent</artifactId>
<version>2.7.1</version>
<version>2.8.0</version>
<packaging>pom</packaging>
<modules>
<module>gwt-material</module>
Expand Down Expand Up @@ -75,7 +75,7 @@
<connection>scm:git:git@github.com:GwtMaterialDesign/gwt-material.git</connection>
<developerConnection>scm:git:git@github.com:GwtMaterialDesign/gwt-material.git</developerConnection>
<url>http://github.com/GwtMaterialDesign/gwt-material</url>
<tag>v2.7.1</tag>
<tag>v2.8.0</tag>
</scm>

<licenses>
Expand Down

0 comments on commit 1f812f9

Please sign in to comment.