Package com.codename1.ui.events

Examples of com.codename1.ui.events.ActionListener


                PointLayer p = (PointLayer) evt.getSource();
                System.out.println("pressed " + p);
                String name = p.getName();
                final Dialog d = new Dialog(name);
                d.setLayout(new BorderLayout());
                WebBrowser wb = new WebBrowser();
                wb.setPage(getDescription(name), "http://localhost");
                d.addComponent(BorderLayout.CENTER, wb);
                d.setDisposeWhenPointerOutOfBounds(true);
                Command backCommand = new Command("Back") {
          public void actionPerformed(ActionEvent evt) {
            d.dispose();
View Full Code Here


                PointLayer p = (PointLayer) evt.getSource();
                System.out.println("pressed " + p);
                String name = p.getName();
                final Dialog d = new Dialog(name);
                d.setLayout(new BorderLayout());
                WebBrowser wb = new WebBrowser();
                wb.setPage(getDescription(name), "http://localhost");
                d.addComponent(BorderLayout.CENTER, wb);
                d.setDisposeWhenPointerOutOfBounds(true);
                Command backCommand = new Command("Back") {
          public void actionPerformed(ActionEvent evt) {
            d.dispose();
View Full Code Here

   * <pre>
   * See http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types.
   * </pre>
   */
  private void load() {
    ConnectionRequest req = new ConnectionRequest() {
      protected void readResponse(InputStream input) throws IOException {
        read(input);
      }
    };
    req.setPost(false);
    req.setUrl(URL);
    NetworkManager.getInstance().addToQueueAndWait(req);
  }
View Full Code Here

  public void setLocation(LookupLocation location) {
    this.location = location;
  }

    protected void readResponse(InputStream input) throws IOException {
      JSONParser parser = new JSONParser();
      Hashtable h = parser.parse(new InputStreamReader(input));
      if (h.containsKey(RESPONSE_KEY_AD)) {
        fireResponseListener(new ActionEvent(h.get(RESPONSE_KEY_AD)));
      }
    }
View Full Code Here

          + ARG_IPADDRESS + '=' + ipAddress);
      setPost(false);
    }

    protected void readResponse(InputStream input) throws IOException {
      JSONParser parser = new JSONParser();
      Hashtable response = parser.parse(new InputStreamReader(input));
      LookupLocation loc = new LookupLocation();
      loc.setLookupStatus((String) response.get("statusCode"));
      if (loc.getStatus() == LocationManager.AVAILABLE) {
        loc.setLookupStatusMessage((String) response.get("statusMessage"));
      } else {
View Full Code Here

  private String sessionId;

  public void initService(Ads adsComponent) {
    if (getLocation() == null) {
      LocationManager lm = LocationManager.getLocationManager();
      Location loc;
      if (lm.getStatus() == LocationManager.AVAILABLE) {
        try {
          loc = lm.getCurrentLocation();
        } catch (IOException e) {
          Log.e(e);
          loc = lm.getLastKnownLocation();
        }
      } else {
        loc = lm.getLastKnownLocation();
      }

      // Use location if provided, otherwise use either reverse IP or
      // Geocode depending on availability of sensor.
      if (adsComponent.getLocation() != null) {
        LookupLocation lloc = new LookupLocation();
        parseLocation(lloc, loc, adsComponent.getLocation());
        setLocation(lloc);
      } else {
        if (loc == null) {
          LocationLookupService lookup = LocationLookupService.createLookupByIP();
          LookupLocation lloc = lookup.getLocation(new IPAddress(null));
          if (lloc.getLookupStatus() == LookupLocation.STATUS_OK) {
            setLocation(lloc);
          }
        } else {
          LocationLookupService lookup = LocationLookupService.createLookupByGeocode();
          LookupLocation lloc = lookup.getLocation(new Coordinate(loc));
          if (lloc.getLookupStatus() != LookupLocation.STATUS_OK) {
            lloc.setLatitude(loc.getLatitude());
            lloc.setLongtitude(loc.getLongtitude());
          }
        }
      }
    }
    setPost(false);
View Full Code Here

   */
  private String sessionId;

  public void initService(Ads adsComponent) {
    if (getLocation() == null) {
      LocationManager lm = LocationManager.getLocationManager();
      Location loc;
      if (lm.getStatus() == LocationManager.AVAILABLE) {
        try {
          loc = lm.getCurrentLocation();
        } catch (IOException e) {
          Log.e(e);
          loc = lm.getLastKnownLocation();
        }
      } else {
        loc = lm.getLastKnownLocation();
      }

      // Use location if provided, otherwise use either reverse IP or
      // Geocode depending on availability of sensor.
      if (adsComponent.getLocation() != null) {
View Full Code Here

    }
    try {
      // kml uses lng,lat where most use lat,lng
      double lat = Double.parseDouble(coords[1]);
      double lng = Double.parseDouble(coords[0]);
      return new Coord(lat, lng);
    } catch (NumberFormatException nfe) {
      return null;
    }
  }
View Full Code Here

    descriptions = new Hashtable();
    Vector v = kml.getAsArray("//Placemark");
    for (int i = 0; i < v.size(); i++) {
      Result marker = Result.fromContent(((Element) v.elementAt(i)).getChildAt(0));
      System.out.println("Name:" + marker.getAsString("name"));
      Coord coords = getMarkerCoordinates(marker);
      if (coords != null) {
        String name = marker.getAsString("name");
        String desc = marker.getAsString("description");
        if (desc != null) {
          descriptions.put(name, desc);
View Full Code Here

  public Coordinate(Coord coord) {
    this.coord = coord;
  }

  public Coordinate(double latitude, double longitude) {
    this.coord = new Coord(latitude, longitude);
  }
View Full Code Here

TOP

Related Classes of com.codename1.ui.events.ActionListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.