jMenu.add(getHubStartAction(false));
jMenu.addSeparator();
}
boolean isSpectrum = format != null && format.startsWith("spectrum/");
final PlasticTransmitter trans = new PlasticTransmitter(this,
isSpectrum ? MessageId.SPECTRUM_LOADURL : MessageId.VOT_LOADURL,
isSpectrum ? "spectrum" : "table") {
@Override
protected void transmit(PlasticHubListener hub, URI clientId, ApplicationItem app) throws IOException {
URI[] recipients = (app == null) ? null : new URI[]{app.getId()};
transmitTable(hub, clientId, recipients, url, format, ucdMap);
}
};
JMenu sendMenu = trans.createSendMenu();
sendMenu.setIcon(Resources.getIcon("phone2.gif"));
menu.add(sendMenu);
final JMenuItem broadCastItem = new JMenuItem(isSpectrum ? "Broadcast Spectrum" : "Broadcast Table");
broadCastItem.setIcon(Resources.getIcon("broadcast.gif"));
broadCastItem.addActionListener(trans.getBroadcastAction());
menu.add(broadCastItem);
if (url == null) {
broadCastItem.setEnabled(false);
trans.setEnabled(false);
navigator.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent changeEvent) {
boolean enabled = navigator.getResultComponent() instanceof TableDisplayTool;
trans.setEnabled(enabled);
broadCastItem.setEnabled(enabled);
}
});
} else {
trans.setEnabled(true);
}
}