view gwt-client/src/main/java/org/dive4elements/river/client/shared/model/MultiAttributeData.java @ 9416:05405292a7ca

Navigationtheme panel now shows themes of dWt and WQ charts grayed out, if the current station is outside the valid range of the theme.
author gernotbelger
date Thu, 16 Aug 2018 16:28:03 +0200
parents 766890addcb2
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.client.shared.model;

import java.util.Map;

public class MultiAttributeData implements Data {

    private static final long serialVersionUID = 1L;

    public static final String TYPE = "multiattribute";

    protected String label;
    protected String description;

    protected Map<String, Map<String, String>> meta;

    public DataItem[] opts;

    public MultiAttributeData() {
    }

    public MultiAttributeData(final String label, final String desc, final DataItem[] opts, final Map<String, Map<String, String>> meta) {
        this.label = label;
        this.description = desc;
        this.opts = opts;
        this.meta = meta;
    }

    public Map<String, Map<String, String>> getMeta() {
        return this.meta;
    }

    /**
     * Returns the label of the item.
     *
     * @return the label.
     */
    @Override
    public String getLabel() {
        return this.label;
    }

    /**
     * Returns the description of the item.
     *
     * @return the description.
     */
    @Override
    public String getDescription() {
        return this.description;
    }

    /**
     * Returns the type of the item.
     *
     * @return the type.
     */
    @Override
    public String getType() {
        return TYPE;
    }

    /**
     * Returns the data items which represent the allowed options for this Data.
     *
     * @return the allowed options as DataItem array.
     */
    @Override
    public DataItem[] getItems() {
        return this.opts;
    }

    /**
     * @return always null.
     */
    @Override
    public DataItem getDefault() {
        return null;
    }

    /**
     * Returns the values as colon separated string.
     *
     * @return colon separated string.
     */
    @Override
    public String getStringValue() {
        String data = "";
        boolean first = true;
        for (final DataItem opt : this.opts) {
            if (!first) {
                data += ";";
            }
            data += opt.getStringValue();
            first = false;
        }
        return data;
    }
}

http://dive4elements.wald.intevation.org