GithubHelp home page GithubHelp logo

markathomas / locationtextfield Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 6.0 272 KB

Vaadin text field that geocodes a specified addess

Home Page: https://vaadin.com/directory#addon/locationtextfield

License: Apache License 2.0

Java 95.99% CSS 4.01%

locationtextfield's People

Contributors

markathomas avatar yamperboy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

locationtextfield's Issues

.getText() and null values

Hi,
It seems the .getText() will not return the displayed text in the widget if that has a length less than the MinimumQueryCharacters. In that case it will return the previous value which is not nice.
That presents a problem since I can’t know if the user has updated the LocationTextField with a null value.
Thanks for the effort.

Problem with css

HI!
Thank-you for you work.

But we have a problem with the styles: the LocationTextFieldWidgetset imports the Standard themes from GWT, to use its styles in the popup.

But this breaks the whole theme of our application: we use Valo, and including the LocationTextFieldWidgetset the Lato font got replaced with Arial (provided by Standard).
We had to replace the LocationTextFieldWidgetset with another version that does not use Standard.

Widgetset does not contain implementation

When using this addon I get this message:

"Widgetset does not contain implementation for org.vaadin.addons.locationtextfield.LocationTextField. Check its @ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions. Unrendered UIDL:
-Unrendered UIDL
-org.vaadin.addons.locationtextfield.LocationTextField(NO CLIENT IMPLEMENTATION FOUND) id=PID2 width=100.0% immediate=true caption=Address: pagelength=10 filteringmode=0 totalitems=0 textChanged=true iem=LAZY iet=1000 eke=true
-variables
selected=
filter=
page=0
ltfFilter=
-options"

I'm using a ton of other addons, and they are all working correctly.

I'm using Eclipse, if this can be useful.

On a side note, I've also had to manually add the json/slf4j jars to my widgetset, as I could not make the addon work as a standalone.

as icon set to be inside; the icon is not correctly displayed

The following is a screen dump; you can see the search icon of location input text field was moved to the left bottom corner now.

image

`final private LocationTextField ltf = new LocationTextField<>(GoogleGeocoder.getInstance());
final private Button find = new Button("Find");
final private CssLayout findByLocation = new CssLayout(ltf, find);

final private GoogleMap googleMap = new GoogleMap(apiKey, null, null);
final private Panel mapPanel = new Panel(googleMap);

@Autowired
private YardService yardService;

public FindView() {
super.setSizeFull();
super.setMargin(true);
super.setSpacing(true);
super.addComponents(findByLocation, mapPanel);

mapPanel.setSizeFull();
setLtf();
setMap();

}

private void setLtf() {
//ltf.setCaption("Find a shared Yard closing to you");
ltf.setWidth("400px");
ltf.setInputPrompt("Insert an location: ");
ltf.setStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
ltf.setIcon(VaadinIcons.SEARCH);

ltf.addLocationValueChangeListener((HasValue.ValueChangeEvent<GeocodedLocation> e) -> {
    googleMap.clearMarkers();
    LatLon ll = new LatLon(e.getValue().getLat(), e.getValue().getLon());
    setMapCenter(ll);
    setMapMarker(ll);
});

ltf.setDelay(800);

ltf.setLocation(new GeocodedLocation());

}`

No longer working!

Hi,
I keep getting the following error. I have not altered the code from this demo. Any help appreciated.

ERROR org.vaadin.addons.locationtextfield.AbstractGeocoderController - Error geocoding query: New York City, NY
org.vaadin.addons.locationtextfield.GeocodingException: A JSONArray text must start with '[' at character 1
at org.vaadin.addons.locationtextfield.URLConnectionGeocoder.geocode(URLConnectionGeocoder.java:64)
at org.vaadin.addons.locationtextfield.AbstractGeocoderController.geocode(AbstractGeocoderController.java:55)
at org.vaadin.addons.locationtextfield.LocationTextField.setText(LocationTextField.java:276)
at org.vaadin.addons.locationtextfield.LocationTextField.geocode(LocationTextField.java:257)
at org.vaadin.addons.ltf.demo.DemoUI$2.buttonClick(DemoUI.java:90)

Compatibility with Java 1.8

I cannot reproduce the issue today but I am leaving this here in case anyone else runs into it.

When I first tried displaying the LocationTextField component I was getting a ClassNotFoundException for com.sun.org.apache.bcel.internal.util.Objects.java. The only thing I found about this class was in the 7u40-b43 JDK. I am running:

$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

I found the source code and created the file in my projects (DISGUSTING HACKS AT 3AM!) to get everything to work. If I delete the class now, everything still works. Not sure what was happening.

/*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.  Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package com.sun.org.apache.bcel.internal.util;

public final class Objects {
    private Objects() {
        throw new IllegalAccessError();
    }

    public static int hashCode(final Object o) {
        return o == null ? 0 : o.hashCode();
    }

    public static boolean equals(Object one, Object two) {
        return one == two || one != null && one.equals(two);
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.