teichmann@5835: package org.dive4elements.river.client.shared.model; felix@1593: felix@1593: felix@1593: public class DoubleRangeData implements RangeData { felix@1593: felix@1593: public static final String TYPE = "doublerange"; felix@1593: felix@1593: felix@1593: protected String label; felix@1593: protected String description; felix@1593: felix@1593: protected double lower; felix@1593: protected double upper; felix@1593: felix@1593: protected Double defLower; felix@1593: protected Double defUpper; felix@1593: felix@1593: felix@1593: public DoubleRangeData() { felix@1593: } felix@1593: felix@1593: felix@1593: public DoubleRangeData(String label, String desc, double lower, double upper) { felix@1593: this(label, desc, lower, upper, null, null); felix@1593: } felix@1593: felix@1593: felix@1593: public DoubleRangeData( felix@1593: String label, felix@1593: String desc, felix@1593: double lower, felix@1593: double upper, felix@1593: Double defLower, felix@1593: Double defUpper felix@1593: ) { felix@1593: this.label = label; felix@1593: this.description = desc; felix@1593: this.lower = lower; felix@1593: this.upper = upper; felix@1593: this.defLower = defLower; felix@1593: this.defUpper = defUpper; felix@1593: } felix@1593: felix@1593: felix@1593: /** felix@1593: * Returns the label of the item. felix@1593: * felix@1593: * @return the label. felix@1593: */ felix@1593: public String getLabel() { felix@1593: return label; felix@1593: } felix@1593: felix@1593: felix@1593: /** felix@1593: * Returns the description of the item. felix@1593: * felix@1593: * @return the description. felix@1593: */ felix@1593: public String getDescription() { felix@1593: return description; felix@1593: } felix@1593: felix@1593: felix@1593: /** felix@1593: * Returns the type of the item. felix@1593: * felix@1593: * @return the type. felix@1593: */ felix@1593: public String getType() { felix@1593: return "doublerange"; felix@1593: } felix@1593: felix@1593: felix@1593: /** felix@1593: * Returns a DataItem which value is a string that consists of the min and felix@1593: * max value separated by a ';'. felix@1593: * felix@1593: * @return the DataItem. felix@1593: */ felix@1593: public DataItem[] getItems() { felix@1593: String theMin = String.valueOf(lower); felix@1593: String theMax = String.valueOf(upper); felix@1593: felix@1593: String label = theMin + " - " + theMax; felix@1593: String value = theMin + ";" + theMax; felix@1593: felix@1593: DataItem item = new DefaultDataItem(label, label, value); felix@1593: felix@1593: return new DataItem[] { item }; felix@1593: } felix@1593: felix@1593: felix@1593: /** felix@1593: * @return always null. felix@1593: */ felix@1593: public DataItem getDefault() { felix@1593: return null; felix@1593: } felix@1593: felix@1593: felix@1593: public Object getLower() { felix@1593: return lower; felix@1593: } felix@1593: felix@1593: felix@1593: public Object getUpper() { felix@1593: return upper; felix@1593: } felix@1593: felix@1593: felix@1593: public Object getDefaultLower() { felix@1593: return defLower; felix@1593: } felix@1593: felix@1593: felix@1593: public Object getDefaultUpper() { felix@1593: return defUpper; felix@1593: } raimund@2535: raimund@2535: raimund@2535: /** raimund@2535: * Returns the values as colon separated string. raimund@2535: * raimund@2535: * @return colon separated string. raimund@2535: */ raimund@2535: public String getStringValue() { raimund@2535: String data = lower + ";" + upper; raimund@2535: return data; raimund@2535: } raimund@2535: felix@1593: } felix@1593: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :