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

Small fix

parent bef7b6cb
No related branches found
No related tags found
No related merge requests found
...@@ -64,8 +64,8 @@ public class Core { ...@@ -64,8 +64,8 @@ public class Core {
cy = cyApplicationManager; cy = cyApplicationManager;
} }
public static CyNetwork getCurrentNetwork() { public static CyApplicationManager getApplicationManager() {
return cy.getCurrentNetwork(); return cy;
} }
} }
...@@ -2,21 +2,12 @@ package de.hhu.ba.yoshikoWrapper.core; ...@@ -2,21 +2,12 @@ package de.hhu.ba.yoshikoWrapper.core;
import java.io.File; import java.io.File;
import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface;
public class YoshikoLoader { public class YoshikoLoader {
private static ConfigurationManager cm; private static ConfigurationManager cm;
private static boolean isLoaded;
public static void loadLibrary(String libPath) { public static void loadLibrary(String libPath) {
//TODO: Java has no method to unload a native library :( This means, that reloading the library file on the fly is not possible
//Check 1: Library is already loaded
if (isLibraryLoaded()) {
System.out.println("Library is already loaded!");
return;
}
//Attempt to load from a previously stored path //Attempt to load from a previously stored path
File f = new File (libPath); File f = new File (libPath);
...@@ -32,21 +23,21 @@ public class YoshikoLoader { ...@@ -32,21 +23,21 @@ public class YoshikoLoader {
cm.getProperties().setProperty("pathToYoshiko", libPath); cm.getProperties().setProperty("pathToYoshiko", libPath);
} }
catch(Exception e) { catch(Exception e) {
e.printStackTrace(); //e.printStackTrace();
return;
} }
isLoaded = true;
} }
//SETTER / GETTER //SETTER / GETTER
public static boolean isLibraryLoaded() {
if (LibraryInterface.getVersionString() != null) return true;
return false;
}
public static void provideConfiguration(ConfigurationManager _cm) { public static void provideConfiguration(ConfigurationManager _cm) {
cm = _cm; cm = _cm;
} }
public static boolean isLibraryLoaded() {
return isLoaded;
}
} }
...@@ -6,18 +6,18 @@ import java.awt.event.FocusListener; ...@@ -6,18 +6,18 @@ import java.awt.event.FocusListener;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JPanel;
import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.model.CyColumn; import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyNetwork; import org.cytoscape.model.CyNetwork;
import de.hhu.ba.yoshikoWrapper.core.Core; import de.hhu.ba.yoshikoWrapper.core.Core;
@SuppressWarnings("serial") //will never be serialized @SuppressWarnings("serial") //will never be serialized
public class ModificationCostMapper extends JPanel { public class ModificationCostMapper extends ComfortPanel {
//Symbolic links //Symbolic links
private CyNetwork net; private CyApplicationManager cy;
//Swing components //Swing components
private JComboBox<CyColumn> tableFields; private JComboBox<CyColumn> tableFields;
...@@ -31,7 +31,8 @@ public class ModificationCostMapper extends JPanel { ...@@ -31,7 +31,8 @@ public class ModificationCostMapper extends JPanel {
+"You can also assign negative values if you have a complete graph to represent insertion costs." +"You can also assign negative values if you have a complete graph to represent insertion costs."
+"Note: Any missing values are assumed to be the default values" +"Note: Any missing values are assumed to be the default values"
); );
net = Core.getCurrentNetwork(); cy = Core.getApplicationManager();
this.addAll(useMapping,tableFields);
//Initial call to get table values //Initial call to get table values
updateValues(); updateValues();
//Add a focus listener to update values //Add a focus listener to update values
...@@ -53,10 +54,13 @@ public class ModificationCostMapper extends JPanel { ...@@ -53,10 +54,13 @@ public class ModificationCostMapper extends JPanel {
public void updateValues() { public void updateValues() {
//Clear entries //Clear entries
tableFields.removeAllItems(); tableFields.removeAllItems();
CyNetwork net = cy.getCurrentNetwork();
if (net != null) { //Check if a network is loaded
for (CyColumn c : net.getDefaultEdgeTable().getColumns()){ for (CyColumn c : net.getDefaultEdgeTable().getColumns()){
tableFields.addItem(c); tableFields.addItem(c);
} }
} }
}
public CyColumn getValue() { public CyColumn getValue() {
if (useMapping.isSelected()) { if (useMapping.isSelected()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment