FlowingCode / GoogleMapsAddon

Vaadin Addon based on Google Maps Web Component
https://www.flowingcode.com/en/open-source/
Apache License 2.0
20 stars 7 forks source link

Demo: refactor GoogleMapsDemo class #42

Closed paodb closed 3 years ago

paodb commented 3 years ago

GoogleMapsDemo class contains a lot of examples/code on how to use most of the add-ons features. File have become hard to follow so it would be better if each feature could have it's own demo on it's very own tab.

paodb commented 3 years ago

My idea for improving this demo is:

@StyleSheet("context://frontend/styles/google-maps/demo-styles.css")
public abstract class AbstractGoogleMapsDemo extends VerticalLayout {

  public AbstractGoogleMapsDemo() {    
    this.setSizeFull();
    String apiKey = System.getProperty("google.maps.api");
    if (apiKey == null) {
      add(
          new H2(
              "Api key is needded to run the demo, pass it using the following system property: '-Dgoogle.maps.api=<your-api-key>'"));
    } else {
      createGoogleMapsDemo(apiKey);
    }    
  }

  protected abstract void createGoogleMapsDemo(String apiKey);

}

What do you think @javier-godoy, @mlopezFC ?

javier-godoy commented 3 years ago

I agree, It would be also a good time for using the annotation-based configuration feature of commons demo (https://github.com/FlowingCode/CommonsDemo/commit/d5ec76be3b737b44b75be47f7c7254d904c08884) which is available ein 3.1.0-SNAPSHOT