int includedSubsystems =0;
// build groups first
for(SubsystemGroup group : SubsystemMetaData.getGroups().values())
{
final TreeItem groupTreeItem = new DefaultTreeItem(group.getName());
for(final SubsystemGroupItem groupItem : group.getItems())
{
for(SubsystemRecord subsys: subsystems)
{
if(subsys.getKey().equals(groupItem.getKey())
&& groupItem.isDisabled()==false)
{
includedSubsystems++;
final String key = groupItem.getPresenter();
// messaging -----------------------------------
if("messaging".equals(key)) {
// See https://issues.jboss.org/browse/AS7-1857
// there can be multiple messaging server instances
new LoadHornetQServersCmd(Console.MODULES.getDispatchAsync()).execute(
new AsyncCallback<List<String>>() {
@Override
public void onFailure(Throwable caught) {
Console.error("Failed to load messaging server names", caught.getMessage());
}
@Override
public void onSuccess(List<String> result) {
for(String server : result)
{
String token = parentPlace + key+";name="+server;
final LHSNavTreeItem link = new LHSNavTreeItem("Provider: "+server, token);
link.setKey(key);
groupTreeItem.addItem(link);
}
}
}
);
//if(groupTreeItem.getChildCount()>0)
subsysTree.addItem(groupTreeItem);
// skip ahead
continue;
}
// logging -----------------------------------
else if("logging".equals(key))
{
//TreeItem logging = new DefaultTreeItem("Logging");
final LHSNavTreeItem loggers = new LHSNavTreeItem("Loggers", NameTokens.Logger);
final LHSNavTreeItem handlers = new LHSNavTreeItem("Log Handlers", NameTokens.Logger+";page=handler");
//logging.addItem(loggers);
//logging.addItem(handlers);
groupTreeItem.addItem(loggers);
groupTreeItem.addItem(handlers);
subsysTree.addItem(groupTreeItem);
continue;
}
String token = parentPlace + key;
final LHSNavTreeItem link = new LHSNavTreeItem(groupItem.getName(), token);
link.setKey(key);
groupTreeItem.addItem(link);
}
}
}
// skip empty groups
if(groupTreeItem.getChildCount()>0)
subsysTree.addItem(groupTreeItem);
}
// fallback in case no manageable subsystems exist