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 | 27 | public static final int LEFT_PANEL_WIDTH = 400; |
28 | 28 | |
29 | 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 | 32 | /** The width of the right panel (request view). */ |
33 | 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 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.gui.panels; |
18 | 18 | |
19 | -import java.awt.BorderLayout; | |
20 | 19 | import java.awt.event.ActionEvent; |
21 | 20 | import java.awt.event.ActionListener; |
22 | 21 | |
... | ... | @@ -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 | 74 | private JPanel buildAddServicePanel() { | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
... | ... | @@ -16,16 +16,19 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.votable.view; |
18 | 18 | |
19 | -import java.awt.BorderLayout; | |
20 | 19 | import java.util.List; |
21 | 20 | |
21 | +import javax.swing.BoxLayout; | |
22 | 22 | import javax.swing.JPanel; |
23 | 23 | import javax.swing.JScrollPane; |
24 | 24 | import javax.swing.JTable; |
25 | +import javax.swing.RowSorter; | |
25 | 26 | import javax.swing.ScrollPaneConstants; |
26 | 27 | import javax.swing.event.TableModelEvent; |
27 | 28 | import javax.swing.event.TableModelListener; |
28 | 29 | import javax.swing.table.DefaultTableModel; |
30 | +import javax.swing.table.TableModel; | |
31 | +import javax.swing.table.TableRowSorter; | |
29 | 32 | |
30 | 33 | import eu.omp.irap.vespa.epntapclient.votable.utils.Utils; |
31 | 34 | |
... | ... | @@ -68,13 +71,16 @@ public class VOTableView extends JPanel implements TableModelListener { |
68 | 71 | } |
69 | 72 | |
70 | 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 | 80 | scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
74 | 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 | /** | ... | ... |