forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
6 years ago
|
package com.fanruan.api.design.ui.editor;
|
||
|
|
||
|
import com.fanruan.api.design.DesignKit;
|
||
|
import com.fr.base.Utils;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019/11/1
|
||
|
* 用于编辑和展示单精度浮点型数值的编辑器
|
||
|
* TODO:待补充文档
|
||
|
*/
|
||
|
public class TypeFloatEditor extends BaseNumberEditor<Float> {
|
||
|
|
||
|
public TypeFloatEditor() {
|
||
|
this(0.0f);
|
||
|
}
|
||
|
|
||
|
public TypeFloatEditor(Float value) {
|
||
|
super(value, DesignKit.i18nText("Fine-Design_Basic_Parameter_Float"));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean accept(Object object) {
|
||
|
return object instanceof Float;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Float getValue() {
|
||
|
return (float) this.numberField.getValue();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void setValue(Float value) {
|
||
|
if (value == null) {
|
||
|
value = (float) 0;
|
||
|
}
|
||
|
this.numberField.setInteger(false);
|
||
|
this.numberField.setValue(value.doubleValue());
|
||
|
oldValue = Utils.objectToString(value);
|
||
|
}
|
||
|
|
||
|
public String getIconName() {
|
||
|
return "type_double";
|
||
|
}
|
||
|
|
||
|
}
|