MapView.java 1.55 KB
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fi.insomnia.bortal.view;

import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.Place;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

/**
 *
 * @author tuukka
 */
@ManagedBean(name = "mapView")
@SessionScoped
public class MapView {

    private EventMap activeMap;

    /** Creates a new instance of MapView */
    public MapView() {
    }

    public void placeSelectActionListener(ActionEvent e) {
        FacesContext context = FacesContext.getCurrentInstance();
        String clientId = e.getComponent().getClientId(context);
        Map requestParams = context.getExternalContext().getRequestParameterMap();
        int x = new Integer((String) requestParams.get(clientId + ".x")).intValue();
        int y = new Integer((String) requestParams.get(clientId + ".y")).intValue();

        Place place = getActiveMap().findPlace(x, y);
        throw new UnsupportedOperationException("We got place, but are doing nothing with it");
    }


    public String getSelectPlaceMapUrl() {
        throw new UnsupportedOperationException("Return map url");
    }

    /**
     * @return the activeMap
     */
    public EventMap getActiveMap() {
        return activeMap;
    }

    /**
     * @param activeMap the activeMap to set
     */
    public void setActiveMap(EventMap activeMap) {
        this.activeMap = activeMap;
    }

}