this.itemId = itemId;
this.itemItem = itemItem;
add(new ConfirmForm("form"));
final String relatingRefId = itemItem.getItem().getRefId();
final String relatedRefId = itemItem.getRelatedItem().getRefId();
final YuiDialog relatingDialog = new YuiDialog("relatingDialog");
final YuiDialog relatedDialog = new YuiDialog("relatedDialog");
add(relatingDialog);
add(relatedDialog);
AjaxLink relating = new AjaxLink("relating") {
public void onClick(AjaxRequestTarget target) {
Item relating = getJtrac().loadItem(itemItem.getItem().getId());
relatingDialog.show(target, relatingRefId, new ItemViewPanel(YuiDialog.CONTENT_ID, relating, true));
}
};
relating.add(new Label("refId", relatingRefId));
add(relating);
// TODO refactor, duplicate code in ItemViewPanel
String message = null;
if(itemItem.getType() == DUPLICATE_OF) {
message = localize("item_view.duplicateOf");
} else if (itemItem.getType() == DEPENDS_ON) {
message = localize("item_view.dependsOn");
} else if (itemItem.getType() == RELATED){
message = localize("item_view.relatedTo");
}
add(new Label("message", message));
AjaxLink related = new AjaxLink("related") {
public void onClick(AjaxRequestTarget target) {
Item related = getJtrac().loadItem(itemItem.getRelatedItem().getId());
relatedDialog.show(target, relatedRefId, new ItemViewPanel(YuiDialog.CONTENT_ID, related, true));
}
};
related.add(new Label("refId", itemItem.getRelatedItem().getRefId()));
add(related);