Ignore:
Timestamp:
2010-11-10T00:54:03+01:00 (14 years ago)
Author:
oliverw
Message:

Added also sorting support for "Unresolved" table.

Location:
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/OSMAddress.java

    r24166 r24175  
    245245        public boolean hasHouseNumber() {
    246246                return TagUtils.hasAddrHousenumberTag(osmObject) || isPartOfInterpolation;
     247        }
     248       
     249        /* (non-Javadoc)
     250         * @see org.openstreetmap.josm.plugins.fixAddresses.OSMEntityBase#getName()
     251         */
     252        public String getName() {
     253                String name = TagUtils.getNameValue(osmObject);
     254                if (!StringUtils.isNullOrEmpty(name)) {
     255                        return TagUtils.getAddrHousenameValue(osmObject);
     256                }
     257               
     258                return "";
    247259        }
    248260               
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditDialog.java

    r24114 r24175  
    4141import javax.swing.event.ListSelectionEvent;
    4242import javax.swing.event.ListSelectionListener;
     43import javax.swing.table.JTableHeader;
    4344import javax.swing.table.TableModel;
    4445
     
    5051import org.openstreetmap.josm.gui.SideButton;
    5152import org.openstreetmap.josm.plugins.fixAddresses.AddressEditContainer;
    52 import org.openstreetmap.josm.plugins.fixAddresses.OSMAddress;
    5353import org.openstreetmap.josm.plugins.fixAddresses.IAddressEditContainerListener;
    5454import org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity;
     55import org.openstreetmap.josm.plugins.fixAddresses.OSMAddress;
    5556import org.openstreetmap.josm.plugins.fixAddresses.OSMStreet;
    5657import org.openstreetmap.josm.plugins.fixAddresses.StringUtils;
     
    147148                       
    148149                        /* Panel for unresolved addresses table */
    149                         JPanel unresolvedPanel = new JPanel(new BorderLayout());               
    150                         unresolvedTable = new JTable(new UnresolvedAddressesTableModel(editContainer));
     150                        JPanel unresolvedPanel = new JPanel(new BorderLayout());
     151                        UnresolvedAddressesTableModel uaModel = new UnresolvedAddressesTableModel(editContainer);
     152                        unresolvedTable = new JTable(uaModel);
    151153                        unresolvedTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    152154                        unresolvedTable.getSelectionModel().addListSelectionListener(this);
    153155                        unresolvedTable.getSelectionModel().addListSelectionListener(new IncompleteAddressListener());
    154                         unresolvedTable.addMouseListener(applyAllGuessesAction);                       
     156                        unresolvedTable.addMouseListener(applyAllGuessesAction);
     157                       
     158                        JTableHeader header = unresolvedTable.getTableHeader();
     159                        header.addMouseListener(uaModel.new ColumnListener(unresolvedTable));
    155160                       
    156161                        JScrollPane scroll2 = new JScrollPane(unresolvedTable);
  • applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/UnresolvedAddressesTableModel.java

    r24174 r24175  
    3434
    3535import org.openstreetmap.josm.plugins.fixAddresses.AddressEditContainer;
     36import org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity;
    3637import org.openstreetmap.josm.plugins.fixAddresses.OSMAddress;
    37 import org.openstreetmap.josm.plugins.fixAddresses.IOSMEntity;
    38 import org.openstreetmap.josm.plugins.fixAddresses.StringUtils;
    39 import org.openstreetmap.josm.plugins.fixAddresses.TagUtils;
    40 import org.openstreetmap.josm.plugins.fixAddresses.gui.AddressEditTableModel.ColumnSorter;
    41 import org.openstreetmap.josm.plugins.fixAddresses.gui.IncompleteAddressesTableModel.IncompleteAddressModelSorter;
    4238
    4339/**
     
    127123                        return aNode.getPostCode();
    128124                case 4:
    129                         String name = aNode.getName();
    130                         if (!StringUtils.isNullOrEmpty(name)) {
    131                                 // TODO: Provide a getter/setter for this?
    132                                 return TagUtils.getAddrHousenameValue(aNode.getOsmObject());
    133                         }
    134                         return "";
     125                        return aNode.getName();
    135126                default:
    136127                        throw new RuntimeException("Invalid column index: " + column);
     
    236227                                cc = arg0.getPostCode().compareTo(arg1.getPostCode());
    237228                                break;
     229                        case 4:
     230                                cc = arg0.getName().compareTo(arg1.getName());
     231                                break;
    238232                        default:
    239233                                throw new RuntimeException("Invalid column index: "
Note: See TracChangeset for help on using the changeset viewer.