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

Sort clusters in solution by size

parent a9abb478
No related branches found
No related tags found
No related merge requests found
...@@ -24,8 +24,8 @@ package de.hhu.ba.yoshikoWrapper.swing.components; ...@@ -24,8 +24,8 @@ package de.hhu.ba.yoshikoWrapper.swing.components;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Comparator;
import javax.swing.Box;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
...@@ -55,11 +55,28 @@ public class SolutionTab extends JPanel { ...@@ -55,11 +55,28 @@ public class SolutionTab extends JPanel {
//init swing components //init swing components
scrollPaneContent = new JPanel(); scrollPaneContent = new JPanel();
scrollPaneContent.setLayout(new BoxLayout(scrollPaneContent,BoxLayout.Y_AXIS)); scrollPaneContent.setLayout(new BoxLayout(scrollPaneContent,BoxLayout.Y_AXIS));
//Sort cluster by size, descending
solution.cluster.sort(new Comparator<YoshikoCluster>() {
@Override
public int compare(YoshikoCluster o1, YoshikoCluster o2) {
if (o1.getSize() == o2.getSize()) {
return 0;
}
else if(o1.getSize() < o2.getSize()) {
return 1;
}
return -1;
}
});
for (YoshikoCluster c: solution.cluster) { for (YoshikoCluster c: solution.cluster) {
ClusterView clusterView = new ClusterView(c); ClusterView clusterView = new ClusterView(c);
scrollPaneContent.add(clusterView); scrollPaneContent.add(clusterView);
scrollPaneContent.add(Box.createVerticalStrut(8));
} }
scrollPane = new JScrollPane(scrollPaneContent); scrollPane = new JScrollPane(scrollPaneContent);
scrollPane.setPreferredSize(new Dimension(150,400)); scrollPane.setPreferredSize(new Dimension(150,400));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
text width=5em, text centered, rounded corners, minimum height=4em] text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex'] \tikzstyle{line} = [draw, -latex']
\begin{figure} \begin{figure}[h]
\begin{tikzpicture}[node distance = 1cm] \begin{tikzpicture}[node distance = 1cm]
\node [block] (datamodel) {Data Modeling}; \node [block] (datamodel) {Data Modeling};
......
No preview for this file type
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{tikz} \usepackage{tikz}
\usepackage{verbatim} \usepackage{verbatim}
\usepackage{float}
\usetikzlibrary{shapes,arrows} \usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning} \usetikzlibrary{positioning}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment