Skip to content
Snippets Groups Projects
Commit 5d52accb authored by Philipp Spohr's avatar Philipp Spohr
Browse files

Fruitless attempts to select a tab in CyBrowser

Some copyright headers updated
parent 0ddc91f1
Branches master
No related tags found
No related merge requests found
/*******************************************************************************
* Copyright (C) 2018 Philipp Spohr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package de.hhu.ba.yoshikoWrapper.cytoUtil;
import java.awt.Component;
import org.cytoscape.application.swing.CytoPanel;
import org.cytoscape.application.swing.CytoPanelComponent;
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
*
*/
public class CyUtilities {
/**
* Selects the tab containing the CyBrowser in the result panel if such a tab exists
*/
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 CytoPanelComponent) {
CytoPanelComponent cmp = (CytoPanelComponent) component;
if (cmp.getTitle().equals("CyBrowser")) {
resultPanel.setSelectedIndex(i);
return;
}
}
}
// int index = resultPanel.indexOfComponent("edu.ucsf.rbvi.cyBrowser.internal.view.ResultsPanelBrowser");
// if (index != -1) {
// resultPanel.setSelectedIndex(index);
// }
// else {
// //TODO: Output something?
// System.err.println("Failed to identify CyBrowser tab");
// }
}
}
/******************************************************************************* /*******************************************************************************
* Copyright (C) 2017 Philipp Spohr * Copyright (C) 2018 Philipp Spohr
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
......
/*******************************************************************************
* Copyright (C) 2017 Philipp Spohr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package de.hhu.ba.yoshikoWrapper.cytoUtil; package de.hhu.ba.yoshikoWrapper.cytoUtil;
import java.util.List; import java.util.List;
......
/******************************************************************************* /*******************************************************************************
* Copyright (C) 2017 Philipp Spohr * Copyright (C) 2018 Philipp Spohr
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
package de.hhu.ba.yoshikoWrapper.help; package de.hhu.ba.yoshikoWrapper.help;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
public final class HelpLinks { public final class HelpLinks {
public static final HashMap<String,Object> mainInfo = new HashMap<String,Object>(); public static final Map<String, Object> mainInfo = new HashMap<String,Object>();
static { static {
mainInfo.put("url", "file:///home/philipp/workspace/cs/cytoscape-tutorials/presentations/yoshiko.html"); mainInfo.put("url", "file:///home/philipp/workspace/cs/cytoscape-tutorials/presentations/yoshiko.html");
//mainInfo.put("url", "https://spqrph.github.io/cytoscape-tutorials/presentations/yoshiko.html#/title"); //mainInfo.put("url", "https://spqrph.github.io/cytoscape-tutorials/presentations/yoshiko.html#/title");
......
/*******************************************************************************
* Copyright (C) 2018 Philipp Spohr
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
package de.hhu.ba.yoshikoWrapper.swing.components; package de.hhu.ba.yoshikoWrapper.swing.components;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
...@@ -12,6 +33,7 @@ import javax.swing.JButton; ...@@ -12,6 +33,7 @@ import javax.swing.JButton;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.cytoUtil.CommandExecutor; 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.help.HelpLinks;
import de.hhu.ba.yoshikoWrapper.swing.GraphicsLoader; import de.hhu.ba.yoshikoWrapper.swing.GraphicsLoader;
...@@ -34,7 +56,9 @@ public class HelpButton extends JButton{ ...@@ -34,7 +56,9 @@ public class HelpButton extends JButton{
private static final ImageIcon hlIcon = GraphicsLoader.getInfoIconHL(SIZE); private static final ImageIcon hlIcon = GraphicsLoader.getInfoIconHL(SIZE);
/**
* Default Constructor, creates a JButton that opens the help section in CyBrowser
*/
public HelpButton() { public HelpButton() {
super(defaultIcon); super(defaultIcon);
...@@ -48,8 +72,9 @@ public class HelpButton extends JButton{ ...@@ -48,8 +72,9 @@ public class HelpButton extends JButton{
new ActionListener() { new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
CommandExecutor.executeCommand("cybrowser", "show",HelpLinks.mainInfo , null); CommandExecutor.executeCommand("cybrowser", "show",HelpLinks.mainInfo , null);
//Workaround to instantly select/highlight the CyBrowser tab
CyUtilities.highlightCyBrowser();
} }
} }
); );
......
...@@ -293,7 +293,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask, Tunab ...@@ -293,7 +293,7 @@ public class AlgorithmTask extends AbstractTask implements ObservableTask, Tunab
public void cancel() { public void cancel() {
//Free C++ resources //Free C++ resources
if (c_algorithm != null) { if (c_algorithm != null) {
System.out.println("Deleting CoreAlgorithm instance!"); //System.out.println("Deleting CoreAlgorithm instance!");
c_algorithm.cancel(); c_algorithm.cancel();
c_algorithm.delete(); c_algorithm.delete();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment