new PropertyModel(this, "associations"))
{
public void populateItem(final ListItem listItem)
{
final JetspeedPrincipal principal = (JetspeedPrincipal) listItem
.getModelObject();
listItem.add(new Label("Name", principal.getName()));
Link deleteLink = new Link("delete")
{
@Override
public void onClick()
{
try
{
if (!associationsFrom)
{
getManager().removeAssociation(principal,
getPrincipal(), assoctionName);
} else
{
getManager().removeAssociation(
getPrincipal(), principal,
assoctionName);
}
refreshList();
} catch (Exception e)
{
// TODO: handle exception
}
}
};
deleteLink.add(new Label("deleteLabel", new ResourceModel(
"common.delete")));
listItem.add(deleteLink);
}
};
if(assoicationType.getFromPrincipalType().equals(principalType))
{
add(new Label("principalReleation",new ResourceModel(assoicationType.getToPrincipalType().getName())));
}else{
add(new Label("principalReleation",new ResourceModel(assoicationType.getFromPrincipalType().getName())));
}
add(commentListView);
add(new FeedbackPanel("feedback"));
Form assocationsForm = new Form("assocationsForm");
add(assocationsForm);
DropDownChoice dropDown = new DropDownChoice(
"associationPrincipal", new PropertyModel(this,
"associationPrincipal"), getNames(),
new ChoiceRenderer("name", "name"));
dropDown.setRequired(true);
assocationsForm.add(dropDown);
Button addRelations = new Button("addRelations", new ResourceModel(
"common.association.add"))
{
@Override
public void onSubmit()
{
try
{
JetspeedPrincipal toPrincipal = getPrincipal();
// JetspeedPrincipal fromPrincipal =
// getJetspeedPrincipalManagerProvider().getManager(type).getPrincipal(getAssociationPrincipal());
JetspeedPrincipal fromPrincipal = getAssociationPrincipal();
if (!associationsFrom)
{
getManager().addAssociation(fromPrincipal,
toPrincipal, associationName);
} else