Commit 89e0ae9a45e87a5cdba6484ad58e37665c60ed77

Authored by Nathanael Jourdane
1 parent 77184f22
Exists in master

Move JTable listener in ServicesPanel

src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java
@@ -34,13 +34,11 @@ public class ResultsPanel extends JPanel { @@ -34,13 +34,11 @@ public class ResultsPanel extends JPanel {
34 private static final long serialVersionUID = -3387526562625069156L; 34 private static final long serialVersionUID = -3387526562625069156L;
35 35
36 /** The logger for the class ResultPanel. */ 36 /** The logger for the class ResultPanel. */
37 - @SuppressWarnings("unused")  
38 private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName()); 37 private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName());
39 38
40 @SuppressWarnings("unused") 39 @SuppressWarnings("unused")
41 private EpnTapMainView mainView; 40 private EpnTapMainView mainView;
42 41
43 - @SuppressWarnings("unused")  
44 private VOTableView voTableView; 42 private VOTableView voTableView;
45 43
46 public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) { 44 public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) {
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java
@@ -40,7 +40,6 @@ public class ServicesPanel extends JPanel { @@ -40,7 +40,6 @@ public class ServicesPanel extends JPanel {
40 @SuppressWarnings("unused") 40 @SuppressWarnings("unused")
41 private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName()); 41 private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName());
42 42
43 - @SuppressWarnings("unused")  
44 private EpnTapMainView mainView; 43 private EpnTapMainView mainView;
45 44
46 private VOTableView voTableView; 45 private VOTableView voTableView;
@@ -49,7 +48,6 @@ public class ServicesPanel extends JPanel { @@ -49,7 +48,6 @@ public class ServicesPanel extends JPanel {
49 super(); 48 super();
50 this.mainView = mainView; 49 this.mainView = mainView;
51 this.voTableView = voTableView; 50 this.voTableView = voTableView;
52 -  
53 this.setLayout(new BorderLayout()); 51 this.setLayout(new BorderLayout());
54 this.add(voTableView); 52 this.add(voTableView);
55 53
@@ -57,7 +55,7 @@ public class ServicesPanel extends JPanel { @@ -57,7 +55,7 @@ public class ServicesPanel extends JPanel {
57 setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT)); 55 setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT));
58 56
59 // TODO: Support multi-selection 57 // TODO: Support multi-selection
60 - voTableView.getTable().getSelectionModel() 58 + this.voTableView.getTable().getSelectionModel()
61 .addListSelectionListener(new ListSelectionListener() { 59 .addListSelectionListener(new ListSelectionListener() {
62 @Override 60 @Override
63 public void valueChanged(ListSelectionEvent evt) { 61 public void valueChanged(ListSelectionEvent evt) {
@@ -65,6 +63,7 @@ public class ServicesPanel extends JPanel { @@ -65,6 +63,7 @@ public class ServicesPanel extends JPanel {
65 voTableView.getTable().getSelectedRow()); 63 voTableView.getTable().getSelectedRow());
66 } 64 }
67 }); 65 });
  66 +
68 } 67 }
69 68
70 public String getServiceURL(int row) { 69 public String getServiceURL(int row) {
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
@@ -37,17 +37,17 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils; @@ -37,17 +37,17 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils;
37 */ 37 */
38 public class VOTableView extends JPanel implements TableModelListener { 38 public class VOTableView extends JPanel implements TableModelListener {
39 /** The logger for the class VOTableView. */ 39 /** The logger for the class VOTableView. */
40 - private static final Logger logger = Logger.getLogger(VOTableView.class.getName()); 40 + static final Logger logger = Logger.getLogger(VOTableView.class.getName());
41 41
42 // TODO: Create classes VOTableGUI and VOTableCLI which implements an interface VOTableView 42 // TODO: Create classes VOTableGUI and VOTableCLI which implements an interface VOTableView
43 /** The serial version UID (affected with a random number). */ 43 /** The serial version UID (affected with a random number). */
44 private static final long serialVersionUID = -6131752938586134234L; 44 private static final long serialVersionUID = -6131752938586134234L;
45 45
46 /** The JTable component where the data are displayed. */ 46 /** The JTable component where the data are displayed. */
47 - private JTable table; 47 + JTable table;
48 48
49 /** The DataModel representing the VOTable data in the JTable element. */ 49 /** The DataModel representing the VOTable data in the JTable element. */
50 - DefaultTableModel tableData; 50 + private DefaultTableModel tableData;
51 51
52 /** 52 /**
53 * Method constructor 53 * Method constructor
@@ -64,6 +64,7 @@ public class VOTableView extends JPanel implements TableModelListener { @@ -64,6 +64,7 @@ public class VOTableView extends JPanel implements TableModelListener {
64 }; 64 };
65 65
66 table = new JTable(tableData); 66 table = new JTable(tableData);
  67 +
67 JScrollPane scrollPane = new JScrollPane(table); 68 JScrollPane scrollPane = new JScrollPane(table);
68 scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); 69 scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
69 scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); 70 scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
@@ -100,7 +101,6 @@ public class VOTableView extends JPanel implements TableModelListener { @@ -100,7 +101,6 @@ public class VOTableView extends JPanel implements TableModelListener {
100 * content. 101 * content.
101 */ 102 */
102 public Object getValueAt(int column, int row) { 103 public Object getValueAt(int column, int row) {
103 - Object val = tableData.getValueAt(row, column);  
104 return tableData.getValueAt(row, column); 104 return tableData.getValueAt(row, column);
105 } 105 }
106 106