@Override
protected void onUpdate(AjaxRequestTarget target) {
Widget w = isDisplayed(wd);
boolean b = getModelObject();
DashboardContext dashboardContext = getDashboardContext();
Dashboard d = getDashboard();
if (w != null && !b) {
d.deleteWidget(w.getId());
}
if (w == null && b) {
d.addWidget(dashboardContext.getWidgetFactory().createWidget(wd));
}
dashboardContext.getDashboardPersiter().save(d);
}
});
}