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 | 68 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
69 | 69 | frame.setContentPane(voTableView); |
70 | 70 | frame.setVisible(true); |
71 | - frame.setSize(800, 600); | |
71 | + frame.pack(); | |
72 | 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 | 83 | } |
84 | 84 | |
85 | 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 | 88 | servicesPanel.setMinimumSize( |
90 | 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 | 93 | requestPanel.setMinimumSize( |
101 | 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 | 24 | public class GUIDim { |
25 | 25 | |
26 | 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 | 29 | /** The minimum width of the left panel (services view). */ |
30 | 30 | public static final int LEFT_PANEL_MIN_WIDTH = 300; |
31 | 31 | |
32 | 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 | 35 | /** The minimum width of the right panel (request view). */ |
36 | 36 | public static final int RIGHT_PANEL_MIN_WIDTH = 220; |
37 | 37 | |
38 | 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 | 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 | 44 | /** The height of the bottom panel (result view). */ |
45 | 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 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.gui.panels; |
18 | 18 | |
19 | +import java.awt.BorderLayout; | |
19 | 20 | import java.awt.event.ActionEvent; |
20 | 21 | import java.awt.event.ActionListener; |
21 | 22 | |
... | ... | @@ -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 | 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 | 88 | */ |
88 | 89 | private JTextField getTableNameTextField() { |
89 | 90 | if (tableNameTextField == null) { |
90 | - tableNameTextField = new JTextField(20); | |
91 | + tableNameTextField = new JTextField(10); | |
91 | 92 | } |
92 | 93 | return tableNameTextField; |
93 | 94 | } |
... | ... | @@ -97,7 +98,7 @@ public class ServicesPanel extends VOTableView { |
97 | 98 | */ |
98 | 99 | private JTextField getServiceUrlTextField() { |
99 | 100 | if (serviceUrlTextField == null) { |
100 | - serviceUrlTextField = new JTextField(20); | |
101 | + serviceUrlTextField = new JTextField(10); | |
101 | 102 | } |
102 | 103 | return serviceUrlTextField; |
103 | 104 | } | ... | ... |
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
... | ... | @@ -16,13 +16,12 @@ |
16 | 16 | |
17 | 17 | package eu.omp.irap.vespa.epntapclient.votable.view; |
18 | 18 | |
19 | +import java.awt.BorderLayout; | |
19 | 20 | import java.util.List; |
20 | 21 | |
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; | |
26 | 25 | import javax.swing.ScrollPaneConstants; |
27 | 26 | import javax.swing.event.TableModelEvent; |
28 | 27 | import javax.swing.event.TableModelListener; |
... | ... | @@ -71,16 +70,13 @@ public class VOTableView extends JPanel implements TableModelListener { |
71 | 70 | } |
72 | 71 | |
73 | 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 | 86 | * @param data The VoTable data displayed on the JTable |
91 | 87 | */ |
92 | 88 | public void fillTable(String[] columns, List<Object[]> data) { |
93 | - System.out.println(columns + "\n" + data); | |
94 | 89 | Object[][] values = data.toArray(new Object[data.size()][]); |
95 | 90 | Utils.printObject("tableColumns", columns); |
96 | 91 | Utils.printObject("tableData", values); |
... | ... | @@ -98,6 +93,9 @@ public class VOTableView extends JPanel implements TableModelListener { |
98 | 93 | if (values.length != 0) { |
99 | 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 | /** | ... | ... |