package de.prob2.ui.preferences;

import com.google.common.base.MoreObjects;

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

public class PrefItem {
	private final StringProperty name;
	private final StringProperty changed;
	private final StringProperty value;
	private final ObjectProperty<ProBPreferenceType> valueType;
	private final StringProperty defaultValue;
	private final StringProperty description;
	
	public PrefItem(
		final String name,
		final String changed,
		final String value,
		final ProBPreferenceType valueType,
		final String defaultValue,
		final String description
	) {
		super();
		this.name = new SimpleStringProperty(this, "name", name);
		this.changed = new SimpleStringProperty(this, "changed", changed);
		this.value = new SimpleStringProperty(this, "value", value);
		this.valueType = new SimpleObjectProperty<>(this, "valueType", valueType);
		this.defaultValue = new SimpleStringProperty(this, "defaultValue", defaultValue);
		this.description = new SimpleStringProperty(this, "description", description);
	}
	
	public ReadOnlyStringProperty nameProperty() {
		return this.name;
	}
	
	public String getName() {
		return this.name.get();
	}
	
	public ReadOnlyStringProperty changedProperty() {
		return this.changed;
	}
	
	public String getChanged() {
		return this.changed.get();
	}
	
	public ReadOnlyStringProperty valueProperty() {
		return this.value;
	}
	
	public String getValue() {
		return this.value.get();
	}
	
	public ReadOnlyObjectProperty<ProBPreferenceType> valueTypeProperty() {
		return this.valueType;
	}
	
	public ProBPreferenceType getValueType() {
		return this.valueType.get();
	}

	public ReadOnlyStringProperty defaultValueProperty() {
		return this.defaultValue;
	}
	
	public String getDefaultValue() {
		return this.defaultValue.get();
	}

	public ReadOnlyStringProperty descriptionProperty() {
		return this.description;
	}
	
	public String getDescription() {
		return this.description.get();
	}
	
	@Override
	public String toString() {
		return MoreObjects.toStringHelper(this)
			.add("name", this.getName())
			.add("changed", this.getChanged())
			.add("value", this.getValue())
			.add("valueType", this.getValueType())
			.add("defaultValue", this.getDefaultValue())
			.add("description", this.getDescription())
			.toString();
	}
	
	public void setValue(String value) {
		this.value.set(value);
	}
	
	public void setChanged(String changed) {
		this.changed.set(changed);
	}

}

@@ -2546,151 +2546,6 @@
 %0A%09%7D%0A
-%09%0A%09public void setValue(String value) %7B%0A%09%09this.value.set(value);%0A%09%7D%0A%09%0A%09public void setChanged(String changed) %7B%0A%09%09this.changed.set(changed);%0A%09%7D%0A%0A
 %7D%0A

Remove setters from PrefItem