Commit 80a9cd87 authored by Philipp Spohr's avatar Philipp Spohr
Browse files

minor fixes

parent b2b1c705
......@@ -38,10 +38,6 @@ import org.cytoscape.model.subnetwork.CySubNetwork;
import org.cytoscape.view.layout.CyLayoutAlgorithm;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.presentation.RenderingEngine;
import org.cytoscape.work.FinishStatus;
import org.cytoscape.work.ObservableTask;
import org.cytoscape.work.TaskIterator;
import org.cytoscape.work.TaskObserver;
import org.slf4j.Logger;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
......@@ -201,7 +197,4 @@ public class YoshikoCluster {
}
}
......@@ -42,7 +42,6 @@ import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster;
import de.hhu.ba.yoshikoWrapper.swing.GraphicsLoader;
import de.hhu.ba.yoshikoWrapper.swing.SwingUtil;
import de.hhu.ba.yoshikoWrapper.tasks.AlgorithmTask;
@SuppressWarnings("serial")
public class ClusterView extends JPanel {
......
/*******************************************************************************
* Copyright (C) 2017 Philipp Spohr
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
......@@ -39,7 +39,7 @@ import javax.swing.GroupLayout.Alignment;
@SuppressWarnings("serial")
public class OperationModePanel extends JPanel{
//SWING COMPONENTS
private final JRadioButton useHeuristic;
private final JRadioButton useILP;
......@@ -48,36 +48,39 @@ public class OperationModePanel extends JPanel{
private final JCheckBox useTriangleCutsBox;
private final JCheckBox usePartitionCutsBox;
private final JCheckBox disableMultiThreading;
private final ButtonGroup heuristicGroup;
public OperationModePanel() {
heuristicGroup = new ButtonGroup();
useILP = new JRadioButton("Use Integer Linear Programming");
useILP.setSelected(true);
useILP = new JRadioButton("Use Integer Linear Programming");
useHeuristic = new JRadioButton("Use Heuristic");
//As a default option we use the heuristic -> faster and usually good @Bachelor's Thesis //TODO: Save this as config?
useHeuristic.setSelected(true);
heuristicGroup.add(useILP);
heuristicGroup.add(useHeuristic);
solutionNumberChooser = new SolutionNumberChooser();
timeLimitSetter = new TimeLimitSetter();
useTriangleCutsBox = new JCheckBox("Use Triangle Cuts");
usePartitionCutsBox = new JCheckBox("Use Partition Cuts");
disableMultiThreading = new JCheckBox(LocalizationManager.get("disableMultiThreading"));
disableMultiThreading.setSelected(true);
//Link time limit option to ILP
useILP.addActionListener(ilpHeuristicSwitch);
useHeuristic.addActionListener(ilpHeuristicSwitch);
SwingUtil.addAll(this,
useILP,
useHeuristic,
useILP,
solutionNumberChooser,
timeLimitSetter,
useTriangleCutsBox,
......@@ -85,55 +88,62 @@ public class OperationModePanel extends JPanel{
disableMultiThreading
);
//We set all components to enabled/disabled according to mode
ilpHeuristicSwitch();
//Layout
GroupLayout layout = new GroupLayout(this);
layout.setAutoCreateContainerGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING,true)
.addComponent(useILP, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useHeuristic, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useILP, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(solutionNumberChooser, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(timeLimitSetter, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(useTriangleCutsBox, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(usePartitionCutsBox, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(disableMultiThreading, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(useILP)
.addComponent(useHeuristic)
.addComponent(useILP)
.addComponent(solutionNumberChooser)
.addComponent(timeLimitSetter)
.addComponent(useTriangleCutsBox)
.addComponent(usePartitionCutsBox)
.addComponent(disableMultiThreading)
);
this.setLayout(layout);
}
private void ilpHeuristicSwitch() {
if (useILP.isSelected()) {
timeLimitSetter.setEnabled(true);
useTriangleCutsBox.setEnabled(true);
usePartitionCutsBox.setEnabled(true);
solutionNumberChooser.setEnabled(true);
disableMultiThreading.setEnabled(true);
}
else {
timeLimitSetter.setEnabled(false);
useTriangleCutsBox.setEnabled(false);
usePartitionCutsBox.setEnabled(false);
solutionNumberChooser.setEnabled(false);
disableMultiThreading.setEnabled(false);
}
}
ActionListener ilpHeuristicSwitch = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (useILP.isSelected()) {
timeLimitSetter.setEnabled(true);
useTriangleCutsBox.setEnabled(true);
usePartitionCutsBox.setEnabled(true);
solutionNumberChooser.setEnabled(true);
disableMultiThreading.setEnabled(true);
}
else {
timeLimitSetter.setEnabled(false);
useTriangleCutsBox.setEnabled(false);
usePartitionCutsBox.setEnabled(false);
solutionNumberChooser.setEnabled(false);
disableMultiThreading.setEnabled(false);
}
}
ilpHeuristicSwitch();
}
};
//SETTER GETTER
public int getTimeLimit() {
......@@ -151,7 +161,7 @@ public class OperationModePanel extends JPanel{
public boolean useHeuristic() {
return useHeuristic.isSelected();
}
public boolean isMultiThreadingDisabled() {
return disableMultiThreading.isSelected();
}
......
......@@ -25,7 +25,6 @@ import static javax.swing.GroupLayout.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
......
......@@ -22,9 +22,9 @@
package de.hhu.ba.yoshikoWrapper.swing.components;
import static javax.swing.GroupLayout.DEFAULT_SIZE;
import static javax.swing.GroupLayout.PREFERRED_SIZE;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
......@@ -41,18 +41,15 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.cytoscape.work.TaskIterator;
import com.sun.media.jfxmedia.logging.Logger;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoCluster;
import de.hhu.ba.yoshikoWrapper.graphModel.YoshikoSolution;
import de.hhu.ba.yoshikoWrapper.logging.YoshikoLogger;
import de.hhu.ba.yoshikoWrapper.swing.SwingUtil;
import de.hhu.ba.yoshikoWrapper.tasks.CreateClusterViews;
import de.hhu.ba.yoshikoWrapper.tasks.CreateMetaGraphTask;
......@@ -116,11 +113,15 @@ public class SolutionTab extends JPanel {
//Declaration of Swing Components
clusterViewList = new ClusterViewList();
//Build CV list
for (YoshikoCluster c: solution.clusters) {
ClusterView clusterView = new ClusterView(c);
clusterViewList.add(clusterView);
}
//Apply default visibility (Hide singles)
clusterViewList.toggleSingleVisibility(false);
scrollPane = new JScrollPane(clusterViewList);
clusterCount = new JLabel(LocalizationManager.get("clusterFound")+" "+s.clusters.size());
......@@ -200,12 +201,12 @@ public class SolutionTab extends JPanel {
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER,true)
.addGap(8)
.addComponent(clusterCount,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(hideSingles,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(clusterCount,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE)
.addComponent(hideSingles,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE)
.addGap(8)
.addComponent(scrollPane,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE)
.addComponent(createClusterView,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(createMetaGraph,DEFAULT_SIZE,DEFAULT_SIZE,DEFAULT_SIZE)
.addComponent(scrollPane,PREFERRED_SIZE,PREFERRED_SIZE,Short.MAX_VALUE)
.addComponent(createClusterView,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE)
.addComponent(createMetaGraph,DEFAULT_SIZE,DEFAULT_SIZE,Short.MAX_VALUE)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addGap(8)
......
......@@ -225,6 +225,7 @@ public class AlgorithmTask extends AbstractTask {
eastPanel.setSelectedIndex(eastPanel.indexOfComponent(resultPanel));
//Show (might be invisible)
eastPanel.setState(CytoPanelState.DOCK);
//eastPanel.getThisComponent().revalidate();
}
......
......@@ -3,8 +3,6 @@ package de.hhu.ba.yoshikoWrapper.tasks;
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.SwingUtilities;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
......@@ -13,11 +11,7 @@ import org.cytoscape.model.subnetwork.CySubNetwork;
import org.cytoscape.view.layout.CyLayoutAlgorithm;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.FinishStatus;
import org.cytoscape.work.ObservableTask;
import org.cytoscape.work.Task;
import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.TaskObserver;
import de.hhu.ba.yoshikoWrapper.core.CyCore;
import de.hhu.ba.yoshikoWrapper.core.LocalizationManager;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment