public CommandResponse actionChangeDisplayer(CommandRequest request) throws Exception {
String uid = request.getRequestObject().getParameter("uid");
DataDisplayerType selectedType = DataDisplayerServices.lookup().getDataDisplayerManager().getDisplayerTypeByUid(uid);
if (selectedType == null) return null;
DataDisplayer kpiDisplayer = kpi.getDataDisplayer();
DataDisplayerType kpiDisplayerType = kpiDisplayer.getDataDisplayerType();
// If the displayer associated to the kpi is not the new displayer, change it.
if (!kpiDisplayerType.getUid().equals(selectedType.getUid())) {
DataDisplayer newDisplayer = selectedType.createDataDisplayer();
newDisplayer.setDefaultSettings();
newDisplayer.copyFrom(kpiDisplayer);
kpi.setDataDisplayer(newDisplayer);
setKpi(kpi);
return null;
}
return null;