diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java index 3e0563aac04968fc50a90868cf2fe4ab8a111cf4..1c9440ef6f3bc00f673ccbf97c7264748bcc9090 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/core/YoshikoLoader.java @@ -2,17 +2,24 @@ package de.hhu.ba.yoshikoWrapper.core; import java.io.File; +import org.slf4j.Logger; + +import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger; + public class YoshikoLoader { private static ConfigurationManager cm; private static boolean isLoaded; + //Symbolic Links + private static Logger logger = YoshikoLogger.getInstance().getLogger(); + public static void loadLibrary(String libPath) { //Attempt to load from a previously stored path File f = new File (libPath); if (!f.exists()) { - System.out.println("Could not find a previously saved yoshiko library path, needs to be set manually!"); + logger.info("Could not load the Yoshiko-library from a previously saved path! You might need to set the path manually."); return; } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java index ba893825fcd140fcc01427755e2eb85c0264c16e..aea51813d9a33391133ae3390dc8f7eadac3bf8b 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/DoubleInputField.java @@ -7,9 +7,9 @@ import javax.swing.JFormattedTextField; */ @SuppressWarnings("serial") public class DoubleInputField extends JFormattedTextField{ - - public DoubleInputField() { - super(FormatHelper.getDoubleFormatter()); + + public DoubleInputField(double minValue,double maxValue) { + super(FormatHelper.getDoubleFormatter(minValue,maxValue)); this.setColumns(8); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java new file mode 100644 index 0000000000000000000000000000000000000000..d131859a83dc17ea639add21c47b6fad3efa752f --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java @@ -0,0 +1,26 @@ +package de.hhu.ba.yoshikoWrapper.gui; + +import javax.swing.JLabel; + +@SuppressWarnings("serial") //Will never be serialized +public class EditCostPanel extends ComfortPanel { + + //SWING COMPONENTS + private ModificationCostMapper modCostMapper; + private DoubleInputField icField; + private DoubleInputField dcField; + private JLabel icLabel; + private JLabel dcLabel; + + public EditCostPanel() { + modCostMapper = new ModificationCostMapper(); + icField = new DoubleInputField(0,Double.NEGATIVE_INFINITY); + dcField = new DoubleInputField(0,Double.POSITIVE_INFINITY); + icLabel = new JLabel("Insertion Cost:"); + dcLabel = new JLabel("Deletion Cost:"); + icLabel.setLabelFor(icField); + dcLabel.setLabelFor(dcField); + this.addAll(modCostMapper,icField,dcField,icLabel,dcLabel); + } + +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java index dd448186bb2396aafb773173aeb941b8f1731a32..770d241c3bf5523b33b3485339a1def29f354495 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/FormatHelper.java @@ -18,12 +18,12 @@ public class FormatHelper { return formatter; } - public static NumberFormatter getDoubleFormatter() { + public static NumberFormatter getDoubleFormatter(double minValue, double maxValue) { NumberFormat format = NumberFormat.getInstance(); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); - formatter.setMinimum(0); - formatter.setMaximum(Integer.MAX_VALUE); + formatter.setMinimum(minValue); + formatter.setMaximum(maxValue); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); 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 a50e9be6eeb50fd133b3ec531b4510c726451259..403ceb434d38d05b4666fe5239aef9ed34ac1281 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java @@ -33,8 +33,8 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent { private LibStatusPanel libStatusPanel; private JButton searchLibButton; private JLabel yoshikoVersionLabel; - - private ModificationCostMapper modCostMapper; + + private EditCostPanel ecPanel; private ButtonGroup heuristicGroup; private JRadioButton useHeuristic; @@ -65,8 +65,8 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent { yoshikoVersionLabel.setText(LibraryInterface.getVersionString()); } searchLibButton = new JButton("POINT TO LIB"); - - modCostMapper = new ModificationCostMapper(); + + ecPanel = new EditCostPanel(); heuristicGroup = new ButtonGroup(); useILP = new JRadioButton("Use Integer Linear Programming"); @@ -116,7 +116,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent { libStatusPanel, yoshikoVersionLabel, searchLibButton, - modCostMapper, + ecPanel, useILP, useHeuristic, timeLimitSetter, diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ModificationCostMapper.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ModificationCostMapper.java index dbccbf350b2102c6be3d20a1df48569e1535c13f..78c74b132d987aa541c512b7c4e09926df50fec9 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ModificationCostMapper.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/ModificationCostMapper.java @@ -37,7 +37,7 @@ public class ModificationCostMapper extends ComfortPanel { updateValues(); //Add a focus listener to update values //TODO: This might be a bit inelegant but there is no way to get a callback from CS when a table changes values - this.addFocusListener(new FocusListener() { + tableFields.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpDialog.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpDialog.java new file mode 100644 index 0000000000000000000000000000000000000000..e30e48b2874341266093b064fc2d6e422853285f --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpDialog.java @@ -0,0 +1,14 @@ +package de.hhu.ba.yoshikoWrapper.gui; + +import javax.swing.JDialog; +import javax.swing.JTree; + +@SuppressWarnings("serial") +public class YoshikoHelpDialog extends JDialog { + private JTree navigationTree; + + public YoshikoHelpDialog() { + navigationTree = new JTree(); + this.add(navigationTree); + } +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpModel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpModel.java new file mode 100644 index 0000000000000000000000000000000000000000..241ac67a90a9d760cbea6b34305f2ed7b7544784 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/YoshikoHelpModel.java @@ -0,0 +1,57 @@ +package de.hhu.ba.yoshikoWrapper.gui; + +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; + +public class YoshikoHelpModel implements TreeModel { + + @Override + public Object getRoot() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getChild(Object parent, int index) { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getChildCount(Object parent) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean isLeaf(Object node) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void valueForPathChanged(TreePath path, Object newValue) { + // TODO Auto-generated method stub + + } + + @Override + public int getIndexOfChild(Object parent, Object child) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void addTreeModelListener(TreeModelListener l) { + // TODO Auto-generated method stub + + } + + @Override + public void removeTreeModelListener(TreeModelListener l) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/logging/YoshikoLogger.java b/src/main/java/de/hhu/ba/yoshikoWrapper/logging/YoshikoLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..cbedca65cc3c8b6d71a5ac2f0f3969b258420726 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/logging/YoshikoLogger.java @@ -0,0 +1,28 @@ +package de.hhu.ba.yoshikoWrapper.logging; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class YoshikoLogger { + + //SINGLETON TEMPLATE// + private static YoshikoLogger instance; + private YoshikoLogger() {}; + public static YoshikoLogger getInstance() { + if (instance == null) { + instance = new YoshikoLogger(); + } + return instance; + } + + private Logger logger; + + public Logger getLogger() { + if (logger == null) { + logger = LoggerFactory.getLogger(getClass()); + } + return logger; + } + + +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/logging/package-info.java b/src/main/java/de/hhu/ba/yoshikoWrapper/logging/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..4e8e500c890ca7f22e25bb81ad33dadbf0cde386 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/logging/package-info.java @@ -0,0 +1,4 @@ +/** + * + */ +package de.hhu.ba.yoshikoWrapper.logging; \ No newline at end of file