raimund@1461: package de.intevation.flys.client.shared.model;
raimund@1461:
raimund@1503: import java.util.HashMap;
raimund@1503:
raimund@1461: /**
raimund@1461: * @author Raimund Renkert
raimund@1461: */
raimund@1461: public class IntegerProperty extends PropertySetting {
raimund@1461:
raimund@1503: /**
raimund@1503: * Create a new IntegerProperty for settings.
raimund@1503: */
raimund@1503: public IntegerProperty() {
raimund@1503: this.attributes = new HashMap();
raimund@1503: }
raimund@1503:
raimund@1503:
raimund@1503: /**
raimund@1503: * Create a new IntegerProperty.
raimund@1503: * @param name The attribute name.
raimund@1503: * @param value The current value.
raimund@1503: */
raimund@1503: public IntegerProperty(
raimund@1503: String name,
raimund@1507: Integer value)
raimund@1503: {
raimund@1503: this.name = name;
raimund@1507: this.value = value.toString();
raimund@1503: this.attributes = new HashMap();
raimund@1503: }
raimund@1503:
raimund@1503:
raimund@1507: @Override
raimund@1507: public Integer getValue() {
raimund@1507: try {
raimund@1507: return Integer.valueOf(this.value);
raimund@1507: }
raimund@1507: catch(NumberFormatException nfe) {
raimund@1507: return null;
raimund@1507: }
raimund@1507: }
raimund@1507:
raimund@1507:
raimund@1507: public void setValue(Integer value) {
raimund@1507: this.value = value.toString();
raimund@1507: }
raimund@1507:
raimund@1503: public Object clone() {
raimund@1503: IntegerProperty clone = new IntegerProperty(this.getName(),
raimund@1503: this.getValue());
raimund@1503: for(String s: this.getAttributeList()) {
raimund@1503: clone.setAttribute(s, this.getAttribute(s));
raimund@1503: }
raimund@1503: return clone;
raimund@1503: }
raimund@1503:
raimund@1461: }