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 {
cy = cyApplicationManager;
}
public static CyNetwork getCurrentNetwork() {
return cy.getCurrentNetwork();
public static CyApplicationManager getApplicationManager() {
return cy;
}
}
......@@ -2,21 +2,12 @@ package de.hhu.ba.yoshikoWrapper.core;
import java.io.File;
import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface;
public class YoshikoLoader {
private static ConfigurationManager cm;
private static boolean isLoaded;
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
File f = new File (libPath);
......@@ -32,21 +23,21 @@ public class YoshikoLoader {
cm.getProperties().setProperty("pathToYoshiko", libPath);
}
catch(Exception e) {
e.printStackTrace();
//e.printStackTrace();
return;
}
isLoaded = true;
}
//SETTER / GETTER
public static boolean isLibraryLoaded() {
if (LibraryInterface.getVersionString() != null) return true;
return false;
}
public static void provideConfiguration(ConfigurationManager _cm) {
cm = _cm;
}
public static boolean isLibraryLoaded() {
return isLoaded;
}
}
......@@ -6,18 +6,18 @@ import java.awt.event.FocusListener;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyNetwork;
import de.hhu.ba.yoshikoWrapper.core.Core;
@SuppressWarnings("serial") //will never be serialized
public class ModificationCostMapper extends JPanel {
public class ModificationCostMapper extends ComfortPanel {
//Symbolic links
private CyNetwork net;
private CyApplicationManager cy;
//Swing components
private JComboBox<CyColumn> tableFields;
......@@ -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."
+"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
updateValues();
//Add a focus listener to update values
......@@ -53,10 +54,13 @@ public class ModificationCostMapper extends JPanel {
public void updateValues() {
//Clear entries
tableFields.removeAllItems();
CyNetwork net = cy.getCurrentNetwork();
if (net != null) { //Check if a network is loaded
for (CyColumn c : net.getDefaultEdgeTable().getColumns()){
tableFields.addItem(c);
}
}
}
public CyColumn getValue() {
if (useMapping.isSelected()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment