Commit 3bb7f0aa7afaec429a0742d19b3a0a8686709879
1 parent
17f1bf5b
Exists in
master
Improve GUI
Showing
5 changed files
with
36 additions
and
40 deletions
Show diff stats
src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java
@@ -68,7 +68,7 @@ public class EpnTapMainApp { | @@ -68,7 +68,7 @@ public class EpnTapMainApp { | ||
68 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | 68 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
69 | frame.setContentPane(voTableView); | 69 | frame.setContentPane(voTableView); |
70 | frame.setVisible(true); | 70 | frame.setVisible(true); |
71 | - frame.setSize(800, 600); | 71 | + frame.pack(); |
72 | frame.setLocationRelativeTo(null); | 72 | frame.setLocationRelativeTo(null); |
73 | } | 73 | } |
74 | }; | 74 | }; |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java
@@ -83,25 +83,22 @@ public class EpnTapMainView extends JPanel { | @@ -83,25 +83,22 @@ public class EpnTapMainView extends JPanel { | ||
83 | } | 83 | } |
84 | 84 | ||
85 | private void setSizes() { | 85 | private void setSizes() { |
86 | - | ||
87 | - servicesPanel | ||
88 | - .setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); | 86 | + servicesPanel.setPreferredSize( |
87 | + new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); | ||
89 | servicesPanel.setMinimumSize( | 88 | servicesPanel.setMinimumSize( |
90 | new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); | 89 | new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); |
91 | - resultsPanel | ||
92 | - .setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH + GUIDim.RIGHT_PANEL_WIDTH, | ||
93 | - GUIDim.BOTTOM_PANEL_HEIGHT)); | ||
94 | - resultsPanel.setMinimumSize( | ||
95 | - new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, | ||
96 | - GUIDim.BOTTOM_PANEL_MIN_HEIGHT)); | ||
97 | 90 | ||
98 | - requestPanel | ||
99 | - .setPreferredSize(new Dimension(GUIDim.RIGHT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); | 91 | + requestPanel.setPreferredSize( |
92 | + new Dimension(GUIDim.RIGHT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); | ||
100 | requestPanel.setMinimumSize( | 93 | requestPanel.setMinimumSize( |
101 | new Dimension(GUIDim.RIGHT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); | 94 | new Dimension(GUIDim.RIGHT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); |
102 | 95 | ||
103 | - // bottomBarPanel.setPreferredSize | ||
104 | - // bottomBarPanel.setMinimumSize | 96 | + resultsPanel.setPreferredSize( |
97 | + new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, | ||
98 | + GUIDim.BOTTOM_PANEL_HEIGHT)); | ||
99 | + resultsPanel.setMinimumSize( | ||
100 | + new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, | ||
101 | + GUIDim.BOTTOM_PANEL_MIN_HEIGHT)); | ||
105 | } | 102 | } |
106 | 103 | ||
107 | /** | 104 | /** |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIDim.java
@@ -24,22 +24,22 @@ package eu.omp.irap.vespa.epntapclient.gui; | @@ -24,22 +24,22 @@ package eu.omp.irap.vespa.epntapclient.gui; | ||
24 | public class GUIDim { | 24 | public class GUIDim { |
25 | 25 | ||
26 | /** The width of the left panel (services view). */ | 26 | /** The width of the left panel (services view). */ |
27 | - public static final int LEFT_PANEL_WIDTH = 400; | 27 | + public static final int LEFT_PANEL_WIDTH = 550; |
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 = 300; | 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 = 450; |
34 | 34 | ||
35 | /** The minimum width of the right panel (request view). */ | 35 | /** The minimum width of the right panel (request view). */ |
36 | public static final int RIGHT_PANEL_MIN_WIDTH = 220; | 36 | public static final int RIGHT_PANEL_MIN_WIDTH = 220; |
37 | 37 | ||
38 | /** The height of the top panel (request view and services view). */ | 38 | /** The height of the top panel (request view and services view). */ |
39 | - public static final int TOP_PANEL_HEIGHT = 250; | 39 | + public static final int TOP_PANEL_HEIGHT = 400; |
40 | 40 | ||
41 | /** The minimum height of the top panel (request view and services view). */ | 41 | /** The minimum height of the top panel (request view and services view). */ |
42 | - public static final int TOP_PANEL_MIN_HEIGHT = 190; | 42 | + public static final int TOP_PANEL_MIN_HEIGHT = 100; |
43 | 43 | ||
44 | /** The height of the bottom panel (result view). */ | 44 | /** The height of the bottom panel (result view). */ |
45 | public static final int BOTTOM_PANEL_HEIGHT = 150; | 45 | public static final int BOTTOM_PANEL_HEIGHT = 150; |
src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java
@@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
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; | ||
19 | import java.awt.event.ActionEvent; | 20 | import java.awt.event.ActionEvent; |
20 | import java.awt.event.ActionListener; | 21 | import java.awt.event.ActionListener; |
21 | 22 | ||
@@ -68,18 +69,18 @@ public class ServicesPanel extends VOTableView { | @@ -68,18 +69,18 @@ public class ServicesPanel extends VOTableView { | ||
68 | } | 69 | } |
69 | }); | 70 | }); |
70 | 71 | ||
71 | - this.add(buildAddServicePanel()); | 72 | + add(buildAddServicePanel(), BorderLayout.SOUTH); |
72 | } | 73 | } |
73 | 74 | ||
74 | private JPanel buildAddServicePanel() { | 75 | private JPanel buildAddServicePanel() { |
75 | - JPanel panelTemp = new JPanel(); | ||
76 | - panelTemp.add(new JLabel("Service URL")); | ||
77 | - panelTemp.add(getServiceUrlTextField()); | ||
78 | - panelTemp.add(new JLabel("Table name")); | ||
79 | - panelTemp.add(getTableNameTextField()); | ||
80 | - panelTemp.add(getServiceButton()); | ||
81 | - | ||
82 | - return panelTemp; | 76 | + JPanel addServicePanel = new JPanel(); |
77 | + addServicePanel.add(new JLabel("Service URL")); | ||
78 | + addServicePanel.add(getServiceUrlTextField()); | ||
79 | + addServicePanel.add(new JLabel("Table name")); | ||
80 | + addServicePanel.add(getTableNameTextField()); | ||
81 | + addServicePanel.add(getServiceButton()); | ||
82 | + | ||
83 | + return addServicePanel; | ||
83 | } | 84 | } |
84 | 85 | ||
85 | /** | 86 | /** |
@@ -87,7 +88,7 @@ public class ServicesPanel extends VOTableView { | @@ -87,7 +88,7 @@ public class ServicesPanel extends VOTableView { | ||
87 | */ | 88 | */ |
88 | private JTextField getTableNameTextField() { | 89 | private JTextField getTableNameTextField() { |
89 | if (tableNameTextField == null) { | 90 | if (tableNameTextField == null) { |
90 | - tableNameTextField = new JTextField(20); | 91 | + tableNameTextField = new JTextField(10); |
91 | } | 92 | } |
92 | return tableNameTextField; | 93 | return tableNameTextField; |
93 | } | 94 | } |
@@ -97,7 +98,7 @@ public class ServicesPanel extends VOTableView { | @@ -97,7 +98,7 @@ public class ServicesPanel extends VOTableView { | ||
97 | */ | 98 | */ |
98 | private JTextField getServiceUrlTextField() { | 99 | private JTextField getServiceUrlTextField() { |
99 | if (serviceUrlTextField == null) { | 100 | if (serviceUrlTextField == null) { |
100 | - serviceUrlTextField = new JTextField(20); | 101 | + serviceUrlTextField = new JTextField(10); |
101 | } | 102 | } |
102 | return serviceUrlTextField; | 103 | return serviceUrlTextField; |
103 | } | 104 | } |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
@@ -16,13 +16,12 @@ | @@ -16,13 +16,12 @@ | ||
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; | ||
19 | import java.util.List; | 20 | import java.util.List; |
20 | 21 | ||
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; | ||
26 | import javax.swing.ScrollPaneConstants; | 25 | import javax.swing.ScrollPaneConstants; |
27 | import javax.swing.event.TableModelEvent; | 26 | import javax.swing.event.TableModelEvent; |
28 | import javax.swing.event.TableModelListener; | 27 | import javax.swing.event.TableModelListener; |
@@ -71,16 +70,13 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -71,16 +70,13 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
71 | } | 70 | } |
72 | 71 | ||
73 | private void buildVOTableView() { | 72 | private void buildVOTableView() { |
74 | - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); | 73 | + setLayout(new BorderLayout()); |
75 | 74 | ||
76 | - RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableData); | ||
77 | - table.setRowSorter(sorter); | 75 | + table.setRowSorter(new TableRowSorter<TableModel>(tableData)); |
78 | 76 | ||
79 | - JScrollPane scrollPane = new JScrollPane(table); | ||
80 | - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); | ||
81 | - scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); | ||
82 | - | ||
83 | - add(scrollPane); | 77 | + add(new JScrollPane(table, |
78 | + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, | ||
79 | + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); | ||
84 | } | 80 | } |
85 | 81 | ||
86 | /** | 82 | /** |
@@ -90,7 +86,6 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -90,7 +86,6 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
90 | * @param data The VoTable data displayed on the JTable | 86 | * @param data The VoTable data displayed on the JTable |
91 | */ | 87 | */ |
92 | public void fillTable(String[] columns, List<Object[]> data) { | 88 | public void fillTable(String[] columns, List<Object[]> data) { |
93 | - System.out.println(columns + "\n" + data); | ||
94 | Object[][] values = data.toArray(new Object[data.size()][]); | 89 | Object[][] values = data.toArray(new Object[data.size()][]); |
95 | Utils.printObject("tableColumns", columns); | 90 | Utils.printObject("tableColumns", columns); |
96 | Utils.printObject("tableData", values); | 91 | Utils.printObject("tableData", values); |
@@ -98,6 +93,9 @@ public class VOTableView extends JPanel implements TableModelListener { | @@ -98,6 +93,9 @@ public class VOTableView extends JPanel implements TableModelListener { | ||
98 | if (values.length != 0) { | 93 | if (values.length != 0) { |
99 | table.setRowSelectionInterval(0, 0); | 94 | table.setRowSelectionInterval(0, 0); |
100 | } | 95 | } |
96 | + if (columns.length >= 10) { | ||
97 | + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); | ||
98 | + } | ||
101 | } | 99 | } |
102 | 100 | ||
103 | /** | 101 | /** |