private ListView<DomainProvider> makeServiceList() {
return new ListView<DomainProvider>("domains", domainProvider) {
@Override
protected void populateItem(final ListItem<DomainProvider> item) {
final String domainType = item.getModelObject().getId();
item.add(new Label("domain.name", new LocalizableStringModel(this, item.getModelObject().getName())));
item.add(new Link<DomainProvider>("proxy.create.new", item.getModel()) {
@Override
public void onClick() {
setResponsePage(new ConnectorEditorPage(getModelObject().getId(),
Constants.EXTERNAL_CONNECTOR_PROXY));
}
});
item.add(new Label("domain.description", new LocalizableStringModel(this, item.getModelObject()
.getDescription())));
item.add(new Label("domain.class", item.getModelObject().getDomainInterface().getName()));
IModel<? extends List<? extends ConnectorProvider>> connectorProviderModel =
new LoadableDetachableModel<List<? extends ConnectorProvider>>() {
@Override
protected List<? extends ConnectorProvider> load() {
return utilsService.listServices(ConnectorProvider.class,
String.format("(%s=%s)", Constants.DOMAIN_KEY, domainType));
}
};
item.add(new ListView<ConnectorProvider>("services", connectorProviderModel) {
@Override
protected void populateItem(ListItem<ConnectorProvider> item) {
ServiceDescriptor desc = item.getModelObject().getDescriptor();
item.add(new Link<ConnectorProvider>("create.new", item.getModel()) {
@Override
public void onClick() {
setResponsePage(new ConnectorEditorPage(domainType, getModelObject().getId()));
}
});
item.add(new Label("service.name", new LocalizableStringModel(this, desc.getName())));
item.add(new Label("service.description", new LocalizableStringModel(this, desc
.getDescription())));
}
});
}
};