Object src = e.getSource();
// if we clicked on the group node
if (src instanceof BSMapEditJIDLabel) {
BSMapEditJIDLabel label = (BSMapEditJIDLabel) src;
JID jid = label.getJID();
jidPopupMenu.removeAll();
if (label.isEditable()) {
jidPopupMenu.add(addMenuItem);
jidPopupMenu.add(deleteMenuItem);
//jidPopupMenu.add(jidMenuItem);
jidPopupMenu.add(new JSeparator());
}
jidPopupMenu.add(layerMenuItem);
jidPopupMenu.add(addLayerMenuItem);
jidPopupMenu.add(deleteLayerMenuItem);
jidPopupMenu.add(new JSeparator());
infoMenuItem.setText(jid.toString());
jidPopupMenu.add(infoMenuItem);
jidPopupMenu.show(e.getComponent(), e.getX(), e.getY());
//adjustPopupPosition(jidPopupMenu);*/
}
// else if we clicked on image panel
else if (src instanceof BSMapEditImagePanel) {
BSMapEditImagePanel imgPanel = (BSMapEditImagePanel) src;
imgPopupMenu.removeAll();
if (imgPanel.isEditable()) {
imgPopupMenu.add(changeMenuItem);
imgPopupMenu.add(new JSeparator());
imgPopupMenu.add(addMenuItem);
}
imgPopupMenu.add(layerMenuItem);
imgPopupMenu.add(addLayerMenuItem);
imgPopupMenu.add(deleteLayerMenuItem);
imgPopupMenu.add(new JSeparator());
infoMenuItem.setText(imgPanel.getTag().getSrc());
imgPopupMenu.add(infoMenuItem);
imgPopupMenu.show(e.getComponent(), e.getX(), e.getY());
//adjustPopupPosition(jidPopupMenu);*/
}
// else if we clicked on cluster label
else if (src instanceof BSMapEditClusterLabel) {
BSMapEditClusterLabel label = (BSMapEditClusterLabel) src;
clusterPopupMenu.removeAll();
if (label.isEditable()) {
clusterPopupMenu.add(addMenuItem);
clusterPopupMenu.add(deleteClusterMenuItem);
clusterPopupMenu.add(setClusterNameMenuItem);
//jidPopupMenu.add(jidMenuItem);
clusterPopupMenu.add(new JSeparator());
}
clusterPopupMenu.add(layerMenuItem);
clusterPopupMenu.add(addLayerMenuItem);
clusterPopupMenu.add(deleteLayerMenuItem);
clusterPopupMenu.add(new JSeparator());
Enumeration jids = label.getJIDs();
// for all jids in cluster
while (jids.hasMoreElements()) {
JID j = (JID) jids.nextElement();
clusterPopupMenu.add(new JMenuItem(j.toString()));
}
clusterPopupMenu.show(e.getComponent(), e.getX(), e.getY());
//adjustPopupPosition(jidPopupMenu);*/