All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.devocative.wickomp.form.range.WNumberRangeInput Maven / Gradle / Ivy

package org.devocative.wickomp.form.range;

import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.model.IModel;
import org.devocative.adroit.vo.IRange;
import org.devocative.wickomp.form.WNumberInput;

public class WNumberRangeInput extends WBaseRangeInput {
	private static final long serialVersionUID = -3084374441053594155L;

	private Class type;
	private Integer precision;
	private Character thousandSeparator;

	// ------------------------------

	public WNumberRangeInput(String id, Class type) {
		this(id, null, type);
	}

	public WNumberRangeInput(String id, IModel> model, Class type) {
		super(id, model);
		this.type = type;
	}

	// ------------------------------

	public WNumberRangeInput setPrecision(Integer precision) {
		this.precision = precision;
		return this;
	}

	public WNumberRangeInput setThousandSeparator(Character thousandSeparator) {
		this.thousandSeparator = thousandSeparator;
		return this;
	}

	// ------------------------------

	@Override
	protected FormComponent createFormComponent(String id, IModel model) {
		WNumberInput input = new WNumberInput(id, model, type);

		if (precision != null) {
			input.setPrecision(precision);
		}

		if (thousandSeparator != null) {
			input.setThousandSeparator(thousandSeparator);
		}

		return input;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy