diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java index abc5a7f..9cf1c71 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/EpnTapMainApp.java @@ -68,7 +68,7 @@ public class EpnTapMainApp { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(voTableView); frame.setVisible(true); - frame.setSize(800, 600); + frame.pack(); frame.setLocationRelativeTo(null); } }; diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java index d44c818..626ee2a 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/EpnTapMainView.java @@ -83,25 +83,22 @@ public class EpnTapMainView extends JPanel { } private void setSizes() { - - servicesPanel - .setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); + servicesPanel.setPreferredSize( + new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); servicesPanel.setMinimumSize( new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); - resultsPanel - .setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH + GUIDim.RIGHT_PANEL_WIDTH, - GUIDim.BOTTOM_PANEL_HEIGHT)); - resultsPanel.setMinimumSize( - new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, - GUIDim.BOTTOM_PANEL_MIN_HEIGHT)); - requestPanel - .setPreferredSize(new Dimension(GUIDim.RIGHT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); + requestPanel.setPreferredSize( + new Dimension(GUIDim.RIGHT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); requestPanel.setMinimumSize( new Dimension(GUIDim.RIGHT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); - // bottomBarPanel.setPreferredSize - // bottomBarPanel.setMinimumSize + resultsPanel.setPreferredSize( + new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, + GUIDim.BOTTOM_PANEL_HEIGHT)); + resultsPanel.setMinimumSize( + new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, + GUIDim.BOTTOM_PANEL_MIN_HEIGHT)); } /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIDim.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIDim.java index d650cf0..4823552 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIDim.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/GUIDim.java @@ -24,22 +24,22 @@ package eu.omp.irap.vespa.epntapclient.gui; public class GUIDim { /** The width of the left panel (services view). */ - public static final int LEFT_PANEL_WIDTH = 400; + public static final int LEFT_PANEL_WIDTH = 550; /** The minimum width of the left panel (services view). */ public static final int LEFT_PANEL_MIN_WIDTH = 300; /** The width of the right panel (request view). */ - public static final int RIGHT_PANEL_WIDTH = 400; + public static final int RIGHT_PANEL_WIDTH = 450; /** The minimum width of the right panel (request view). */ public static final int RIGHT_PANEL_MIN_WIDTH = 220; /** The height of the top panel (request view and services view). */ - public static final int TOP_PANEL_HEIGHT = 250; + public static final int TOP_PANEL_HEIGHT = 400; /** The minimum height of the top panel (request view and services view). */ - public static final int TOP_PANEL_MIN_HEIGHT = 190; + public static final int TOP_PANEL_MIN_HEIGHT = 100; /** The height of the bottom panel (result view). */ public static final int BOTTOM_PANEL_HEIGHT = 150; diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java index bd0c8b9..8de262f 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/gui/panels/ServicesPanel.java @@ -16,6 +16,7 @@ package eu.omp.irap.vespa.epntapclient.gui.panels; +import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -68,18 +69,18 @@ public class ServicesPanel extends VOTableView { } }); - this.add(buildAddServicePanel()); + add(buildAddServicePanel(), BorderLayout.SOUTH); } private JPanel buildAddServicePanel() { - JPanel panelTemp = new JPanel(); - panelTemp.add(new JLabel("Service URL")); - panelTemp.add(getServiceUrlTextField()); - panelTemp.add(new JLabel("Table name")); - panelTemp.add(getTableNameTextField()); - panelTemp.add(getServiceButton()); - - return panelTemp; + JPanel addServicePanel = new JPanel(); + addServicePanel.add(new JLabel("Service URL")); + addServicePanel.add(getServiceUrlTextField()); + addServicePanel.add(new JLabel("Table name")); + addServicePanel.add(getTableNameTextField()); + addServicePanel.add(getServiceButton()); + + return addServicePanel; } /** @@ -87,7 +88,7 @@ public class ServicesPanel extends VOTableView { */ private JTextField getTableNameTextField() { if (tableNameTextField == null) { - tableNameTextField = new JTextField(20); + tableNameTextField = new JTextField(10); } return tableNameTextField; } @@ -97,7 +98,7 @@ public class ServicesPanel extends VOTableView { */ private JTextField getServiceUrlTextField() { if (serviceUrlTextField == null) { - serviceUrlTextField = new JTextField(20); + serviceUrlTextField = new JTextField(10); } return serviceUrlTextField; } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java index 35b9c97..db1b5da 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java @@ -16,13 +16,12 @@ package eu.omp.irap.vespa.epntapclient.votable.view; +import java.awt.BorderLayout; import java.util.List; -import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; -import javax.swing.RowSorter; import javax.swing.ScrollPaneConstants; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; @@ -71,16 +70,13 @@ public class VOTableView extends JPanel implements TableModelListener { } private void buildVOTableView() { - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + setLayout(new BorderLayout()); - RowSorter sorter = new TableRowSorter(tableData); - table.setRowSorter(sorter); + table.setRowSorter(new TableRowSorter(tableData)); - JScrollPane scrollPane = new JScrollPane(table); - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); - - add(scrollPane); + add(new JScrollPane(table, + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); } /** @@ -90,7 +86,6 @@ public class VOTableView extends JPanel implements TableModelListener { * @param data The VoTable data displayed on the JTable */ public void fillTable(String[] columns, List data) { - System.out.println(columns + "\n" + data); Object[][] values = data.toArray(new Object[data.size()][]); Utils.printObject("tableColumns", columns); Utils.printObject("tableData", values); @@ -98,6 +93,9 @@ public class VOTableView extends JPanel implements TableModelListener { if (values.length != 0) { table.setRowSelectionInterval(0, 0); } + if (columns.length >= 10) { + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + } } /** -- libgit2 0.21.2