From 640e8dbe44f2358599e40bef20b6fe386291a38b Mon Sep 17 00:00:00 2001 From: Philipp Spohr <spohr.philipp@web.de> Date: Thu, 1 Mar 2018 12:47:53 +0100 Subject: [PATCH] Trying to have a pop-out window - at least --- .../yoshikoWrapper/cytoUtil/CyUtilities.java | 38 +++++++++---------- .../hhu/ba/yoshikoWrapper/help/HelpLinks.java | 3 +- .../swing/components/HelpButton.java | 5 +-- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/CyUtilities.java b/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/CyUtilities.java index 6c96b09..b4d2629 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/CyUtilities.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/cytoUtil/CyUtilities.java @@ -23,14 +23,6 @@ package de.hhu.ba.yoshikoWrapper.cytoUtil; -import java.awt.Component; - -import org.cytoscape.application.swing.CytoPanel; -import org.cytoscape.application.swing.CytoPanelComponent2; -import org.cytoscape.application.swing.CytoPanelName; - -import de.hhu.ba.yoshikoWrapper.core.CyCore; - /** * Helper functions that simplify the Cytoscape API that haven't found a home in any other class * @@ -42,18 +34,24 @@ public class CyUtilities { */ public static void highlightCyBrowser() { //We retrieve the result panel - CytoPanel resultPanel = CyCore.swing.getCytoPanel(CytoPanelName.EAST); - for (int i= 0; i< resultPanel.getCytoPanelComponentCount(); i++) { - Component component = resultPanel.getComponentAt(i); - if (component instanceof CytoPanelComponent2) { - CytoPanelComponent2 cmp = (CytoPanelComponent2) component; - if (cmp.getTitle().contains("YoshikoInfo")) { - resultPanel.setSelectedIndex(i); - return; - } - } - - } + //CytoPanel resultPanel = CyCore.swing.getCytoPanel(CytoPanelName.EAST); + + //VARIANT 1: FETCH BY TITLE OF TAB + +// for (int i= 0; i< resultPanel.getCytoPanelComponentCount(); i++) { +// Component component = resultPanel.getComponentAt(i); +// if (component instanceof CytoPanelComponent2) { +// CytoPanelComponent2 cmp = (CytoPanelComponent2) component; +// if (cmp.getTitle().contains("YoshikoInfo")) { +// resultPanel.setSelectedIndex(i); +// return; +// } +// } +// +// } + + //VARIANT 2: FETCH BY CLASS OF TAB COMPONENT + // int index = resultPanel.indexOfComponent("edu.ucsf.rbvi.cyBrowser.internal.view.ResultsPanelBrowser"); // if (index != -1) { // resultPanel.setSelectedIndex(index); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java b/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java index 50e8701..604225a 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java @@ -29,7 +29,8 @@ public final class HelpLinks { public static final Map<String, Object> mainInfo = new HashMap<String,Object>(); static { mainInfo.put("url", "file:///home/philipp/workspace/cs/cytoscape-tutorials/presentations/yoshiko.html"); - mainInfo.put("title", "YoshikoInfo"); + mainInfo.put("title", "Yoshiko Info"); + //mainInfo.put("id", "AboutYoshiko"); //mainInfo.put("url", "https://spqrph.github.io/cytoscape-tutorials/presentations/yoshiko.html#/title"); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java index f349637..fd5510c 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swing/components/HelpButton.java @@ -33,7 +33,6 @@ import javax.swing.JButton; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.cytoUtil.CommandExecutor; -import de.hhu.ba.yoshikoWrapper.cytoUtil.CyUtilities; import de.hhu.ba.yoshikoWrapper.help.HelpLinks; import de.hhu.ba.yoshikoWrapper.swing.GraphicsLoader; @@ -72,9 +71,9 @@ public class HelpButton extends JButton{ new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - CommandExecutor.executeCommand("cybrowser", "show",HelpLinks.mainInfo , null); + CommandExecutor.executeCommand("cybrowser", "dialog",HelpLinks.mainInfo , null); //Workaround to instantly select/highlight the CyBrowser tab - CyUtilities.highlightCyBrowser(); + //CyUtilities.highlightCyBrowser(); } } ); -- GitLab