42 lines
768 B
Java
42 lines
768 B
Java
package org.hwo.ui.servicelink.register;
|
|
|
|
import javax.swing.JComponent;
|
|
|
|
import org.hwo.io.servicelink.ServiceLink;
|
|
|
|
public class FloatServiceRegister extends ServiceRegister {
|
|
|
|
FloatRegisterEditor editor;
|
|
|
|
public FloatServiceRegister(ServiceLink serviceLink)
|
|
{
|
|
super(serviceLink);
|
|
editor = new FloatRegisterEditor();
|
|
editor.setServiceRegister(this);
|
|
}
|
|
|
|
@Override
|
|
public String getTextRepresentation() {
|
|
Float f = readFloatValue();
|
|
if (f == null)
|
|
return "";
|
|
return String.format("0x%08X %f",Float.floatToIntBits(f),f);
|
|
}
|
|
|
|
@Override
|
|
public JComponent getEditorComponent() {
|
|
return editor;
|
|
}
|
|
|
|
@Override
|
|
public void acceptEditorValue() {
|
|
editor.writeValue();
|
|
}
|
|
|
|
@Override
|
|
public void updateEditorValue() {
|
|
editor.readValue();
|
|
}
|
|
|
|
}
|