Show FloatTextBoxWithID.java syntax highlighted
package ucalgary.ebe.webui.client.ui;
public class FloatTextBoxWithID extends TextBoxWithID {
private boolean changed = false;
private float value;
private static final String FLOAT_PATTERN = "\\d+(\\.{1}\\d+)?";
public FloatTextBoxWithID(long id, float value) {
super(id);
setText(String.valueOf(value));
}
public void setText(String f) {
if(f.matches(FLOAT_PATTERN)) {
super.setText(f);
this.changed = true;
this.value = Float.valueOf(f).floatValue();
this.content = f;
} else {
this.changed = false;
super.setText(this.content);
}
}
public boolean hasChanged() {
return this.changed;
}
public float getValue() {
return this.value;
}
}
See more files for this project here