final ModalWindow metaDataModalWindow;
final WebMarkupContainer ajaxPanel = new WebMarkupContainer(
"basePanel");
add(metaDataModalWindow = new ModalWindow("modalwindow"));
ajaxPanel.add(new Label("nameLabel", new ResourceModel(
"metedataTab.name")));
ajaxPanel.add(new Label("languageLabel", new ResourceModel(
"metedataTab.language")));
final ListView metaDataListView = new ListView("metaData",
new PropertyModel(this, "document.metaData"))
{
private static final long serialVersionUID = 1L;
public void populateItem(final ListItem listItem)
{
final JetspeedDocumentMetaData metaData = (JetspeedDocumentMetaData) listItem
.getModelObject();
listItem.add(new Label("name", metaData.getName()));
listItem.add(new Label("language", metaData.getLanguage()));
listItem.add(new Label("value", metaData.getValue()));
AjaxLink editLink = new AjaxLink("edit", new Model("edit"))
{
@Override
public void onClick(AjaxRequestTarget target)
{
metaDataModalWindow.setContent(new MetaDataPanel(
metaDataModalWindow.getContentId(),
metaData, ajaxPanel));
metaDataModalWindow.show(target);
}
};
editLink.add(new Label("editLabel", new ResourceModel(
"common.edit")));
listItem.add(editLink);
AjaxLink deleteLink = new AjaxLink("delete", new Model(
"delete"))
{
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target)
{
metaDataAction(REMOVE_ACTION, metaData, null);
target.addComponent(ajaxPanel);
}
};
deleteLink.add(new Label("deleteLabel", new ResourceModel(
"common.delete")));
deleteLink.add(new JavascriptEventConfirmation("onclick",
new ResourceModel("action.delete.confirm")));
listItem.add(deleteLink);
}
};
metaDataListView.setOutputMarkupId(true);
ajaxPanel.setOutputMarkupId(true);
ajaxPanel.add(metaDataListView);
Form metaForm = new Form("metaForm");
add(metaForm);
add(new AjaxButton("new",new ResourceModel("common.new"),metaForm)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
metaDataModalWindow