Skip to content

Commit

Permalink
Merge pull request #732 from GwtMaterialDesign/release_2.1
Browse files Browse the repository at this point in the history
Release 2.1
  • Loading branch information
kevzlou7979 committed Jul 22, 2018
2 parents 5973481 + b23158b commit 48103e0
Show file tree
Hide file tree
Showing 149 changed files with 15,491 additions and 750 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -7,14 +7,14 @@ cache:
- $HOME/.m2
before_install:
# install the gwt-material-jquery because it will depends on built in jquery
- git clone -b release_2.0.1 https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- git clone -b master https://github.com/GwtMaterialDesign/gwt-material-jquery.git
- cd gwt-material-jquery
- mvn install -DskipTests=true -DdryRun=true
- cd ..
install: true
before_script:
- chmod +x .utility/*
script:
- mvn clean install -DdryRun=true
- mvn clean install -DdryRun=true -DskipTests=true
after_success:
- .utility/deploy.sh
2 changes: 1 addition & 1 deletion .utility/deploy.sh
@@ -1,6 +1,6 @@
#!/bin/bash
set -ev
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.0.1" ]; then
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; 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 --settings ~/settings.xml
fi
17 changes: 11 additions & 6 deletions README.md
Expand Up @@ -6,30 +6,34 @@

<br/>

## Migration 2.0 -> 2.1
- [Mojo to TBroyer](https://github.com/GwtMaterialDesign/gwt-material/wiki/Migrating-from-Mojo-GWT-Maven-Plugin-to-TBroyer)
- [PWA Support](https://github.com/GwtMaterialDesign/gwt-material/wiki/PWA-:-Service-Worker-Automation)

## Demo
* [2.0.1 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/)
* [2.1 Snapshot Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/snapshot/)
* [2.1 Release Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/)
* [2.2 Snapshot Demo](http://gwtmaterialdesign.github.io/gwt-material-demo/snapshot/)

## Documentation
Support documentation can be found [here](https://github.com/GwtMaterialDesign/gwt-material/wiki) <br/>
We created <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/apidocs" > Java Docs </a> for developers


## Maven
### Current Version 2.0.1
### Current Version 2.1
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>2.0.1</version>
<version>2.1</version>
</dependency>
```
### Snapshot Version 2.1-SNAPSHOT
### Snapshot Version 2.2-SNAPSHOT
```xml
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</dependency>
```

Expand Down Expand Up @@ -57,6 +61,7 @@ Please follow the [contribution document](https://github.com/GwtMaterialDesign/g
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-themes" >Themes</a></li>
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-jquery" >JQuery</a></li>
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-table" >Table</a></li>
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-amcharts" >AmCharts</a></li>
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-demo" >Demo</a></li>
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-demo-errai" >Errai Demo</a></li>
<li><a href="https://github.com/GwtMaterialDesign/gwt-material-template" >Starter</a></li>
Expand Down
42 changes: 34 additions & 8 deletions gwt-material/pom.xml
Expand Up @@ -4,11 +4,12 @@
<parent>
<artifactId>gwt-material-parent</artifactId>
<groupId>com.github.gwtmaterialdesign</groupId>
<version>2.0.1</version>
<version>2.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>gwt-material</artifactId>
<packaging>gwt-lib</packaging>

<name>Gwt Material</name>
<description>A Material Design look and feel for GWT Applications</description>
Expand All @@ -17,19 +18,17 @@
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-jquery</artifactId>
<version>2.0.1</version>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -56,7 +55,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<version>${surefire.version}</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.sourceDirectory}</additionalClasspathElement>
Expand All @@ -66,15 +65,42 @@
<forkMode>always</forkMode>
<argLine>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<version>${tbroyer.version}</version>
<extensions>true</extensions>
<configuration>
<moduleName>gwt.material.design.GwtMaterialWithJQuery</moduleName>
<style>OBFUSCATED</style>
<logLevel>INFO</logLevel>
<sourceLevel>1.8</sourceLevel>
<jvmArgs>
<jvmArg>-Xmx1g</jvmArg>
<jvmArg>-Xms1g</jvmArg>
<jvmArg>-XX:CompileThreshold=7000</jvmArg>
</jvmArgs>
<optimize>9</optimize>
<compilerArgs>
<compilerArg>-compileReport</compilerArg>
<compilerArg>-XcompilerMetrics</compilerArg>
</compilerArgs>
<classpathScope>compile+runtime</classpathScope>
<failOnError>true</failOnError>
<skipModule>true</skipModule>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
Expand Down
Expand Up @@ -51,6 +51,7 @@ protected void load() {
if(!isMaterializeLoaded()) {
injectJs(MaterialResources.INSTANCE.materializeJs());
injectJs(MaterialResources.INSTANCE.animationJs());
injectJs(MaterialResources.INSTANCE.appInstallerJs());
}
onModuleLoaded();
}
Expand Down
Expand Up @@ -30,6 +30,7 @@ public void load() {
if(!isMaterializeLoaded()) {
injectDebugJs(MaterialDebugResources.INSTANCE.materializeJsDebug());
injectDebugJs(MaterialDebugResources.INSTANCE.animationJsDebug());
injectDebugJs(MaterialDebugResources.INSTANCE.appInstallerJsDebug());
}
onModuleLoaded();
}
Expand Down
@@ -0,0 +1,46 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2018 GwtMaterialDesign
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package gwt.material.design.client.api;

import com.google.gwt.core.client.Callback;
import gwt.material.design.client.api.google.maps.GoogleApi;

/**
* A Base feature that can be extended to build your own custom API Component.
* See {@link ApiRegistry#register(ApiFeature, Callback)}
* @author kevzlou7979
*/
public interface ApiFeature {

/**
* Will construct the given url. See {@link GoogleApi#constructApiUrl()} for the usage.
*/
String constructApiUrl();

/**
* A Feature Api Key {i.e Google API Key}
*/
String getApiKey();

/**
* A Feature Api Url provided to load any external js framework {i.e Google Maps Js resources}
*/
String getApiUrl();
}
@@ -0,0 +1,94 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2018 GwtMaterialDesign
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package gwt.material.design.client.api;

