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

preparing for time limit and generic argument passing

parent 0a313f10
No related branches found
No related tags found
No related merge requests found
package de.hhu.ba.yoshikoWrapper.core; package de.hhu.ba.yoshikoWrapper.core;
import java.util.HashMap;
//TODO: ADD LOGGER SYSTEM //TODO: ADD LOGGER SYSTEM
import org.cytoscape.application.CyApplicationManager; import org.cytoscape.application.CyApplicationManager;
...@@ -21,12 +18,14 @@ public class Core { ...@@ -21,12 +18,14 @@ public class Core {
cy = cyApplicationManager; cy = cyApplicationManager;
} }
public static void performYoshiko() { public static void performYoshiko(int timeLimit) {
CyNetwork currentNetwork = cy.getCurrentNetwork(); CyNetwork currentNetwork = cy.getCurrentNetwork();
if (currentNetwork == null) { if (currentNetwork == null) {
//TODO //TODO
} }
LibraryInterface.setTimeLimit(timeLimit);
NodeMap nodeMap = new NodeMap(currentNetwork); NodeMap nodeMap = new NodeMap(currentNetwork);
SWIGTYPE_p_yskInput__LibraryInput input = NetworkParser.parseNetwork(currentNetwork,nodeMap); SWIGTYPE_p_yskInput__LibraryInput input = NetworkParser.parseNetwork(currentNetwork,nodeMap);
......
...@@ -3,26 +3,19 @@ package de.hhu.ba.yoshikoWrapper.gui; ...@@ -3,26 +3,19 @@ package de.hhu.ba.yoshikoWrapper.gui;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.HashMap;
import javax.swing.BoxLayout;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.cytoscape.application.swing.CytoPanelComponent; import org.cytoscape.application.swing.CytoPanelComponent;
import org.cytoscape.application.swing.CytoPanelName; import org.cytoscape.application.swing.CytoPanelName;
import org.cytoscape.model.CyNode;
import de.hhu.ba.yoshikoWrapper.core.Core; import de.hhu.ba.yoshikoWrapper.core.Core;
import de.hhu.ba.yoshikoWrapper.core.NetworkParser;
import de.hhu.ba.yoshikoWrapper.core.NodeMap;
import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader;
import de.hhu.ba.yoshikoWrapper.gui.TimeLimitSetter; import de.hhu.ba.yoshikoWrapper.gui.*;
import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface; import de.hhu.ba.yoshikoWrapper.swig.LibraryInterface;
import de.hhu.ba.yoshikoWrapper.swig.SWIGTYPE_p_yskInput__LibraryInput;
import de.hhu.ba.yoshikoWrapper.swig.SWIGTYPE_p_ysk__ClusterEditingSolutions;
/**This class describes the Swing Panel that the user interacts with in cytoscape /**This class describes the Swing Panel that the user interacts with in cytoscape
* @author Philipp Spohr, Aug 6, 2017 * @author Philipp Spohr, Aug 6, 2017
...@@ -50,6 +43,8 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -50,6 +43,8 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
*/ */
public MainPanel() { public MainPanel() {
this.setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS));
//SWING COMPONENT INITIALIZATION //SWING COMPONENT INITIALIZATION
libStatusPanel = new LibStatusPanel(); libStatusPanel = new LibStatusPanel();
...@@ -83,7 +78,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { ...@@ -83,7 +78,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (yoshikoLoader.isLibraryLoaded()){ if (yoshikoLoader.isLibraryLoaded()){
Core.performYoshiko(); Core.performYoshiko(timeLimitSetter.getTimeLimit());
} }
} }
......
...@@ -20,4 +20,7 @@ public class NumberInputField extends JFormattedTextField{ ...@@ -20,4 +20,7 @@ public class NumberInputField extends JFormattedTextField{
super(FormatHelper.getIntegerFormatter()); super(FormatHelper.getIntegerFormatter());
} }
public int getTimeLimit() {
return Integer.parseInt(getText());
}
} }
...@@ -20,6 +20,7 @@ public class TimeLimitSetter extends JPanel{ ...@@ -20,6 +20,7 @@ public class TimeLimitSetter extends JPanel{
checkBox = new JCheckBox(); checkBox = new JCheckBox();
numberField = new NumberInputField(); numberField = new NumberInputField();
numberField.setEnabled(false); //By default time limit is turned off numberField.setEnabled(false); //By default time limit is turned off
numberField.setSize(40, 10);
checkBox.addActionListener( checkBox.addActionListener(
new ActionListener() { new ActionListener() {
...@@ -39,7 +40,7 @@ public class TimeLimitSetter extends JPanel{ ...@@ -39,7 +40,7 @@ public class TimeLimitSetter extends JPanel{
if (checkBox.isSelected()) { if (checkBox.isSelected()) {
return -1; return -1;
} }
return (int)numberField.getValue(); return numberField.getTimeLimit();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment