Changeset 4031 in josm for trunk/src


Ignore:
Timestamp:
2011-04-16T17:21:43+02:00 (13 years ago)
Author:
framm
Message:

change "CT" column in user list to show a grey check mark for
those who have agreed automatically (previously green check
mark), and a red x for those who have explicitly disagreed.

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r4026 r4031  
    3333    private static HashMap<Long,User> userMap = new HashMap<Long,User>();
    3434    private static HashSet<Long> relicensingUsers = null;
     35    private static HashSet<Long> nonRelicensingUsers = null;
    3536
    3637    private static long getNextLocalUid() {
     
    111112
    112113    public static void initRelicensingInformation() {
    113         if(relicensingUsers == null) {
     114        if (relicensingUsers == null) {
    114115            loadRelicensingInformation(false);
    115116        }
     
    118119    public static void loadRelicensingInformation(boolean clean) {
    119120        relicensingUsers = new HashSet<Long>();
     121        nonRelicensingUsers = new HashSet<Long>();
    120122        try {
    121             MirroredInputStream stream = new MirroredInputStream(Main.pref.get("url.licensechange",
    122             "http://planet.openstreetmap.org/users_agreed/users_agreed.txt"), clean ? 1 : 7200);
     123            MirroredInputStream stream = new MirroredInputStream(
     124                 Main.pref.get("url.licensechange",
     125                    "http://planet.openstreetmap.org/users_agreed/users_agreed.txt"),
     126                 clean ? 1 : 7200);
    123127            try {
    124128                InputStreamReader r;
     
    129133                    if (line.startsWith("#")) continue;
    130134                    try {
    131                         relicensingUsers.add(new Long(Long.parseLong(line.trim())));
     135                        Long id = new Long(Long.parseLong(line.trim()));
     136                        relicensingUsers.add(id);
     137                    } catch (java.lang.NumberFormatException ex) {
     138                    }
     139                }
     140            }
     141            finally {
     142                stream.close();
     143            }
     144        } catch (IOException ex) {
     145        }
     146
     147        try {
     148            MirroredInputStream stream = new MirroredInputStream(
     149                Main.pref.get("url.licensechange_reject",
     150                    "http://planet.openstreetmap.org/users_agreed/users_disagreed.txt"),
     151                clean ? 1 : 7200);
     152            try {
     153                InputStreamReader r;
     154                r = new InputStreamReader(stream);
     155                BufferedReader reader = new BufferedReader(r);
     156                String line;
     157                while ((line = reader.readLine()) != null) {
     158                    if (line.startsWith("#")) continue;
     159                    try {
     160                        Long id = new Long(Long.parseLong(line.trim()));
     161                        nonRelicensingUsers.add(id);
    132162                    } catch (java.lang.NumberFormatException ex) {
    133163                    }
     
    156186        if (uid >= 286582) return STATUS_AUTO_AGREED;
    157187        if (relicensingUsers == null) return STATUS_UNKNOWN;
    158         return (relicensingUsers.contains(new Long(uid)) ? STATUS_AGREED : STATUS_NOT_AGREED);
     188        Long id = new Long(uid);
     189        if (relicensingUsers.contains(id)) return STATUS_AGREED;
     190        if (nonRelicensingUsers.contains(id)) return STATUS_NOT_AGREED;
     191        return STATUS_UNKNOWN;
    159192    }
    160193
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r4026 r4031  
    339339        private ArrayList<UserInfo> data;
    340340        private ImageIcon greenCheckmark;
     341        private ImageIcon greyCheckmark;
     342        private ImageIcon redX;
    341343
    342344        public UserTableModel() {
     
    344346            data = new ArrayList<UserInfo>();
    345347            greenCheckmark = ImageProvider.get("misc", "green_check.png");
     348            greyCheckmark = ImageProvider.get("misc", "grey_check.png");
     349            redX = ImageProvider.get("misc", "red_x.png");
    346350        }
    347351
     
    385389            case 2: /* percent */ return NumberFormat.getPercentInstance().format(info.percent);
    386390            case 3: /* relicensing status */
    387                 if (info.getRelicensingStatus() == User.STATUS_AGREED) return greenCheckmark;
    388                 if (info.getRelicensingStatus() == User.STATUS_AUTO_AGREED) return greenCheckmark;
    389                 return null;
     391                switch(info.getRelicensingStatus()) {
     392                case User.STATUS_AGREED: return greenCheckmark;
     393                case User.STATUS_AUTO_AGREED: return greyCheckmark;
     394                case User.STATUS_NOT_AGREED: return redX;
     395                default: return null;
     396                }
    390397            }
    391398            return null;
Note: See TracChangeset for help on using the changeset viewer.