Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.eksad.ddms.gigr.h3.web.viewmodel.checkarea;
- import com.eksad.ddms.Gmarkers;
- import com.eksad.ddms.gigr.h3.dto.AhassDTO;
- import com.eksad.ddms.gigr.h3.dto.StockDTO;
- import com.eksad.ddms.gigr.h3.dto.checkarea.CheckAreaDTO;
- import com.eksad.ddms.gigr.h3.web.service.checkarea.CheckAreaService;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import org.zkoss.bind.annotation.AfterCompose;
- import org.zkoss.bind.annotation.Command;
- import org.zkoss.bind.annotation.Init;
- import org.zkoss.bind.annotation.NotifyChange;
- import org.zkoss.gmaps.Gmaps;
- import org.zkoss.gmaps.Gmarker;
- import org.zkoss.gmaps.Mapitem;
- import org.zkoss.xel.VariableResolver;
- import org.zkoss.zk.ui.Component;
- import org.zkoss.zk.ui.select.annotation.Wire;
- import org.zkoss.zk.ui.util.Composer;
- import org.zkoss.zk.ui.util.Template;
- /**
- *
- * @author eksad
- */
- public class CheckAvailabilityOnAreaVM {
- @Wire
- Gmaps gmaps;
- private Double lat;
- private Double lng;
- List<CheckAreaDTO> areaList=new ArrayList<>();
- CheckAreaService serv;
- @Init
- public void init() {
- gmaps=new Gmaps();
- gmaps.enableBindingAnnotation();
- serv=new CheckAreaService();
- lat=-6.206040;
- lng=106.818771;
- areaList= serv.findNearBy(lat, lng);
- for(CheckAreaDTO area : areaList){
- if(area.getLatitude()!=null && area.getLongitute()!=null){
- Gmarker marker=new Gmarker();
- marker.setLat(area.getLatitude());
- marker.setLng(area.getLongitute());
- marker.setOpen(true);
- marker.setParent(gmaps);
- }
- }
- gmaps.focus();
- }
- @AfterCompose
- @NotifyChange("areaList")
- public void aftercomp(){
- CheckAreaService serv=new CheckAreaService();
- areaList= serv.findNearBy(lat, lng);
- lat=-6.206040;
- lng=106.818771;
- areaList= serv.findNearBy(lat, lng);
- for(CheckAreaDTO area : areaList){
- if(area.getLatitude()!=null && area.getLongitute()!=null){
- Gmarker marker=new Gmarker();
- marker.setLat(area.getLatitude());
- marker.setLng(area.getLongitute());
- marker.setOpen(true);
- marker.setParent(gmaps);
- }
- }
- }
- public Double getLat() {
- return lat;
- }
- public void setLat(Double lat) {
- this.lat = lat;
- }
- public Double getLng() {
- return lng;
- }
- public void setLng(Double lng) {
- this.lng = lng;
- }
- public Gmaps getGmaps() {
- return gmaps;
- }
- public void setGmaps(Gmaps gmaps) {
- this.gmaps = gmaps;
- }
- public List<CheckAreaDTO> getAreaList() {
- return areaList;
- }
- public void setAreaList(List<CheckAreaDTO> areaList) {
- this.areaList = areaList;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement