Ignore:
Timestamp:
2011-03-14T09:30:11+01:00 (14 years ago)
Author:
beata.jancso
Message:

new feature: MapDust bug filtering & refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/model/BugsListModel.java

    r24514 r25591  
    3030
    3131import java.util.List;
    32 import javax.swing.ListModel;
    33 import javax.swing.event.ListDataListener;
     32import javax.swing.AbstractListModel;
    3433import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBug;
    3534
     
    4140 *
    4241 */
    43 public class BugsListModel implements ListModel {
     42public class BugsListModel extends AbstractListModel {
     43
     44    /** The serial version UID */
     45    private static final long serialVersionUID = 3451277352571392219L;
    4446
    4547    /** The list of <code>MapdustBug</code> objects */
     
    6264    }
    6365
    64     @Override
    65     public void addListDataListener(ListDataListener l) {}
    66 
     66    /**
     67     * Returns the <code>MapdustBug</code> from the given position.
     68     *
     69     * @param index The position of the element
     70     * @return <code>MapdustBug</code> from the given position
     71     */
    6772    @Override
    6873    public Object getElementAt(int index) {
    69         return bugs.get(index);
     74        if (index >= 0 && index < bugs.size()) {
     75            return bugs.get(index);
     76        }
     77        return null;
    7078    }
    7179
     80    /**
     81     * Returns the size of the list of objects.
     82     *
     83     * @return size
     84     */
    7285    @Override
    7386    public int getSize() {
     
    7588    }
    7689
    77     @Override
    78     public void removeListDataListener(ListDataListener l) {}
     90    /**
     91     * Updates the bugs list model.
     92     */
     93    public void update() {
     94        this.fireContentsChanged(this, 0, bugs.size() - 1);
     95    }
    7996
    8097}
Note: See TracChangeset for help on using the changeset viewer.