Mercurial > dive4elements > gnv-client
view gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java @ 1022:28a0628b11b0
Added license file and license header.
gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 02 Nov 2010 17:15:08 +0000 |
parents | c7f8a9b4b006 |
children |
line wrap: on
line source
/* * Copyright (c) 2010 by Intevation GmbH * * This program is free software under the LGPL (>=v2.1) * Read the file LGPL.txt coming with the software for details * or visit http://www.gnu.org/licenses/ if it does not exist. */ package de.intevation.gnv.action.sessionmodel; import java.text.NumberFormat; import java.util.HashMap; import java.util.Locale; import java.util.Map; /** * Stores key-value pairs used to save user input for changing diagram * attributes. * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> */ public class DiagrammOptions { private Map<String, Object> values = new HashMap<String, Object>(); /** * Constructor */ public DiagrammOptions() { super(); } /** * Returns the Value to a given Key * @param key The key of the value that should be returned. * @return the value. */ public Object getValue(String key) { return this.values.get(key); } /** * Returns the value as string. * @param key The key of the value that should be returned. * @param locale A locale object used to format numbers. * @return the value as string. */ public String getValue(String key, Locale locale) { Object obj = values.get(key); if (obj instanceof Double && locale != null) { Double value = (Double) obj; NumberFormat format = NumberFormat.getNumberInstance(locale); return format.format(value); } return (String) obj; } /** * Set a value with the given key. * * @param key The given key. * @param value The value to be stored. */ public void setValue(String key, Object value) { values.put(key, value); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :