public QuantityRequirement( String requirementName, String enterString, String recordName, boolean isOptional) { super(requirementName, enterString, recordName, isOptional, true); ClientQuantity clientQuantity = new ClientQuantity(); clientQuantity.setValue(1.0); setDefaultValue(clientQuantity); }
@Override protected Result onFinish(Context context) { ClientQuantity quantity = getValue(); Unit unit = getRequirement(UNIT).getValue(); quantity.setUnit(unit == null ? 0 : unit.getID()); quantity.setValue((Double) getRequirement(VALUE).getValue()); return null; }
@Override public void setValue(Object value) { ClientQuantity clientQuantity = (ClientQuantity) value; if (clientQuantity != null) { getRequirement(UNIT) .setValue( CommandUtils.getServerObjectById(clientQuantity.getUnit(), AccounterCoreType.UNIT)); getRequirement(VALUE).setValue(clientQuantity.getValue()); } super.setValue(value); }