From d3c61407079c9802551e677edec2fb43a6631997 Mon Sep 17 00:00:00 2001 From: Philipp Spohr <spohr.philipp@web.de> Date: Mon, 7 Aug 2017 17:33:08 +0200 Subject: [PATCH] finally got some c++ interaction going --- .../{YoshikoInterface.java => YoshikoLoader.java} | 10 +++++----- .../java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) rename src/main/java/de/hhu/ba/yoshikoWrapper/core/{YoshikoInterface.java => YoshikoLoader.java} (75%) diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoInterface.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java similarity index 75% rename from src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoInterface.java rename to src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java index 337d34e..e718bac 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoInterface.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java @@ -1,20 +1,20 @@ package de.hhu.ba.yoshikoWrapper.core; -public class YoshikoInterface { +public class YoshikoLoader { //SINGLETON TEMPLATE - private static YoshikoInterface instance; + private static YoshikoLoader instance; private static boolean libraryLoaded; - public static YoshikoInterface getInstance() { + public static YoshikoLoader getInstance() { if (instance == null){ - instance = new YoshikoInterface(); + instance = new YoshikoLoader(); } return instance; } - private YoshikoInterface() { + private YoshikoLoader() { libraryLoaded = false; } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java index 3a5ff3c..7638707 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java @@ -7,12 +7,14 @@ import java.awt.event.ActionListener; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JFileChooser; +import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelName; -import de.hhu.ba.yoshikoWrapper.core.YoshikoInterface; +import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; +import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; /**This class describes the Swing Panel that the user interacts with in cytoscape * @author Philipp Spohr, Aug 6, 2017 @@ -26,12 +28,13 @@ public class MainPanel extends JPanel implements CytoPanelComponent { private static final long serialVersionUID = 6214827920591046457L; //SYMBOLIC LINKS - private YoshikoInterface yoshikoInterface = YoshikoInterface.getInstance(); + private YoshikoLoader yoshikoInterface = YoshikoLoader.getInstance(); private MainPanel self = this; //for lambda function references //SWING COMPONENTS private LibStatusPanel libStatusPanel; private JButton searchLibButton; + private JLabel yoshikoVersionLabel; /** * Main constructor, creates a new Panel and intializes subcomponents @@ -54,11 +57,16 @@ public class MainPanel extends JPanel implements CytoPanelComponent { if (returnVal == JFileChooser.APPROVE_OPTION) { yoshikoInterface.loadLibrary(c.getSelectedFile().getAbsolutePath()); } + libStatusPanel.setStyle(yoshikoInterface.isLibraryLoaded()); + yoshikoVersionLabel.setText(LibraryInterface.getVersionString()); } }); this.add(searchLibButton); + yoshikoVersionLabel = new JLabel("YOSHIKO VERSION"); + this.add(yoshikoVersionLabel); + this.setVisible(true); } -- GitLab