Package com.idojaras.core.model

Examples of com.idojaras.core.model.WeatherData


    }

    private void processTimeElement(Attributes pAttributes) {
      timeElementCounter++;
      if (timeElementCounter == 1) {
        weatherData = new WeatherData();
        weatherData.setSunRise(sunRise);
        weatherData.setSunSet(sunSet);
        weatherData.setCountry(countryCode);
      } else {
        weatherData.getForecast().add(new WeatherData());
      }
      WeatherData reference = getReference();
      String day = pAttributes.getValue(XML_ATTR_DAY);
      if (null != day) {
        try {
          Date d = new SimpleDateFormat(DAY_PATTERN).parse(day);
          Calendar cal = Calendar.getInstance();
          cal.setTime(d);
          reference.setDate(cal);
        } catch (ParseException e) {
          log.error(e, e);
        }
      }
View Full Code Here


    }

    private void processSymbolElement(Attributes pAttributes) {
      String id = pAttributes.getValue(XML_ATTR_NUMBER);
      String var = pAttributes.getValue(XML_ATTR_VAR);
      WeatherData reference = getReference();
      reference.setId(id);
      reference.setIcon(Tools.getImageIconById(var));
    }
View Full Code Here

      reference.setIcon(Tools.getImageIconById(var));
    }

    private void processWindDirectionElement(Attributes pAttributes) {
      String code = pAttributes.getValue(XML_ATTR_CODE);
      WeatherData reference = getReference();
      reference.setWindDirection(code);
    }
View Full Code Here

      reference.setWindDirection(code);
    }

    private void processWindSpeedElement(Attributes pAttributes) {
      String mps = pAttributes.getValue(XML_ATTR_MPS);
      WeatherData reference = getReference();
      try {
        reference.setWindSpeed(Double.valueOf(mps));
      } catch (Exception ex) {
        log.error(ex, ex);
      }
    }
View Full Code Here

      String min = pAttributes.getValue(XML_ATTR_MIN);
      String max = pAttributes.getValue(XML_ATTR_MAX);
      String night = pAttributes.getValue(XML_ATTR_NIGHT);
      String eve = pAttributes.getValue(XML_ATTR_EVE);
      String morn = pAttributes.getValue(XML_ATTR_MORN);
      WeatherData reference = getReference();
      try {
        reference.setTempDay(Double.valueOf(day));
      } catch (Exception ex) {
        reference.setTempDay(Double.NaN);
        log.error(ex, ex);
      }
      try {
        reference.setTempMin(Double.valueOf(min));
      } catch (Exception ex) {
        reference.setTempMin(Double.NaN);
        log.error(ex, ex);
      }
      try {
        reference.setTempMax(Double.valueOf(max));
      } catch (Exception ex) {
        reference.setTempMax(Double.NaN);
        log.error(ex, ex);
      }
      try {
        reference.setTempNight(Double.valueOf(night));
      } catch (Exception ex) {
        reference.setTempNight(Double.NaN);
        log.error(ex, ex);
      }
      try {
        reference.setTempEvening(Double.valueOf(eve));
      } catch (Exception ex) {
        reference.setTempEvening(Double.NaN);
        log.error(ex, ex);
      }
      try {
        reference.setTempMorning(Double.valueOf(morn));
      } catch (Exception ex) {
        reference.setTempMorning(Double.NaN);
        log.error(ex, ex);
      }
    }
View Full Code Here

    }

    private void processPressureElement(Attributes pAttributes) {
      String unit = pAttributes.getValue(XML_ATTR_UNIT);
      String value = pAttributes.getValue(XML_ATTR_VALUE);
      WeatherData reference = getReference();
      reference.setPressureUnit(unit);
      try {
        reference.setPressure(Double.valueOf(value));
      } catch (Exception ex) {
        reference.setPressure(Double.NaN);
        log.error(ex, ex);
      }
    }
View Full Code Here

    }

    private void processHumidityElement(Attributes pAttributes) {
      String unit = pAttributes.getValue(XML_ATTR_UNIT);
      String value = pAttributes.getValue(XML_ATTR_VALUE);
      WeatherData reference = getReference();
      reference.setHumidityUnit(unit);
      try {
        reference.setHumidity(Double.valueOf(value));
      } catch (Exception ex) {
        reference.setHumidity(Double.NaN);
        log.error(ex, ex);
      }

    }
View Full Code Here

    }

    private void processCloudsElement(Attributes pAttributes) {
      String value = pAttributes.getValue(XML_ATTR_VALUE);
      WeatherData reference = getReference();
      reference.setClouds(value);
    }
View Full Code Here

          measure = "metric";
        } else {
          measure = "imperial";
        }

        WeatherData retval = null;

        try {
          retval = new WeatherParser().parseData(Tools
              .getResponseXml(Tools.createWeatherQueryUrl(
                  pCitySearch.getCityId(), measure)));
View Full Code Here

      contentPanel.removeAll();
      contentPanel.add(errorPanel);
      return;
    }
    if (pEventObject instanceof WeatherData) {
      WeatherData wd = (WeatherData) pEventObject;
      drawWeatherPanel(wd);
    } else {
      log.warn("Invalid type of object received from controller!");
      contentPanel.removeAll();
      contentPanel.add(errorPanel);
View Full Code Here

TOP

Related Classes of com.idojaras.core.model.WeatherData

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.