/[schmitzm]/trunk/src/skrueger/geotools/labelsearch/SearchResultTableModel.java
ViewVC logotype

Annotation of /trunk/src/skrueger/geotools/labelsearch/SearchResultTableModel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 139 - (hide annotations)
Thu Jun 11 12:52:58 2009 UTC (15 years, 8 months ago) by alfonx
File MIME type: text/plain
File size: 1672 byte(s)
* Fixed a bug when creating more than 3 additional styles at once... A NPE occurred because none has been set as the selected additional style.
* Moved the i8n and Localisation for LabelSearch to schmitzm

1 alfonx 139 package skrueger.geotools.labelsearch;
2    
3     import java.util.List;
4    
5     import javax.swing.table.TableModel;
6    
7     import schmitzm.swing.table.AbstractTableModel;
8     import skrueger.geotools.labelsearch.SearchResult;
9     import skrueger.geotools.labelsearch.SearchResultFeature;
10    
11     /**
12     * A {@link TableModel} which presents a {@link List} of {@link SearchResult}s.
13     * by the time of writing, {@link SearchResult}'s only concrete class is
14     * {@link SearchResultFeature}, but others might follow that reference to a Map or a DpEntry.<br/>
15     * The three columns of this {@link TableModel} are: result number, full name,
16     * name of layer containing the result
17     *
18     * @author Stefan A. Krueger
19     *
20     */
21     public class SearchResultTableModel extends AbstractTableModel implements
22     TableModel {
23    
24     private final List<SearchResult> searchResultsList;
25    
26     public SearchResultTableModel(List<SearchResult> searchResultsList) {
27     this.searchResultsList = searchResultsList;
28     }
29    
30     @Override
31     /*
32     * The three columns of this {@link TableModel} are: full
33     * name, name of layer containing the result
34     */
35     public int getColumnCount() {
36     return 2;
37     }
38    
39     @Override
40     public int getRowCount() {
41     return searchResultsList.size();
42     }
43    
44     @Override
45     public Object getValueAt(int row, int column) {
46     // if (column == 0) {
47     // return row + 1;
48     // } else
49     if (column == 0) {
50     return searchResultsList.get(row).getTitle();
51    
52     } else if (column == 1) {
53     return searchResultsList.get(row).getInTitle();
54    
55     } else return null;
56     }
57    
58     @Override
59     public String[] createColumnNames() {
60     return new String[] {LabelSearch.R("SearchMapDialog.Results.Column.Name"), LabelSearch.R("SearchMapDialog.Results.Column.Layer")};
61     }
62    
63     }

Properties

Name Value
svn:eol-style native
svn:keywords Id
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26