Changeset 5495 in josm


Ignore:
Timestamp:
2012-09-02T14:20:28+02:00 (12 years ago)
Author:
Don-vip
Message:

see #7906 - Remove ODbL/CT stuff

Location:
trunk/src/org/openstreetmap/josm
Files:
1 deleted
7 edited

Legend:

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

    r4602 r5495  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.io.BufferedReader;
    7 import java.io.InputStreamReader;
    8 import java.io.IOException;
    9 
    106import java.util.ArrayList;
    11 import java.util.concurrent.atomic.AtomicLong;
    127import java.util.HashMap;
    138import java.util.HashSet;
    149import java.util.List;
    15 
    16 import org.openstreetmap.josm.Main;
    17 import org.openstreetmap.josm.io.MirroredInputStream;
     10import java.util.concurrent.atomic.AtomicLong;
     11
    1812import org.openstreetmap.josm.tools.Utils;
    1913
     
    3529     */
    3630    private static HashMap<Long,User> userMap = new HashMap<Long,User>();
    37     private static HashSet<Long> relicensingUsers = null;
    38     private static HashSet<Long> nonRelicensingUsers = null;
    3931    private final static User anonymous = createLocalUser(tr("<anonymous>"));
    4032
     
    119111    }
    120112
    121     public static void initRelicensingInformation() {
    122         if (relicensingUsers == null) {
    123             loadRelicensingInformation(false);
    124         }
    125     }
    126 
    127     public static void loadRelicensingInformation(boolean clean) {
    128         relicensingUsers = new HashSet<Long>();
    129         nonRelicensingUsers = new HashSet<Long>();
    130         try {
    131             MirroredInputStream stream = new MirroredInputStream(
    132                  Main.pref.get("url.licensechange",
    133                     "http://planet.openstreetmap.org/users_agreed/users_agreed.txt"),
    134                  clean ? 1 : 7200);
    135             try {
    136                 InputStreamReader r;
    137                 r = new InputStreamReader(stream);
    138                 BufferedReader reader = new BufferedReader(r);
    139                 String line;
    140                 while ((line = reader.readLine()) != null) {
    141                     if (line.startsWith("#")) continue;
    142                     try {
    143                         Long id = new Long(Long.parseLong(line.trim()));
    144                         relicensingUsers.add(id);
    145                     } catch (java.lang.NumberFormatException ex) {
    146                     }
    147                 }
    148             }
    149             finally {
    150                 stream.close();
    151             }
    152         } catch (IOException ex) {
    153         }
    154 
    155         try {
    156             MirroredInputStream stream = new MirroredInputStream(
    157                 Main.pref.get("url.licensechange_reject",
    158                     "http://planet.openstreetmap.org/users_agreed/users_disagreed.txt"),
    159                 clean ? 1 : 7200);
    160             try {
    161                 InputStreamReader r;
    162                 r = new InputStreamReader(stream);
    163                 BufferedReader reader = new BufferedReader(r);
    164                 String line;
    165                 while ((line = reader.readLine()) != null) {
    166                     if (line.startsWith("#")) continue;
    167                     try {
    168                         Long id = new Long(Long.parseLong(line.trim()));
    169                         nonRelicensingUsers.add(id);
    170                     } catch (java.lang.NumberFormatException ex) {
    171                     }
    172                 }
    173             }
    174             finally {
    175                 stream.close();
    176             }
    177         } catch (IOException ex) {
    178         }
    179     }
    180 
    181113    /** the user name */
    182114    private final HashSet<String> names = new HashSet<String>();
    183115    /** the user id */
    184116    private final long uid;
    185     private int relicensingStatus = STATUS_UNKNOWN;
    186 
    187     public static final int STATUS_UNKNOWN = -1;
    188     public static final int STATUS_UNDECIDED = 0;
    189     public static final int STATUS_AGREED = 1;
    190     public static final int STATUS_NOT_AGREED = 2;
    191     public static final int STATUS_AUTO_AGREED = 3;
    192     public static final int STATUS_ANONYMOUS = 4;
    193 
    194     /**
    195     * Finds out this user's relicensing status and saves it for quicker
    196     * access.
    197     */
    198     public int getRelicensingStatus() {
    199         if (relicensingStatus != STATUS_UNKNOWN) return relicensingStatus;
    200         if (uid >= 286582) return (relicensingStatus = STATUS_AUTO_AGREED);
    201         if (relicensingUsers == null) return STATUS_UNKNOWN;
    202         Long id = new Long(uid);
    203         if (relicensingUsers.contains(id)) return (relicensingStatus = STATUS_AGREED);
    204         if (nonRelicensingUsers == null) return STATUS_UNKNOWN;
    205         if (nonRelicensingUsers.contains(id)) return (relicensingStatus = STATUS_NOT_AGREED);
    206         return STATUS_UNDECIDED;
    207     }
    208 
    209     /**
    210     * Sets this user's relicensing status. This can be used if relicensing
    211     * information is available from another source so that directly looking
    212     * at the users_agreed/users_not_agreed files it not required.
    213     */
    214     public void setRelicensingStatus(int status) {
    215         relicensingStatus = status;
    216     }
    217117
    218118    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r5360 r5495  
    55import static org.openstreetmap.josm.tools.I18n.trn;
    66
    7 import java.awt.Component;
    87import java.awt.event.ActionEvent;
    98import java.awt.event.KeyEvent;
     
    2625
    2726import javax.swing.AbstractAction;
    28 import javax.swing.JLabel;
    2927import javax.swing.JOptionPane;
    3028import javax.swing.JTable;
     
    3230import javax.swing.event.ListSelectionEvent;
    3331import javax.swing.event.ListSelectionListener;
    34 import javax.swing.table.DefaultTableCellRenderer;
    3532import javax.swing.table.DefaultTableModel;
    36 import javax.swing.table.TableColumnModel;
    3733
    3834import org.openstreetmap.josm.Main;
     
    4642import org.openstreetmap.josm.gui.layer.Layer;
    4743import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    48 import org.openstreetmap.josm.gui.progress.ContributorTermsUpdateRunnable;
    4944import org.openstreetmap.josm.tools.ImageProvider;
    5045import org.openstreetmap.josm.tools.Shortcut;
     
    6459    private SelectUsersPrimitivesAction selectionUsersPrimitivesAction;
    6560    private ShowUserInfoAction showUserInfoAction;
    66     private LoadRelicensingInformationAction loadRelicensingInformationAction;
    6761
    6862    public UserListDialog() {
     
    9084        userTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    9185        userTable.addMouseListener(new DoubleClickAdapter());
    92         TableColumnModel columnModel = userTable.getColumnModel();
    93         columnModel.getColumn(3).setPreferredWidth(20);
    94         columnModel.getColumn(3).setCellRenderer(new DefaultTableCellRenderer() {
    95             @Override
    96             public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    97                 // see http://download.oracle.com/javase/6/docs/api/javax/swing/table/DefaultTableCellRenderer.html#override
    98                 // for why we don't use the label directly
    99                 final JLabel renderLabel = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    100                 JLabel sourceLabel = (JLabel) value;
    101                 renderLabel.setIcon(sourceLabel.getIcon());
    102                 renderLabel.setText("");
    103                 renderLabel.setToolTipText(sourceLabel.getToolTipText());
    104                 return renderLabel;
    105             }
    106         });
    10786
    10887        // -- select users primitives action
     
    11695        userTable.getSelectionModel().addListSelectionListener(showUserInfoAction);
    11796
    118         // -- load relicensing info action
    119         loadRelicensingInformationAction = new LoadRelicensingInformationAction();
    120 
    12197        createLayout(userTable, true, Arrays.asList(new SideButton[] {
    12298            new SideButton(selectionUsersPrimitivesAction),
    123             new SideButton(showUserInfoAction),
    124             new SideButton(loadRelicensingInformationAction)
     99            new SideButton(showUserInfoAction)
    125100        }));
    126101    }
     
    162137    public void showDialog() {
    163138        super.showDialog();
    164         Main.worker.submit(new ContributorTermsUpdateRunnable());
    165139        Layer layer = Main.main.getActiveLayer();
    166140        if (layer instanceof OsmDataLayer) {
     
    259233    }
    260234
    261     /*
    262      */
    263     class LoadRelicensingInformationAction extends AbstractAction {
    264 
    265         public LoadRelicensingInformationAction() {
    266             super();
    267             putValue(NAME, tr("Load CT"));
    268             putValue(SHORT_DESCRIPTION, tr("Loads information about relicensing status from the server. Users having agreed to the new contributor terms will show a green check mark."));
    269             putValue(SMALL_ICON, ImageProvider.get("about"));
    270         }
    271 
    272         @Override
    273         public void actionPerformed(ActionEvent e) {
    274             Main.worker.submit(new ContributorTermsUpdateRunnable());
    275             Layer layer = Main.main.getActiveLayer();
    276             if (layer instanceof OsmDataLayer) {
    277                 refresh(((OsmDataLayer)layer).data.getAllSelected());
    278             }
    279             setEnabled(false);
    280         }
    281     }
    282 
    283235    class DoubleClickAdapter extends MouseAdapter {
    284236        @Override
     
    317269            return user.getName();
    318270        }
    319 
    320         public int getRelicensingStatus() {
    321             if (user == null)
    322                 return User.STATUS_UNKNOWN;
    323             return user.getRelicensingStatus();
    324         }
    325271    }
    326272
     
    333279
    334280        public UserTableModel() {
    335             setColumnIdentifiers(new String[]{tr("Author"),tr("# Objects"),"%", tr("CT")});
     281            setColumnIdentifiers(new String[]{tr("Author"),tr("# Objects"),"%"});
    336282            data = new ArrayList<UserInfo>();
    337283        }
     
    375321            case 1: /* count */ return info.count;
    376322            case 2: /* percent */ return NumberFormat.getPercentInstance().format(info.percent);
    377             case 3: /* relicensing status */ return getRelicensingStatusIcon(info.getRelicensingStatus());
    378323            }
    379324            return null;
     
    412357        }
    413358    }
    414 
    415     private static JLabel greenCheckmark;
    416     private static JLabel greyCheckmark;
    417     private static JLabel redX;
    418     private static JLabel empty;
    419 
    420     public static JLabel getRelicensingStatusIcon(int status) {
    421         switch(status) {
    422         case User.STATUS_AGREED:
    423             if (greenCheckmark == null) {
    424                 greenCheckmark = new JLabel(ImageProvider.get("misc", "green_check.png"));
    425                 greenCheckmark.setToolTipText(tr("Accepted"));
    426             }
    427             return greenCheckmark;
    428         case User.STATUS_AUTO_AGREED:
    429             if (greyCheckmark == null) {
    430                 greyCheckmark = new JLabel(ImageProvider.get("misc", "grey_check.png"));
    431                 greyCheckmark.setToolTipText(tr("Auto-accepted"));
    432             }
    433             return greyCheckmark;
    434         case User.STATUS_NOT_AGREED:
    435             if (redX == null) {
    436                 redX = new JLabel(ImageProvider.get("misc", "red_x.png"));
    437                 redX.setToolTipText(tr("Declined"));
    438             }
    439             return redX;
    440         default:
    441             if (empty == null) {
    442                 empty = new JLabel("");
    443                 empty.setToolTipText(tr("Undecided"));
    444             }
    445         }
    446         return empty; // Undecided or unknown?
    447     }
    448359}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java

    r5266 r5495  
    5050import org.openstreetmap.josm.gui.history.HistoryLoadTask;
    5151import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    52 import org.openstreetmap.josm.gui.progress.ContributorTermsUpdateRunnable;
    5352import org.openstreetmap.josm.tools.BugReportExceptionHandler;
    5453import org.openstreetmap.josm.tools.ImageProvider;
     
    264263
    265264        public void showHistory(final Collection<HistoryOsmPrimitive> primitives) {
    266             Main.worker.submit(new ContributorTermsUpdateRunnable());
    267265
    268266            List<HistoryOsmPrimitive> toLoad = filterPrimitivesWithUnloadedHistory(primitives);
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java

    r5460 r5495  
    2020import org.openstreetmap.josm.gui.MapView;
    2121import org.openstreetmap.josm.gui.layer.Layer;
    22 import org.openstreetmap.josm.gui.progress.ContributorTermsUpdateRunnable;
    2322import org.openstreetmap.josm.tools.BugReportExceptionHandler;
    2423import org.openstreetmap.josm.tools.Predicate;
     
    146145            return;
    147146        }
    148 
    149         Main.worker.submit(new ContributorTermsUpdateRunnable());
    150147
    151148        Collection<OsmPrimitive> toLoad = Utils.filter(primitives, unloadedHistoryPredicate);
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r5440 r5495  
    1010import java.util.Observable;
    1111
     12import javax.swing.JTable;
    1213import javax.swing.table.AbstractTableModel;
     14import javax.swing.table.TableModel;
    1315
    1416import org.openstreetmap.josm.Main;
     
    4042import org.openstreetmap.josm.gui.MapView;
    4143import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    42 import org.openstreetmap.josm.gui.dialogs.UserListDialog;
    4344import org.openstreetmap.josm.gui.layer.Layer;
    4445import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    428429                return isCurrentPointInTime(row);
    429430            case 3: {
    430                     User user = getPrimitive(row).getUser();
    431                     int status;
    432                     if (user == null) {
    433                         status = User.STATUS_UNKNOWN;
    434                     } else {
    435                         status = user.getRelicensingStatus();
    436                     }
    437                     return UserListDialog.getRelicensingStatusIcon(status);
    438                 }
    439             case 4: {
    440431                    HistoryOsmPrimitive p = getPrimitive(row);
    441432                    if (p != null && p.getTimestamp() != null)
     
    443434                    return null;
    444435                }
    445             case 5: {
     436            case 4: {
    446437                    HistoryOsmPrimitive p = getPrimitive(row);
    447438                    if (p != null) {
  • trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java

    r5264 r5495  
    5858                adjustColumnWidth(VersionTable.this, 3, 0);
    5959                adjustColumnWidth(VersionTable.this, 4, 0);
    60                 adjustColumnWidth(VersionTable.this, 5, 0);
    6160            }
    6261        });
  • trunk/src/org/openstreetmap/josm/gui/history/VersionTableColumnModel.java

    r5440 r5495  
    3939        col.setResizable(false);
    4040        addColumn(col);
    41         // column 3 - CT state
     41        // column 3 - Date
    4242        col = new TableColumn(3);
    43         /* translation note: short for "Contributor Terms" */
    44         col.setHeaderValue(tr("CT"));
    45         col.setCellRenderer(new VersionTable.LabelRenderer());
    46         col.setPreferredWidth(22);
    47         col.setResizable(false);
    48         addColumn(col);
    49         // column 4 - Date
    50         col = new TableColumn(4);
    5143        col.setHeaderValue(tr("Date"));
    5244        col.setResizable(false);
    5345        addColumn(col);
    54         // column 5 - User
    55         col = new TableColumn(5);
     46        // column 4 - User
     47        col = new TableColumn(4);
    5648        col.setHeaderValue(tr("User"));
    5749        col.setResizable(false);
Note: See TracChangeset for help on using the changeset viewer.