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

Added more "clean" logging

Some more components representing parameters
parent 5d26f8c8
No related branches found
No related tags found
No related merge requests found
Showing
with 149 additions and 13 deletions
...@@ -2,17 +2,24 @@ package de.hhu.ba.yoshikoWrapper.core; ...@@ -2,17 +2,24 @@ package de.hhu.ba.yoshikoWrapper.core;
import java.io.File; import java.io.File;
import org.slf4j.Logger;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
public class YoshikoLoader { public class YoshikoLoader {
private static ConfigurationManager cm; private static ConfigurationManager cm;
private static boolean isLoaded; private static boolean isLoaded;
//Symbolic Links
private static Logger logger = YoshikoLogger.getInstance().getLogger();
public static void loadLibrary(String libPath) { public static void loadLibrary(String libPath) {
//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);
if (!f.exists()) { 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; return;
} }
......
...@@ -8,8 +8,8 @@ import javax.swing.JFormattedTextField; ...@@ -8,8 +8,8 @@ import javax.swing.JFormattedTextField;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class DoubleInputField extends JFormattedTextField{ public class DoubleInputField extends JFormattedTextField{
public DoubleInputField() { public DoubleInputField(double minValue,double maxValue) {
super(FormatHelper.getDoubleFormatter()); super(FormatHelper.getDoubleFormatter(minValue,maxValue));
this.setColumns(8); this.setColumns(8);
} }
......
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);
}
}
...@@ -18,12 +18,12 @@ public class FormatHelper { ...@@ -18,12 +18,12 @@ public class FormatHelper {
return formatter; return formatter;
} }
public static NumberFormatter getDoubleFormatter() { public static NumberFormatter getDoubleFormatter(double minValue, double maxValue) {
NumberFormat format = NumberFormat.getInstance(); NumberFormat format = NumberFormat.getInstance();
NumberFormatter formatter = new NumberFormatter(format); NumberFormatter formatter = new NumberFormatter(format);
formatter.setValueClass(Integer.class); formatter.setValueClass(Integer.class);
formatter.setMinimum(0); formatter.setMinimum(minValue);
formatter.setMaximum(Integer.MAX_VALUE); formatter.setMaximum(maxValue);
formatter.setAllowsInvalid(false); formatter.setAllowsInvalid(false);
formatter.setCommitsOnValidEdit(true); formatter.setCommitsOnValidEdit(true);
......
...@@ -34,7 +34,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent { ...@@ -34,7 +34,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent {
private JButton searchLibButton; private JButton searchLibButton;
private JLabel yoshikoVersionLabel; private JLabel yoshikoVersionLabel;
private ModificationCostMapper modCostMapper; private EditCostPanel ecPanel;
private ButtonGroup heuristicGroup; private ButtonGroup heuristicGroup;
private JRadioButton useHeuristic; private JRadioButton useHeuristic;
...@@ -66,7 +66,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent { ...@@ -66,7 +66,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent {
} }
searchLibButton = new JButton("POINT TO LIB"); searchLibButton = new JButton("POINT TO LIB");
modCostMapper = new ModificationCostMapper(); ecPanel = new EditCostPanel();
heuristicGroup = new ButtonGroup(); heuristicGroup = new ButtonGroup();
useILP = new JRadioButton("Use Integer Linear Programming"); useILP = new JRadioButton("Use Integer Linear Programming");
...@@ -116,7 +116,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent { ...@@ -116,7 +116,7 @@ public class MainPanel extends ComfortPanel implements CytoPanelComponent {
libStatusPanel, libStatusPanel,
yoshikoVersionLabel, yoshikoVersionLabel,
searchLibButton, searchLibButton,
modCostMapper, ecPanel,
useILP, useILP,
useHeuristic, useHeuristic,
timeLimitSetter, timeLimitSetter,
......
...@@ -37,7 +37,7 @@ public class ModificationCostMapper extends ComfortPanel { ...@@ -37,7 +37,7 @@ public class ModificationCostMapper extends ComfortPanel {
updateValues(); updateValues();
//Add a focus listener to update values //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 //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 @Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
......
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);
}
}
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
}
}
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;
}
}
/**
*
*/
package de.hhu.ba.yoshikoWrapper.logging;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment