Java Code Examples for netscape.javascript.JSObject#toString()
The following examples show how to use
netscape.javascript.JSObject#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeocoderUtils.java From GMapsFX with Apache License 2.0 | 6 votes |
public static <T extends Enum> List<T> convertJSObjectToListOfEnum(JSObject jsObject, Class<T> enumClass) { List<T> result = new ArrayList<>(); if (jsObject != null) { try { String jsTypesString = jsObject.toString(); for (T value : enumClass.getEnumConstants()) { if (jsTypesString.toLowerCase().contains(value.name().toLowerCase())) { result.add(value); } } } catch (Exception e) { Logger.getLogger(GeocoderUtils.class.getName()).log(Level.SEVERE, "", e); } } return result; }
Example 2
Source File: GeocoderAddressComponent.java From GMapsFX with Apache License 2.0 | 6 votes |
/** * @return the postcodeLocalities */ public List<String> getPostcodeLocalities() { final List<String> result = new ArrayList<>(); try { if (!(jsObject.getMember("postcode_localities") instanceof String)) { List<JSObject> jsLocalities = GeocoderUtils.getJSObjectsFromArray((JSObject) jsObject.getMember("postcode_localities")); for (JSObject jsLocality : jsLocalities) { String text = jsLocality.toString(); if (text != null && !text.isEmpty() && !text.equals("undefined")) { result.add(text); } } } } catch (Exception e) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "", e); } return result; }
Example 3
Source File: DirectionsSteps.java From GMapsFX with Apache License 2.0 | 5 votes |
public String getInstructions(){ try { JSObject location = (JSObject) getJSObject().getMember("instructions"); return location.toString(); } catch (Exception e) { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "", e); } return null; }
Example 4
Source File: DirectionsSteps.java From GMapsFX with Apache License 2.0 | 5 votes |
public TravelModes getTravelMode(){ try { JSObject location = (JSObject) getJSObject().getMember("travel_mode"); switch(location.toString()){ case "DRIVING" : return TravelModes.DRIVING; case "BICYCLING": return TravelModes.BICYCLING; case "TRANSIT": return TravelModes.TRANSIT; case "WALKING": return TravelModes.WALKING; } } catch (Exception e) { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "", e); } return null; }
Example 5
Source File: DirectionsLeg.java From GMapsFX with Apache License 2.0 | 5 votes |
public String getStartAddress(){ try { JSObject location = (JSObject) getJSObject().getMember("start_address"); return location.toString(); } catch (Exception e) { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "", e); } return null; }
Example 6
Source File: DirectionsLeg.java From GMapsFX with Apache License 2.0 | 5 votes |
public String getEndAddress(){ try { JSObject location = (JSObject) getJSObject().getMember("end_address"); return location.toString(); } catch (Exception e) { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "", e); } return null; }
Example 7
Source File: GeocodingResult.java From GMapsFX with Apache License 2.0 | 5 votes |
public List<String> getPostcodeLocalities() { final List<String> result = new ArrayList<>(); List<JSObject> jsLocalities = GeocoderUtils.getJSObjectsFromArray((JSObject) jsObject.getMember("postcode_localities")); for (JSObject jsLocality : jsLocalities) { String text = jsLocality.toString(); if (text != null && !text.isEmpty() && !text.equals("undefined")) { result.add(text); } } return result; }