
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 extends Number> type;
private Integer precision;
private Character thousandSeparator;
// ------------------------------
public WNumberRangeInput(String id, Class extends Number> type) {
this(id, null, type);
}
public WNumberRangeInput(String id, IModel> model, Class extends Number> 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