package mil.nga.mapcache.layersprovider;

import java.util.Observable;

/**
 * The model that contains all the possible layers from a given server.
 */
public class LayersModel extends Observable {

    /**
     * The layers property.
     */
    public static String LAYERS_PROP = "layers";

    /**
     * The selected layer.
     */
    public static String SELECTED_LAYER_PROP = "selectedLayers";

    /**
     * The image formats property.
     */
    public static String IMAGE_FORMATS_PROP = "imageFormats";

    /**
     * The available image formats for the tiles.
     */
    private String[] imageFormats;

    /**
     * The available layers from a server.
     */
    private LayerModel[] layers;

    /**
     * The selected layer.
     */
    private LayerModel selectedLayer;

    /**
     * Gets the available layers from a server.
     *
     * @return The available layers from a server.
     */
    public LayerModel[] getLayers() {
        return layers;
    }

    /**
     * Sets the available layers from a server.
     *
     * @param layers The available layers.
     */
    public void setLayers(LayerModel[] layers) {
        this.layers = layers;
        setChanged();
        notifyObservers(LAYERS_PROP);
    }

    /**
     * Gets the selected layer.
     *
     * @return The selected layer.
     */
    public LayerModel getSelectedLayer() {
        return selectedLayer;
    }

    /**
     * Sets the selected layer.
     *
     * @param selectedLayer The selected layer.
     */
    public void setSelectedLayer(LayerModel selectedLayer) {
        this.selectedLayer = selectedLayer;
        setChanged();
        notifyObservers(SELECTED_LAYER_PROP);
    }

    /**
     * Gets the available image formats for the layers tiles.
     *
     * @return The available image formats.
     */
    public String[] getImageFormats() {
        return imageFormats;
    }

    /**
     * Sets the available image formats for the layers tiles.
     *
     * @param imageFormats The availabel image formats.
     */
    public void setImageFormats(String[] imageFormats) {
        this.imageFormats = imageFormats;
        setChanged();
        notifyObservers(IMAGE_FORMATS_PROP);
    }
}

@@ -505,24 +505,115 @@
 eFormats%22;%0A%0A
+    /**%0A     * The title property.%0A     */%0A    public static String TITLE_PROP = %22title%22;%0A%0A
     /**%0A    
@@ -877,16 +877,130 @@
 Layer;%0A%0A
+    /**%0A     * The title to display for the layers view.%0A     */%0A    private String title = %22Choose your layer%22;%0A%0A
     /**%0A
@@ -2411,11 +2411,331 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Gets the title.%0A     * @return The title.%0A     */%0A    public String getTitle() %7B%0A        return title;%0A    %7D%0A%0A    /**%0A     * Sets the title.%0A     * @param title The title.%0A     */%0A    public void setTitle(String title) %7B%0A        this.title = title;%0A        setChanged();%0A        notifyObservers();%0A    %7D
 %0A%7D%0A

Add title to model