Changeset 30532 in osm for applications/editors/josm/plugins/openstreetbugs/src
- Timestamp:
- 2014-07-14T04:18:06+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbBugListCellRenderer.java ¶
r25474 r30532 41 41 import org.openstreetmap.josm.plugins.osb.OsbPlugin; 42 42 43 public class OsbBugListCellRenderer implements ListCellRenderer { 43 public class OsbBugListCellRenderer implements ListCellRenderer<OsbListItem> { 44 44 45 45 private Color background = Color.WHITE; 46 46 private Color altBackground = new Color(250, 250, 220); 47 47 48 public Component getListCellRendererComponent(JList list, O bject value, int index, boolean isSelected,48 public Component getListCellRendererComponent(JList<? extends OsbListItem> list, OsbListItem item, int index, boolean isSelected, 49 49 boolean cellHasFocus) { 50 50 … … 64 64 } 65 65 66 OsbListItem item = (OsbListItem) value;67 66 Node n = item.getNode(); 68 67 Icon icon = null; … … 86 85 return label; 87 86 } 88 89 87 } -
TabularUnified applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java ¶
r30004 r30532 93 93 private static final long serialVersionUID = 1L; 94 94 private JPanel bugListPanel, queuePanel; 95 private DefaultListModel bugListModel; 96 private JList bugList; 97 private JList queueList; 95 private DefaultListModel<OsbListItem> bugListModel; 96 private JList<OsbListItem> bugList; 97 private JList<OsbAction> queueList; 98 98 private OsbPlugin osbPlugin; 99 99 private boolean fireSelectionChanged = true; … … 120 120 add(bugListPanel, BorderLayout.CENTER); 121 121 122 bugListModel = new DefaultListModel(); 123 bugList = new JList(bugListModel); 122 bugListModel = new DefaultListModel<>(); 123 bugList = new JList<>(bugListModel); 124 124 bugList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 125 125 bugList.addListSelectionListener(this); … … 180 180 queuePanel = new JPanel(new BorderLayout()); 181 181 queuePanel.setName(tr("Queue")); 182 queueList = new JList(getActionQueue()); 182 queueList = new JList<>(getActionQueue()); 183 183 queueList.setCellRenderer(new OsbQueueListCellRenderer()); 184 184 queuePanel.add(new JScrollPane(queueList), BorderLayout.CENTER); … … 241 241 public synchronized void update(final DataSet dataset) { 242 242 // create a new list model 243 bugListModel = new DefaultListModel(); 243 bugListModel = new DefaultListModel<>(); 244 244 List<Node> sortedList = new ArrayList<Node>(dataset.getNodes()); 245 245 Collections.sort(sortedList, new BugComparator()); … … 253 253 254 254 public void valueChanged(ListSelectionEvent e) { 255 if (bugList.getSelectedValues ().length == 0) {255 if (bugList.getSelectedValuesList().isEmpty()) { 256 256 addComment.setEnabled(false); 257 257 closeIssue.setEnabled(false); … … 260 260 261 261 List<OsmPrimitive> selected = new ArrayList<OsmPrimitive>(); 262 for (Object listItem : bugList.getSelectedValues()) { 262 for (Object listItem : bugList.getSelectedValuesList()) { 263 263 Node node = ((OsbListItem) listItem).getNode(); 264 264 selected.add(node); -
TabularUnified applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbQueueListCellRenderer.java ¶
r30004 r30532 43 43 import org.openstreetmap.josm.plugins.osb.gui.action.OsbAction; 44 44 45 public class OsbQueueListCellRenderer implements ListCellRenderer { 45 public class OsbQueueListCellRenderer implements ListCellRenderer<OsbAction> { 46 46 47 47 private Color background = Color.WHITE; 48 48 private Color altBackground = new Color(250, 250, 220); 49 49 50 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, 50 @Override 51 public Component getListCellRendererComponent(JList<? extends OsbAction> list, OsbAction action, int index, boolean isSelected, 51 52 boolean cellHasFocus) { 52 53 … … 62 63 } 63 64 64 OsbAction action = (OsbAction) value;65 65 Icon icon = null; 66 66 if(action instanceof AddCommentAction) { -
TabularUnified applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/action/ActionQueue.java ¶
r22684 r30532 5 5 import javax.swing.AbstractListModel; 6 6 7 public class ActionQueue extends AbstractListModel { 7 public class ActionQueue extends AbstractListModel<OsbAction> { 8 8 9 9 private LinkedList<OsbAction> queue = new LinkedList<OsbAction>(); … … 25 25 } 26 26 27 public boolean remove(O bjecto) {27 public boolean remove(OsbAction o) { 28 28 int index = queue.indexOf(o); 29 29 if(index >= 0) { … … 52 52 } 53 53 54 public Object getElementAt(int index) { 54 @Override 55 public OsbAction getElementAt(int index) { 55 56 return queue.get(index); 56 57 } 57 58 59 @Override 58 60 public int getSize() { 59 61 return queue.size();
Note:
See TracChangeset
for help on using the changeset viewer.