CheckBox wmsIntegration = checkbox("enableWMSIntegration", wmsIntegrationEnabledModel,
"GWCSettingsPage.enableWMSIntegration.title");
form.add(wmsIntegration);
final DiskQuotaConfig diskQuotaConfig = diskQuotaModel.getObject();
Quota globalQuota = diskQuotaConfig.getGlobalQuota();
if (globalQuota == null) {
LOGGER.info("There's no GWC global disk quota configured, setting a default of 100MiB");
globalQuota = new Quota(100, StorageUnit.MiB);
diskQuotaConfig.setGlobalQuota(globalQuota);
}
// use this two payload models to let the user configure the global
// 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());