// quota as a decimal value
// plus a storage unit. Then at form sumbission we'll transform them
// back to a BigInteger
// representing the quota byte count
BigInteger bytes = globalQuota.getBytes();
StorageUnit bestRepresentedUnit = StorageUnit.bestFit(bytes);
BigDecimal transformedQuota = StorageUnit.B.convertTo(new BigDecimal(bytes),
bestRepresentedUnit);
final IModel<Double> configQuotaValueModel = new Model<Double>(
transformedQuota.doubleValue());
final IModel<StorageUnit> configQuotaUnitModel = new Model<StorageUnit>(bestRepresentedUnit);
DiskQuotaConfigPanel diskQuotaConfigPanel = new DiskQuotaConfigPanel(
"diskQuotaConfigPanel", form, diskQuotaModel, gwcModel, configQuotaValueModel,
configQuotaUnitModel);
if (diskQuotaDisabled) {
diskQuotaConfigPanel.setVisible(false);
}
form.add(diskQuotaConfigPanel);
form.add(new Button("submit") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
GeoServer gs = getGeoServer();
WMSInfo wmsInfo = wmsInfoModel.getObject();
gs.save(wmsInfo);
if (diskQuotaDisabled) {
setResponsePage(GeoServerHomePage.class);
return;
}
GWC gwc = getGWC();
StorageUnit chosenUnit = configQuotaUnitModel.getObject();
// REVISIT: it seems Wicket is sending back a plain string
// instead of a BigDecimal
String chosenQuotaStr = String.valueOf(configQuotaValueModel.getObject());
Double chosenQuota;
try {