teichmann@5861: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5861: * Software engineering by Intevation GmbH teichmann@5861: * teichmann@5861: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5861: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5861: * documentation coming with Dive4Elements River for details. teichmann@5861: */ teichmann@5861: teichmann@5835: package org.dive4elements.river.client.shared.model; raimund@1439: christian@3859: import java.util.ArrayList; raimund@1439: import java.util.HashMap; christian@3859: import java.util.List; raimund@1439: raimund@1439: /** raimund@1439: * @author Raimund Renkert raimund@1439: */ raimund@1503: public class PropertySetting implements Property, Cloneable { raimund@1439: raimund@1439: /**The settings name.*/ raimund@1439: protected String name; raimund@1439: raimund@1439: /** The default value.*/ raimund@1439: protected String value; raimund@1439: raimund@1439: /** Additional attributes.*/ raimund@1439: protected HashMap attributes; raimund@1439: raimund@1439: /** raimund@1439: * Create a new StyleSetting for theme attribution. raimund@1439: */ raimund@1439: public PropertySetting() { raimund@1439: this.attributes = new HashMap(); raimund@1439: } raimund@1439: raimund@1439: raimund@1439: /** raimund@1439: * Create a new PropertySet. raimund@1439: * @param name The attribute name. raimund@1439: * @param value The current value. raimund@1439: */ raimund@1439: public PropertySetting( raimund@1439: String name, raimund@1439: String value) raimund@1439: { raimund@1439: this.name = name; raimund@1439: this.value = value; raimund@1439: this.attributes = new HashMap(); raimund@1439: } raimund@1439: raimund@1439: public void setName(String name) { raimund@1439: this.name = name; raimund@1439: } raimund@1439: raimund@1439: public void setValue(String value) { raimund@1439: this.value = value; raimund@1439: } raimund@1439: raimund@1478: public void setAttribute(String k, String v) { raimund@1478: attributes.put(k, v); raimund@1439: } raimund@1439: raimund@1439: public String getName() { raimund@1439: return this.name; raimund@1439: } raimund@1439: raimund@1507: public Object getValue() { raimund@1439: return this.value; raimund@1439: } raimund@1439: raimund@1439: public String getAttribute(String key) { raimund@1439: return attributes.get(key); raimund@1439: } raimund@1439: christian@3859: public List getAttributeList() { raimund@1439: return new ArrayList(attributes.keySet()); raimund@1439: } raimund@1503: christian@3859: @Override raimund@1503: public Object clone() { raimund@1503: PropertySetting clone = new PropertySetting(this.getName(), raimund@1507: this.getValue().toString()); raimund@1503: for(String s: this.getAttributeList()) { raimund@1503: clone.setAttribute(s, this.getAttribute(s)); raimund@1503: } raimund@1503: return clone; raimund@1503: } raimund@1439: } raimund@1439: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :