Commit 17f1bf5b455a01174c1cb7c0829dfbeee4b33363
1 parent
6dd0d332
Exists in
master
Add a sorter to the table
Showing
3 changed files
with
12 additions
and
7 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIDim.java
@@ -27,7 +27,7 @@ public class GUIDim { | @@ -27,7 +27,7 @@ public class GUIDim { | ||
27 | public static final int LEFT_PANEL_WIDTH = 400; | 27 | public static final int LEFT_PANEL_WIDTH = 400; |
28 | 28 | ||
29 | /** The minimum width of the left panel (services view). */ | 29 | /** The minimum width of the left panel (services view). */ |
30 | - public static final int LEFT_PANEL_MIN_WIDTH = 150; | 30 | + public static final int LEFT_PANEL_MIN_WIDTH = 300; |
31 | 31 | ||
32 | /** The width of the right panel (request view). */ | 32 | /** The width of the right panel (request view). */ |
33 | public static final int RIGHT_PANEL_WIDTH = 400; | 33 | public static final int RIGHT_PANEL_WIDTH = 400; |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java
@@ -16,7 +16,6 @@ | @@ -16,7 +16,6 @@ | ||
16 | 16 | ||
17 | package eu.omp.irap.vespa.epntapclient.gui.panels; | 17 | package eu.omp.irap.vespa.epntapclient.gui.panels; |
18 | 18 | ||
19 | -import java.awt.BorderLayout; | ||
20 | import java.awt.event.ActionEvent; | 19 | import java.awt.event.ActionEvent; |
21 | import java.awt.event.ActionListener; | 20 | import java.awt.event.ActionListener; |
22 | 21 | ||
@@ -69,7 +68,7 @@ public class ServicesPanel extends VOTableView { | @@ -69,7 +68,7 @@ public class ServicesPanel extends VOTableView { | ||
69 | } | 68 | } |
70 | }); | 69 | }); |
71 | 70 | ||
72 | - this.add(buildAddServicePanel(), BorderLayout.SOUTH); | 71 | + this.add(buildAddServicePanel()); |
73 | } | 72 | } |
74 | 73 | ||
75 | private JPanel buildAddServicePanel() { | 74 | private JPanel buildAddServicePanel() { |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
@@ -16,16 +16,19 @@ | @@ -16,16 +16,19 @@ | ||
16 | 16 | ||
17 | package eu.omp.irap.vespa.epntapclient.votable.view; | 17 | package eu.omp.irap.vespa.epntapclient.votable.view; |
18 | 18 | ||
19 | -import java.awt.BorderLayout; | ||
20 | import java.util.List; | 19 | import java.util.List; |
21 | 20 | ||
21 | +import javax.swing.BoxLayout; | ||
22 | import javax.swing.JPanel; | 22 | import javax.swing.JPanel; |
23 | import javax.swing.JScrollPane; | 23 | import javax.swing.JScrollPane; |
24 | import javax.swing.JTable; | 24 | import javax.swing.JTable; |
25 | +import javax.swing.RowSorter; | ||
25 | import javax.swing.ScrollPaneConstants; | 26 | import javax.swing.ScrollPaneConstants; |
26 | import javax.swing.event.TableModelEvent; | 27 | import javax.swing.event.TableModelEvent; |
27 | import javax.swing.event.TableModelListener; | 28 | import javax.swing.event.TableModelListener; |
28 | import javax.swing.table.DefaultTableModel; | 29 | import javax.swing.table.DefaultTableModel; |
30 | +import javax.swing.table.TableModel; | ||
31 | +import javax.swing.table.TableRowSorter; | ||
29 | 32 | ||
30 | import eu.omp.irap.vespa.epntapclient.votable.utils.Utils; | 33 | import eu.omp.irap.vespa.epntapclient.votable.utils.Utils; |
31 | 34 | ||
@@ -68,13 +71,16 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -68,13 +71,16 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
68 | } | 71 | } |
69 | 72 | ||
70 | private void buildVOTableView() { | 73 | private void buildVOTableView() { |
71 | - JScrollPane scrollPane = new JScrollPane(table); | 74 | + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
75 | + | ||
76 | + RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableData); | ||
77 | + table.setRowSorter(sorter); | ||
72 | 78 | ||
79 | + JScrollPane scrollPane = new JScrollPane(table); | ||
73 | scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); | 80 | scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
74 | scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); | 81 | scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); |
75 | 82 | ||
76 | - setLayout(new BorderLayout()); | ||
77 | - add(scrollPane, BorderLayout.CENTER); | 83 | + add(scrollPane); |
78 | } | 84 | } |
79 | 85 | ||
80 | /** | 86 | /** |