{
activeNode = controller.getVisualization().getGraph().getSelectedNodes().getFirst();//node or group that is selected
IHierarchyComponent group = null;
INodeComponent node = controller.getRegistry().getNodeComponent(activeNode);
if (node instanceof IHierarchyComponent )//if a group was chosen
{
group = (IHierarchyComponent) node;
actualPathwayString = ((INodeComponentUI) group.getUI()).getLabel();
for (IComponent c : group.getChildren())
{
if (c instanceof INodeComponent)
{
Collection<String> externalIdentifier = c.getExternalIdentifier("NCBI-GeneID");
if (c.getExternalIdentifier("NCBI-GeneID") != null)
{
for (String eI : externalIdentifier)
{
id = eI;
}
}
}
}
}
else if (node.getParent() != null && node.getParent() != node.getMappingModel().getRootComponent())
{
group = node.getParent();
actualPathwayString = ((INodeComponentUI) group.getUI()).getLabel();
if(actualPathwayString.isEmpty())
{
actualPathwayString = null;
}
for (String eI : node.getExternalIdentifier("NCBI-GeneID"))
{
id = eI;
}
}
if(actualPathwayString == null) //if ungrouped node was choosen
{
IComponentUI ui = node.getUI();
if (ui instanceof BasicNodeComponentUI)
{
BasicNodeComponentUI n = (BasicNodeComponentUI) ui;
if (!mapToDrawE.isEmpty())
{
pathways = mapToDrawE.getKeys(n);
}
else
{
pathways = mapToDraw.getKeys(n);
}
if (pathways.size() > 0)
{
String[] pathList= new String[pathways.size()];
int number=0;
for (Pathway path : pathways)
{
pathList[number]= path.getFirstName();
number=number+1;
}
final JList list = new JList(pathList);
JLabel label = new JLabel("Please select pathway you are interested in: ");
JOptionPane optionPane = new JOptionPane(new Object[] { label, new JScrollPane(list) }, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
final JDialog dialog = optionPane.createDialog(null, "Input");
dialog.setVisible(true);
actualPathwayString = (String) list.getSelectedValue();
for (String eI : node.getExternalIdentifier("NCBI-GeneID"))
{
id = eI;
}
}
}