/** Return value, that user have chosen in the field or typed in. */
@Override
protected Value getValueInternal() {
final String text = textFieldPart.getText();
final Unit unit = (Unit) unitComboBox.getSelectedItem();
if (unit != null) {
if (unit.isPlural() == "1".equals(text)) {
unit.setPlural(!"1".equals(text));
unitComboBox.repaint();
}
final boolean accessible = application.isAccessible(getEnableAccessMode());
if (text == null || text.isEmpty()) {
if (!unit.isEmpty()) {
unit.setEmpty(true);
unitEnabled = false;
application.invokeLater(new Runnable() {
@Override
public void run() {
unitComboBox.repaint();
unitComboBox.setEnabled(false);
}
});
}
} else {
if (unit.isEmpty()) {
unit.setEmpty(false);
if (textFieldPart.isEnabled()) {
unitEnabled = true;
application.invokeLater(new Runnable() {
@Override
public void run() {