child.destroy();
}
addMember(createChangeSetForm(driftDetails.getDrift()));
DynamicForm driftForm = new DynamicForm();
driftForm.setIsGroup(true);
driftForm.setGroupTitle(MSG.view_tabs_common_drift());
driftForm.setWrapItemTitles(false);
driftForm.setNumCols(4);
SpacerItem spacer = new SpacerItem();
StaticTextItem id = new StaticTextItem("id", MSG.common_title_id());
id.setValue(driftDetails.getDrift().getId());
StaticTextItem path = new StaticTextItem("path", MSG.common_title_path());
path.setValue(driftDetails.getDrift().getPath());
StaticTextItem timestamp = new StaticTextItem("timestamp", MSG.common_title_timestamp());
timestamp.setValue(TimestampCellFormatter.format(driftDetails.getDrift().getCtime(), DATE_TIME_FORMAT_FULL));
StaticTextItem category = new StaticTextItem("category", MSG.common_title_category());
LinkedHashMap<String, String> catIconsMap = new LinkedHashMap<String, String>(3);
catIconsMap.put(DriftDataSource.CATEGORY_ICON_ADD, DriftDataSource.CATEGORY_ICON_ADD);
catIconsMap.put(DriftDataSource.CATEGORY_ICON_CHANGE, DriftDataSource.CATEGORY_ICON_CHANGE);
catIconsMap.put(DriftDataSource.CATEGORY_ICON_REMOVE, DriftDataSource.CATEGORY_ICON_REMOVE);
LinkedHashMap<String, String> catValueMap = new LinkedHashMap<String, String>(3);
catValueMap.put(DriftDataSource.CATEGORY_ICON_ADD, MSG.view_drift_category_fileAdded());
catValueMap.put(DriftDataSource.CATEGORY_ICON_CHANGE, MSG.view_drift_category_fileChanged());
catValueMap.put(DriftDataSource.CATEGORY_ICON_REMOVE, MSG.view_drift_category_fileRemoved());
category.setValueMap(catValueMap);
category.setValueIcons(catIconsMap);
category.setShowIcons(true);
StaticTextItem oldFile = new StaticTextItem("oldFile", MSG.view_drift_table_oldFile());
FormItem oldFileLink = null;
StaticTextItem newFile = new StaticTextItem("newFile", MSG.view_drift_table_newFile());
FormItem newFileLink = null;
if (driftDetails.isBinaryFile()) {
switch (driftDetails.getDrift().getCategory()) {
case FILE_ADDED:
category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
oldFile.setValue(MSG.common_label_none());
oldFileLink = spacer;
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
newFileLink = spacer;
break;
case FILE_CHANGED:
category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
oldFileLink = spacer;
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
newFileLink = spacer;
break;
case FILE_REMOVED:
category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
oldFileLink = spacer;
newFile.setValue(MSG.common_label_none());
newFileLink = spacer;
break;
}
driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp, spacer, oldFile, oldFileLink,
newFile, newFileLink);
} else {
FormItem viewDiffLink = spacer;
switch (driftDetails.getDrift().getCategory()) {
case FILE_ADDED:
category.setValue(DriftDataSource.CATEGORY_ICON_ADD);
oldFile.setValue(MSG.common_label_none());
oldFileLink = spacer;
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
newFileLink = createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(), driftDetails
.getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getNewFileStatus());
break;
case FILE_CHANGED:
category.setValue(DriftDataSource.CATEGORY_ICON_CHANGE);
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
oldFileLink = createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(), driftDetails
.getDrift().getPath(), driftDetails.getPreviousChangeSet().getVersion(),
driftDetails.getOldFileStatus());
newFile.setValue(driftDetails.getDrift().getNewDriftFile().getHashId());
newFileLink = createViewFileLink(driftDetails.getDrift().getNewDriftFile().getHashId(), driftDetails
.getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getNewFileStatus());
if (driftDetails.getNewFileStatus() == LOADED && driftDetails.getOldFileStatus() == LOADED) {
viewDiffLink = createViewDiffLink(driftDetails.getDrift(), driftDetails.getPreviousChangeSet()
.getVersion());
}
break;
case FILE_REMOVED:
category.setValue(DriftDataSource.CATEGORY_ICON_REMOVE);
oldFile.setValue(driftDetails.getDrift().getOldDriftFile().getHashId());
oldFileLink = createViewFileLink(driftDetails.getDrift().getOldDriftFile().getHashId(), driftDetails
.getDrift().getPath(), driftDetails.getChangeSet().getVersion(), driftDetails.getOldFileStatus());
newFile.setValue(MSG.common_label_none());
newFileLink = spacer;
break;
}
driftForm.setItems(id, spacer, path, spacer, category, spacer, timestamp, spacer, oldFile, oldFileLink,
newFile, newFileLink, spacer, spacer, spacer, viewDiffLink);
}
addMember(driftForm);
}