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

see #7906 - Remove ODbL/CT stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.