Changeset 1040 in josm for trunk/src


Ignore:
Timestamp:
2008-10-13T11:30:36+02:00 (16 years ago)
Author:
stoecker
Message:

added user selection in user dialog. Closes #1650. Patch by Jan Peter Stotz

File:
1 edited

Legend:

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

    r1023 r1040  
    66import java.awt.BorderLayout;
    77import java.awt.event.KeyEvent;
     8import java.awt.event.MouseEvent;
     9import java.awt.event.MouseListener;
    810import java.util.Arrays;
    911import java.util.Collection;
    1012import java.util.Comparator;
    1113import java.util.HashMap;
     14import java.util.LinkedList;
    1215
    1316import javax.swing.JScrollPane;
     
    2932 * @author Frederik Ramm <frederik@remote.org>
    3033 */
    31 public class UserListDialog extends ToggleDialog implements SelectionChangedListener {
     34public class UserListDialog extends ToggleDialog implements SelectionChangedListener, MouseListener{
    3235
    3336        /**
     
    5558                add(new JScrollPane(userTable), BorderLayout.CENTER);
    5659                selectionChanged(Main.ds.getSelected());
    57 
     60                userTable.addMouseListener(this);
    5861                DataSet.selListeners.add(this);
    5962        }
     
    108111        }
    109112
     113    public void mouseClicked(MouseEvent e) {
     114        if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount()==2) {
     115            int index = userTable.getSelectedRow();
     116            String userName = (String) data.getValueAt(index, 0);
     117            if (userName==null)
     118                return;
     119            Collection<OsmPrimitive> selected = Main.ds.getSelected();
     120            Collection<OsmPrimitive> byUser = new LinkedList<OsmPrimitive>();
     121            for (OsmPrimitive p : selected) {
     122                if (p.user!= null && userName.equals(p.user.name))
     123                    byUser.add(p);
     124            }
     125            Main.ds.setSelected(byUser);
     126        }
     127    }
     128
     129    public void mouseEntered(MouseEvent e) {
     130    }
     131
     132    public void mouseExited(MouseEvent e) {
     133    }
     134
     135    public void mousePressed(MouseEvent e) {
     136    }
     137
     138    public void mouseReleased(MouseEvent e) {
     139    }
     140
    110141}
Note: See TracChangeset for help on using the changeset viewer.