Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #732 from GwtMaterialDesign/release_2.1
Release 2.1
- Loading branch information
Showing
149 changed files
with
15,491 additions
and
750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
gwt-material/src/main/java/gwt/material/design/client/api/ApiFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
94 changes: 94 additions & 0 deletions
94
gwt-material/src/main/java/gwt/material/design/client/api/ApiRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
gwt-material/src/main/java/gwt/material/design/client/api/google/maps/GoogleApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
Oops, something went wrong.