Skip to content

Commit

Permalink
fix LayerGroup eachLayer function and bump to 1.1.1 version
Browse files Browse the repository at this point in the history
  • Loading branch information
zak905 committed Nov 7, 2021
1 parent 9b895a5 commit 5ef6c6e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
51 changes: 50 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gwidgets</groupId>
<artifactId>gwty-leaflet</artifactId>
<version>1.1</version>
<version>1.1.1</version>
<packaging>gwt-lib</packaging>

<properties>
Expand Down Expand Up @@ -93,6 +93,55 @@
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- add here user name and passoword -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<failOnError>false</failOnError>
<failOnWarnings>false</failOnWarnings>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<name>gwty-leaflet</name>
Expand Down
23 changes: 12 additions & 11 deletions src/main/java/com/gwidgets/api/leaflet/LayerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.gwidgets.api.leaflet.options.PopupOptions;
import com.gwidgets.api.leaflet.options.TooltipOptions;

import elemental2.core.Function;
import elemental2.core.JsObject;
import elemental2.dom.HTMLElement;
/**
Expand All @@ -21,7 +20,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;


Expand All @@ -33,6 +34,12 @@
public class LayerGroup implements Layer, Evented {


/**
* Function that will be called on each created feature layer. Useful for attaching events and popups to features.
*/
@JsProperty
public EachLayerFunction eachLayer;

/**
* Adds a given layer to the group.
*
Expand Down Expand Up @@ -94,16 +101,6 @@ public class LayerGroup implements Layer, Evented {
@JsMethod
public native L clearLayers();

/**
* Iterates over the layers of the group, optionally specifying context of the iterator function.
*
* @param fn the action function
* @param context the context
* @return the l
*/
@JsMethod
public native L eachLayer(Function fn, JsObject context);

/**
* Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection).
*
Expand Down Expand Up @@ -370,4 +367,8 @@ public class LayerGroup implements Layer, Evented {
*/
public native L removeEventParent(Evented obj);

@JsFunction
public interface EachLayerFunction {
void apply(Layer feature, JsObject context);
}
}

0 comments on commit 5ef6c6e

Please sign in to comment.