From 89e0ae9a45e87a5cdba6484ad58e37665c60ed77 Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Mon, 14 Mar 2016 17:35:01 +0100 Subject: [PATCH] Move JTable listener in ServicesPanel --- src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java | 2 -- src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java | 5 ++--- src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java | 8 ++++---- 3 files changed, 6 insertions(+), 9 deletions(-) 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 9c66a7d..ee09a82 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 @@ -34,13 +34,11 @@ public class ResultsPanel extends JPanel { private static final long serialVersionUID = -3387526562625069156L; /** The logger for the class ResultPanel. */ - @SuppressWarnings("unused") private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); @SuppressWarnings("unused") private EpnTapMainView mainView; - @SuppressWarnings("unused") private VOTableView voTableView; public ResultsPanel(EpnTapMainView mainView, VOTableView 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 b20cfc9..d231ec7 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 @@ -40,7 +40,6 @@ public class ServicesPanel extends JPanel { @SuppressWarnings("unused") private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); - @SuppressWarnings("unused") private EpnTapMainView mainView; private VOTableView voTableView; @@ -49,7 +48,6 @@ public class ServicesPanel extends JPanel { super(); this.mainView = mainView; this.voTableView = voTableView; - this.setLayout(new BorderLayout()); this.add(voTableView); @@ -57,7 +55,7 @@ public class ServicesPanel extends JPanel { setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT)); // TODO: Support multi-selection - voTableView.getTable().getSelectionModel() + this.voTableView.getTable().getSelectionModel() .addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { @@ -65,6 +63,7 @@ public class ServicesPanel extends JPanel { voTableView.getTable().getSelectedRow()); } }); + } public String getServiceURL(int row) { 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 f015b88..65a775c 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 @@ -37,17 +37,17 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils; */ public class VOTableView extends JPanel implements TableModelListener { /** The logger for the class VOTableView. */ - private static final Logger logger = Logger.getLogger(VOTableView.class.getName()); + static final Logger logger = Logger.getLogger(VOTableView.class.getName()); // TODO: Create classes VOTableGUI and VOTableCLI which implements an interface VOTableView /** The serial version UID (affected with a random number). */ private static final long serialVersionUID = -6131752938586134234L; /** The JTable component where the data are displayed. */ - private JTable table; + JTable table; /** The DataModel representing the VOTable data in the JTable element. */ - DefaultTableModel tableData; + private DefaultTableModel tableData; /** * Method constructor @@ -64,6 +64,7 @@ public class VOTableView extends JPanel implements TableModelListener { }; table = new JTable(tableData); + JScrollPane scrollPane = new JScrollPane(table); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); @@ -100,7 +101,6 @@ public class VOTableView extends JPanel implements TableModelListener { * content. */ public Object getValueAt(int column, int row) { - Object val = tableData.getValueAt(row, column); return tableData.getValueAt(row, column); } -- libgit2 0.21.2