/*
 * 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 it.unitn.disi.lingProg.longato;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

/**
 * Displayer di immagini
 * @author matteo.longato
 */
public class ImageDisplayer extends ImageView{
    Map<String, Image> locationImages;
    
    public ImageDisplayer(List<Alloggio> archive){
        locationImages = new HashMap<>();
        for(Alloggio a:archive){
            locationImages.put(a.name, new Image("imgs/"+a.name+".jpg"));
        }
    }
    
    /**
     * Mette a schermo l'immagine corrispondente alla stringa passata come parametro
     * @param imageKey L'immagine da caricare
     */
    public void displayImage(String imageKey){
        this.setImage(locationImages.get(imageKey));
    }
}
