Changeset 2503 in josm


Ignore:
Timestamp:
2009-11-22T18:01:56+01:00 (15 years ago)
Author:
Gubaer
Message:

fixed #4009: New relation does not show up in relation editor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r2497 r2503  
    511511     */
    512512    private static  class RelationListModel extends AbstractListModel {
     513        /** the list of relations managaged by this model. Should never be null */
    513514        private ArrayList<Relation> relations;
    514515        private DefaultListSelectionModel selectionModel;
     
    516517        public RelationListModel(DefaultListSelectionModel selectionModel) {
    517518            this.selectionModel = selectionModel;
     519            relations = new ArrayList<Relation>();
    518520        }
    519521
     
    525527            List<Relation> sel =  getSelectedRelations();
    526528            if (relations == null) {
    527                 this.relations = null;
     529                this.relations.clear();
    528530            } else {
    529531                this.relations = new ArrayList<Relation>(relations.size());
     
    540542
    541543        public synchronized void sort() {
    542             if (relations == null) return;
    543544            Collections.sort(
    544545                    relations,
     
    563564            if (addedPrimitives == null || addedPrimitives.isEmpty()) return;
    564565            boolean added = false;
     566            if (relations == null) {
     567                relations = new ArrayList<Relation>();
     568            }
    565569            for (OsmPrimitive p: addedPrimitives) {
    566570                if (! (p instanceof Relation)) {
     
    611615
    612616        public Object getElementAt(int index) {
    613             if (relations == null) return null;
    614617            return relations.get(index);
    615618        }
    616619
    617620        public int getSize() {
    618             if (relations == null) return 0;
    619621            return relations.size();
    620622        }
     
    628630        public List<Relation> getSelectedNonNewRelations() {
    629631            ArrayList<Relation> ret = new ArrayList<Relation>();
    630             if (relations == null) return ret;
    631632            for (int i=0; i<getSize();i++) {
    632633                if (!selectionModel.isSelectedIndex(i)) {
     
    649650        public List<Relation> getSelectedRelations() {
    650651            ArrayList<Relation> ret = new ArrayList<Relation>();
    651             if (relations == null) return ret;
    652652            for (int i=0; i<getSize();i++) {
    653653                if (!selectionModel.isSelectedIndex(i)) {
Note: See TracChangeset for help on using the changeset viewer.