diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java index bead31c..8719b8e 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/EpnTapMainView.java @@ -65,7 +65,7 @@ public class EpnTapMainView extends JPanel { resultsPanel = new ResultsPanel(viewListener, voTableResultsView); requestPanel = new RequestPanel(viewListener); bottomBarPanel = new BottomBarPanel(viewListener); - buildWindow(); + buildMainView(); } /** @@ -99,13 +99,13 @@ public class EpnTapMainView extends JPanel { /** * Build and fill the GUI. */ - public void buildWindow() { + private void buildMainView() { setLayout(new BorderLayout()); JSplitPane northPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, servicesPanel, requestPanel); - JSplitPane mainPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, northPanel, resultsPanel); + add(mainPanel, BorderLayout.CENTER); add(bottomBarPanel, BorderLayout.SOUTH); } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java index ff92b5e..a84f84e 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/ParamField.java @@ -109,13 +109,20 @@ public abstract class ParamField extends JPanel { this.viewListener = viewListener; this.paramName = paramName; + buildParamField(); + // TODO: Add tooltip text based on rr.table_column.column_description + } + + private void buildParamField() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); + setMaximumSize(new Dimension(ParamField.MAX_FIELD_WIDTH, ParamField.FIELD_HEIGHT)); + String strLabel = paramName.replaceAll("_", " ").trim(); JLabel label = new JLabel(strLabel.substring(0, 1).toUpperCase() + strLabel.substring(1)); label.setPreferredSize(new Dimension(ParamField.LABEL_WIDTH, ParamField.FIELD_HEIGHT)); + this.add(label); - // TODO: Add tooltip text based on rr.table_column.column_description } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java index a28176f..3eda154 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/BottomBarPanel.java @@ -38,6 +38,8 @@ public class BottomBarPanel extends JPanel { /** A label to display several informations (aka. status bar). */ private JLabel infoLabel; + private ViewListener viewListener; + /** * Method constructor for the bottom bar panel. @@ -45,9 +47,19 @@ public class BottomBarPanel extends JPanel { * @param mainView The main view of the application. */ public BottomBarPanel(final ViewListener viewListener) { + this.viewListener = viewListener; + buildBottomBarPanel(); + } + + private void buildBottomBarPanel() { setLayout(new BorderLayout()); + infoLabel = new JLabel(); this.add(infoLabel); + this.add(buildGetFileButton(), BorderLayout.EAST); + } + + private JButton buildGetFileButton() { JButton button = new JButton("Get File"); button.addActionListener(new ActionListener() { @@ -58,7 +70,7 @@ public class BottomBarPanel extends JPanel { viewListener.onDownloadButtonClicked(fc.getSelectedFile()); } }); - this.add(button, BorderLayout.EAST); + return button; } /** diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java index 6228489..6573e1a 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/RequestPanel.java @@ -69,7 +69,12 @@ public class RequestPanel extends JPanel { */ public RequestPanel(ViewListener viewListener) { this.viewListener = viewListener; + buildRequestPanel(); + } + + private void buildRequestPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + setPreferredSize(new Dimension(GUIDim.RIGHT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); setMinimumSize(new Dimension(GUIDim.RIGHT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java index fcb7c9b..f9eceb6 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java @@ -33,6 +33,8 @@ public class ResultsPanel extends JPanel { /** The serial version UID. */ private static final long serialVersionUID = 1L; + ViewListener viewListener; + /** * Method constructor which customize the result panel, but don't build it from scratch since @@ -43,13 +45,19 @@ public class ResultsPanel extends JPanel { */ public ResultsPanel(ViewListener viewListener, VOTableView voTableView) { super(); + this.viewListener = viewListener; + + buildResultPanel(voTableView); + } + private void buildResultPanel(VOTableView voTableView) { setLayout(new BorderLayout()); - this.add(voTableView); setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH + GUIDim.RIGHT_PANEL_WIDTH, GUIDim.BOTTOM_PANEL_HEIGHT)); setMinimumSize(new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH + GUIDim.RIGHT_PANEL_MIN_WIDTH, GUIDim.BOTTOM_PANEL_MIN_HEIGHT)); + + this.add(voTableView); } } diff --git a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java index 4847a62..21099ee 100644 --- a/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java +++ b/src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java @@ -21,7 +21,6 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; @@ -65,23 +64,17 @@ public class ServicesPanel extends JPanel { this.viewListener = viewListener; this.voTableView = voTableView; + buildServicesPanel(voTableView); + } + + private void buildServicesPanel(final VOTableView voTableView) { setLayout(new BorderLayout()); - this.add(voTableView, BorderLayout.NORTH); - JPanel testServicePenel = new JPanel(); - testServicePenel.setBorder(BorderFactory.createTitledBorder("Test service")); - 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()); - this.add(panelTemp, BorderLayout.CENTER); setPreferredSize(new Dimension(GUIDim.LEFT_PANEL_WIDTH, GUIDim.TOP_PANEL_HEIGHT)); setMinimumSize(new Dimension(GUIDim.LEFT_PANEL_MIN_WIDTH, GUIDim.TOP_PANEL_MIN_HEIGHT)); // TODO: Support multi-selection - this.voTableView.getTable().getSelectionModel() + voTableView.getTable().getSelectionModel() .addListSelectionListener(new ListSelectionListener() { @Override @@ -89,10 +82,24 @@ public class ServicesPanel extends JPanel { viewListener.onServiceSelected(voTableView.getTable().getSelectedRow()); } }); + + this.add(buildAddServicePanel(), BorderLayout.CENTER); + this.add(voTableView, BorderLayout.NORTH); + } + + 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; } /** - * + * What ? */ private JTextField getTableNameTextField() { if (tableNameTextField == null) { @@ -102,7 +109,7 @@ public class ServicesPanel extends JPanel { } /** - * + * What ? */ private JTextField getServiceUrlTextField() { if (serviceUrlTextField == null) { @@ -112,6 +119,8 @@ public class ServicesPanel extends JPanel { } /** + * What ? + * * @return */ private JButton getServiceButton() { -- libgit2 0.21.2