import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.dom.client.Element;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
* A class to register a {@link ApiFeature} that contains apiKey and apiUrl to load your custom API the provided a callback
* upon injecting the resource api url as a script element into the DOM. You can also unload the api resources by calling
* {@link ApiRegistry#unregister(ApiFeature)}.
*
* @author kevzlou7979
*/
public class ApiRegistry {

protected static Map<ApiFeature, JavaScriptObject> features = new LinkedHashMap<>();

/**
* Will register the {@link ApiFeature} to the list of features providing also the Javascript Script element object
* for later removal / update.
*/
public static void register(ApiFeature apiFeature, Callback<Void, Exception> callback) {
if (apiFeature != null && apiFeature.getApiKey() != null && !apiFeature.getApiKey().isEmpty()) {
JavaScriptObject scriptObject = ScriptInjector.fromUrl(apiFeature.constructApiUrl())
.setWindow(ScriptInjector.TOP_WINDOW)
.setCallback(new Callback<Void, Exception>() {
@Override
public void onFailure(Exception e) {
callback.onFailure(e);
}

@Override
public void onSuccess(Void aVoid) {
callback.onSuccess(aVoid);
}
}).inject();
features.put(apiFeature, scriptObject);
}
}

/**
* Will unregister the provided {@link ApiFeature} in to map of features.
*/
public static void unregister(ApiFeature apiFeature) {
JavaScriptObject scriptObject = features.get(apiFeature);
if (scriptObject != null) {
if (scriptObject.cast() instanceof Element) {
Element scriptElement = scriptObject.cast();
scriptElement.removeFromParent();
}
}
features.remove(apiFeature);
}

/**
* Will unregister all {@link ApiFeature}
*/
public static void unregisterAllFeature() {
for (ApiFeature apiFeature : features.keySet()) {
unregister(apiFeature);
}
}

/**
* Get all {@link ApiFeature} lists
*/
public static Set<ApiFeature> getAllFeatures() {
return features.keySet();
}
}
@@ -0,0 +1,46 @@
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2018 GwtMaterialDesign
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package gwt.material.design.client.api.google.maps;

import gwt.material.design.client.api.ApiFeature;

/**
* An abstract implementation for loading any {@link GoogleApi}.
*
* @author kevzlou7979
*/
public abstract class GoogleApi implements ApiFeature {

protected final String apiKey;

public GoogleApi(String apiKey) {
this.apiKey = apiKey;
}

@Override
public String constructApiUrl() {
return getApiUrl() + "?key=" + getApiKey();
}

@Override
public String getApiKey() {
return apiKey;
}
}

0 comments on commit 48103e0

Please sign in to comment.