Source:
public void Initialize(SystemTreeItemModel systemTreeSelectedItem) { super.Initialize(systemTreeSelectedItem); AsyncDataProvider.GetDataCenterById(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; if (returnValue != null) { storage_pool dataCenter = (storage_pool) returnValue; ArrayList<storage_pool> list = new ArrayList<storage_pool>(Arrays.asList(new storage_pool[] { dataCenter })); model.SetDataCenter(model, list); model.getDataCenter().setIsChangable(false); } else { ExistingVmModelBehavior behavior = (ExistingVmModelBehavior) model.getBehavior(); VM currentVm = behavior.vm; VDSGroup tempVar = new VDSGroup(); tempVar.setId(currentVm.getVdsGroupId()); tempVar.setname(currentVm.getVdsGroupName()); tempVar.setcompatibility_version(currentVm.getVdsGroupCompatibilityVersion()); tempVar.setStoragePoolId(currentVm.getStoragePoolId()); VDSGroup cluster = tempVar; model.getCluster() .setItems(new ArrayList<VDSGroup>(Arrays.asList(new VDSGroup[] { cluster }))); model.getCluster().setSelectedItem(cluster); behavior.InitTemplate(); behavior.InitCdImage(); } } }, getModel().getHash()), vm.getStoragePoolId()); AsyncDataProvider.GetWatchdogByVmId(new AsyncQuery(this.getModel(), new INewAsyncCallback() { public void OnSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; VdcQueryReturnValue val = (VdcQueryReturnValue) returnValue; @SuppressWarnings("unchecked") Collection<VmWatchdog> watchdogs = (Collection<VmWatchdog>) val.getReturnValue(); for(VmWatchdog watchdog: watchdogs) { model.getWatchdogAction().setEntity(watchdog.getAction()); model.getWatchdogModel().setEntity(watchdog.getModel()); } } }), vm.getId()); }

Target:
public void Initialize(SystemTreeItemModel systemTreeSelectedItem) { super.Initialize(systemTreeSelectedItem); AsyncDataProvider.GetDataCenterById(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; if (returnValue != null) { storage_pool dataCenter = (storage_pool) returnValue; ArrayList<storage_pool> list = new ArrayList<storage_pool>(Arrays.asList(new storage_pool[] { dataCenter })); model.SetDataCenter(model, list); model.getDataCenter().setIsChangable(false); } else { ExistingVmModelBehavior behavior = (ExistingVmModelBehavior) model.getBehavior(); VM currentVm = behavior.vm; VDSGroup tempVar = new VDSGroup(); tempVar.setId(currentVm.getVdsGroupId()); tempVar.setname(currentVm.getVdsGroupName()); tempVar.setcompatibility_version(currentVm.getVdsGroupCompatibilityVersion()); tempVar.setStoragePoolId(currentVm.getStoragePoolId()); VDSGroup cluster = tempVar; model.getCluster() .setItems(new ArrayList<VDSGroup>(Arrays.asList(new VDSGroup[] { cluster }))); model.getCluster().setSelectedItem(cluster); behavior.InitTemplate(); behavior.InitCdImage(); } } }, getModel().getHash()), vm.getStoragePoolId()); AsyncDataProvider.GetWatchdogByVmId(new AsyncQuery(this.getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; VdcQueryReturnValue val = (VdcQueryReturnValue) returnValue; @SuppressWarnings("unchecked") Collection<VmWatchdog> watchdogs = (Collection<VmWatchdog>) val.getReturnValue(); for(VmWatchdog watchdog: watchdogs) { model.getWatchdogAction().setEntity(watchdog.getAction()); model.getWatchdogModel().setEntity(watchdog.getModel()); } } }), vm.getId()); }