markathomas / locationtextfield Goto Github PK
View Code? Open in Web Editor NEWVaadin text field that geocodes a specified addess
Home Page: https://vaadin.com/directory#addon/locationtextfield
License: Apache License 2.0
Vaadin text field that geocodes a specified addess
Home Page: https://vaadin.com/directory#addon/locationtextfield
License: Apache License 2.0
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.
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.
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.
in Vaadin 8, the location completion stop working; actually when input an address, it is in an idle state.
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.
`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());
}`
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)
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);
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.