Changeset 30532 in osm for applications/editors/josm/plugins/mapdust/src/org
- Timestamp:
- 2014-07-14T04:18:06+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustActionUploaderException.java
r25591 r30532 36 36 */ 37 37 public class MapdustActionUploaderException extends Exception { 38 39 /** Serial version UID */40 private static final long serialVersionUID = -6128820229665805478L;41 38 42 39 /** -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/adapter/DisplayMenu.java
r25591 r30532 31 31 import java.awt.event.MouseAdapter; 32 32 import java.awt.event.MouseEvent; 33 33 34 import javax.swing.JList; 34 35 import javax.swing.JPopupMenu; 36 37 import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBug; 35 38 36 39 … … 48 51 49 52 /** The list of bugs */ 50 private JList listBugs; 53 private JList<MapdustBug> listBugs; 51 54 52 55 /** … … 61 64 * @param menu The <code>JPopupMenu</code> object 62 65 */ 63 public DisplayMenu(JList listBugs, JPopupMenu menu) { 66 public DisplayMenu(JList<MapdustBug> listBugs, JPopupMenu menu) { 64 67 this.listBugs = listBugs; 65 68 this.menu = menu; -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/adapter/WindowClose.java
r25591 r30532 45 45 */ 46 46 public class WindowClose extends WindowAdapter { 47 48 /** Serial version UID */49 47 50 48 /** A <code>AbstractDialog</code> object */ -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteActionList.java
r25591 r30532 55 55 public class ExecuteActionList extends MapdustExecuteAction implements 56 56 MapdustUpdateObservable { 57 58 /** Serial version UID */59 private static final long serialVersionUID = -7487830542214611774L;60 57 61 58 /** List of MapdustRefreshObserver objects */ -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCloseBug.java
r25828 r30532 64 64 public class ExecuteCloseBug extends MapdustExecuteAction implements 65 65 MapdustBugObservable, MapdustActionObservable { 66 67 /** Serial version UID */68 private static final long serialVersionUID = 3468827127588061014L;69 66 70 67 /** The list of Mapdust bug observers */ -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/MapdustExecuteAction.java
r25828 r30532 44 44 */ 45 45 public abstract class MapdustExecuteAction extends AbstractAction { 46 47 /** Serial version UID */48 private static final long serialVersionUID = 4318259806647818543L;49 46 50 47 /** The abstract dialog object */ -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CreateBugDialog.java
r25828 r30532 28 28 package org.openstreetmap.josm.plugins.mapdust.gui.component.dialog; 29 29 30 31 30 import java.awt.Color; 32 31 import java.awt.Font; … … 34 33 import java.awt.Point; 35 34 import java.awt.Rectangle; 35 36 36 import javax.swing.JButton; 37 37 import javax.swing.JComboBox; … … 41 41 import javax.swing.JTextField; 42 42 import javax.swing.WindowConstants; 43 43 44 import org.openstreetmap.josm.Main; 44 45 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin; … … 49 50 import org.openstreetmap.josm.plugins.mapdust.gui.component.renderer.ComboBoxRenderer; 50 51 import org.openstreetmap.josm.plugins.mapdust.gui.component.util.ComponentUtil; 52 import org.openstreetmap.josm.plugins.mapdust.service.value.BugType; 51 53 import org.openstreetmap.josm.tools.ImageProvider; 52 53 54 54 55 /** … … 71 72 72 73 /** The combo-box for the bug types */ 73 private JComboBox cbbType; 74 private JComboBox<BugType> cbbType; 74 75 75 76 /** The nickname label */ … … 248 249 * @return the cbbType 249 250 */ 250 public JComboBox getCbbType() { 251 public JComboBox<BugType> getCbbType() { 251 252 return cbbType; 252 253 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/model/ActionListModel.java
r25591 r30532 40 40 * @version $Revision$ 41 41 */ 42 public class ActionListModel extends AbstractListModel { 42 public class ActionListModel extends AbstractListModel<MapdustAction> { 43 43 44 44 /** The serial version UID */ … … 73 73 */ 74 74 @Override 75 public ObjectgetElementAt(int index) {75 public MapdustAction getElementAt(int index) { 76 76 if (index >= 0 && index < list.size()) { 77 77 return list.get(index); … … 89 89 return (list != null ? list.size() : 0); 90 90 } 91 92 91 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/model/BugsListModel.java
r25591 r30532 28 28 package org.openstreetmap.josm.plugins.mapdust.gui.component.model; 29 29 30 31 30 import java.util.List; 32 31 import javax.swing.AbstractListModel; 33 32 import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBug; 34 35 33 36 34 /** … … 40 38 * 41 39 */ 42 public class BugsListModel extends AbstractListModel { 40 public class BugsListModel extends AbstractListModel<MapdustBug> { 43 41 44 42 /** The serial version UID */ … … 71 69 */ 72 70 @Override 73 public ObjectgetElementAt(int index) {71 public MapdustBug getElementAt(int index) { 74 72 if (index >= 0 && index < bugs.size()) { 75 73 return bugs.get(index); … … 94 92 this.fireContentsChanged(this, 0, bugs.size() - 1); 95 93 } 96 97 94 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/model/CommentListModel.java
r25591 r30532 40 40 * 41 41 */ 42 public class CommentListModel implements ListModel { 42 public class CommentListModel implements ListModel<MapdustComment> { 43 43 44 44 /** The list of <code>MapdustBug</code> objects */ … … 68 68 */ 69 69 @Override 70 public Object getElementAt(int index) {70 public MapdustComment getElementAt(int index) { 71 71 if (index > 0 && index < comments.length) { 72 72 return comments[index]; -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/model/TypesListModel.java
r27874 r30532 28 28 package org.openstreetmap.josm.plugins.mapdust.gui.component.model; 29 29 30 31 30 import javax.swing.AbstractListModel; 32 31 import javax.swing.ComboBoxModel; 33 32 import org.openstreetmap.josm.plugins.mapdust.service.value.BugType; 34 35 33 36 34 /** … … 40 38 * @version $Revision$ 41 39 */ 42 public class TypesListModel extends AbstractListModel implements ComboBoxModel { 40 public class TypesListModel extends AbstractListModel<BugType> implements ComboBoxModel<BugType> { 43 41 44 42 /** The serial version UID */ … … 65 63 */ 66 64 @Override 67 public ObjectgetElementAt(int index) {65 public BugType getElementAt(int index) { 68 66 return types[index]; 69 67 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustActionPanel.java
r25591 r30532 28 28 package org.openstreetmap.josm.plugins.mapdust.gui.component.panel; 29 29 30 import static org.openstreetmap.josm.tools.I18n.tr; 30 31 31 import static org.openstreetmap.josm.tools.I18n.tr;32 32 import java.awt.BorderLayout; 33 33 import java.util.List; 34 34 35 import javax.swing.AbstractAction; 35 36 import javax.swing.JList; … … 37 38 import javax.swing.JScrollPane; 38 39 import javax.swing.JToggleButton; 40 39 41 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin; 40 42 import org.openstreetmap.josm.plugins.mapdust.gui.action.execute.ExecuteActionList; … … 42 44 import org.openstreetmap.josm.plugins.mapdust.gui.component.util.ComponentUtil; 43 45 import org.openstreetmap.josm.plugins.mapdust.gui.value.MapdustAction; 44 45 46 46 47 /** … … 52 53 public class MapdustActionPanel extends JPanel { 53 54 54 /** The serial version UID */55 private static final long serialVersionUID = -6648507056357610823L;56 57 55 /** The scroll pane */ 58 56 private JScrollPane cmpActionList; 59 57 60 58 /** The JList containing the MapDust action objects */ 61 private JList actionJList; 59 private JList<MapdustAction> actionJList; 62 60 63 61 /** The list of <code>MapdustAction</code> objects */ … … 113 111 cmpActionList.getViewport().setView(actionJList); 114 112 cmpActionList.invalidate(); 115 116 113 } 117 114 … … 133 130 this.actionList = actionList; 134 131 } 135 136 132 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java
r25839 r30532 79 79 80 80 /** The list of bugs */ 81 private JList mapdustBugsJList; 81 private JList<MapdustBug> mapdustBugsJList; 82 82 83 83 /** The scroll pane for the <code>MapdustBug</code>s */ … … 163 163 String text = " No bugs in the current view for the selected"; 164 164 text += " filters!"; 165 JList textJList = new JList(new String[] { text }); 165 JList<String> textJList = new JList<>(new String[] { text }); 166 166 textJList.setBorder(new LineBorder(Color.black, 1, false)); 167 167 textJList.setCellRenderer(new BugListCellRenderer()); … … 192 192 String text = " No bugs in the current view for the selected"; 193 193 text += " filters!"; 194 JList textJList = new JList(new String[] { text }); 194 JList<String> textJList = new JList<>(new String[] { text }); 195 195 textJList.setBorder(new LineBorder(Color.black, 1, false)); 196 196 textJList.setCellRenderer(new BugListCellRenderer()); … … 198 198 } else { 199 199 if (mapdustBugsJList == null) { 200 mapdustBugsJList = ComponentUtil.createJList(mapdustBugsList, 201 menu); 200 mapdustBugsJList = ComponentUtil.createJList(mapdustBugsList, menu); 202 201 mapdustBugsJList.addListSelectionListener(this); 203 202 DisplayMenu adapter = new DisplayMenu(mapdustBugsJList, menu); … … 349 348 * @return the listBugs 350 349 */ 351 public JList getMapdustBugsJList() { 350 public JList<MapdustBug> getMapdustBugsJList() { 352 351 return mapdustBugsJList; 353 352 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/renderer/ActionListCellRenderer.java
r25591 r30532 28 28 package org.openstreetmap.josm.plugins.mapdust.gui.component.renderer; 29 29 30 31 30 import java.awt.Component; 32 31 import java.awt.Font; … … 39 38 import org.openstreetmap.josm.tools.ImageProvider; 40 39 41 42 40 /** 43 41 * Cell renderer for the <code>MapdustAction</code> objects. … … 47 45 */ 48 46 public class ActionListCellRenderer extends DefaultListCellRenderer { 49 50 /** The serial version UID */51 private static final long serialVersionUID = 7552949107018269769L;52 47 53 48 /** … … 61 56 */ 62 57 @Override 63 public Component getListCellRendererComponent(JList list, Object value, 58 public Component getListCellRendererComponent(JList<?> list, Object value, 64 59 int index, boolean isSelected, boolean hasFocus) { 65 60 JLabel label = (JLabel) super.getListCellRendererComponent(list, value, -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/renderer/BugListCellRenderer.java
r25591 r30532 61 61 */ 62 62 @Override 63 public Component getListCellRendererComponent(JList list, Object value, 63 public Component getListCellRendererComponent(JList<?> list, Object value, 64 64 int index, boolean isSelected, boolean hasFocus) { 65 65 JLabel label =(JLabel) super.getListCellRendererComponent(list, value, -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/renderer/ComboBoxRenderer.java
r27874 r30532 28 28 package org.openstreetmap.josm.plugins.mapdust.gui.component.renderer; 29 29 30 31 30 import java.awt.Component; 32 31 import java.awt.Font; … … 39 38 import org.openstreetmap.josm.tools.ImageProvider; 40 39 41 42 40 /** 43 41 * Cell renderer for the <code>MapdustBug</code> types. … … 45 43 * @author Bea 46 44 */ 47 public class ComboBoxRenderer implements ListCellRenderer { 45 public class ComboBoxRenderer implements ListCellRenderer<BugType> { 48 46 49 47 /** The default renderer */ … … 61 59 */ 62 60 @Override 63 public Component getListCellRendererComponent(JList list, Object value,61 public Component getListCellRendererComponent(JList<? extends BugType> list, BugType type, 64 62 int index, boolean isSelected, boolean cellHasFocus) { 65 63 JLabel label = (JLabel) defaultRenderer.getListCellRendererComponent( 66 list, value, index, isSelected, cellHasFocus); 67 if (value instanceof BugType) { 68 BugType type = (BugType) value; 69 String iconPath = "bugs/normal/open_" + type.getKey() + ".png"; 70 String text = type.getValue(); 71 ImageIcon icon = ImageProvider.get(iconPath); 72 label.setIcon(icon); 73 label.setText(text); 74 label.setFont( new Font("Times New Roman", Font.BOLD, 12)); 75 } 64 list, type, index, isSelected, cellHasFocus); 65 String iconPath = "bugs/normal/open_" + type.getKey() + ".png"; 66 String text = type.getValue(); 67 ImageIcon icon = ImageProvider.get(iconPath); 68 label.setIcon(icon); 69 label.setText(text); 70 label.setFont( new Font("Times New Roman", Font.BOLD, 12)); 76 71 return label; 77 72 } 78 79 73 } -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/util/ComponentUtil.java
r25828 r30532 30 30 31 31 import static org.openstreetmap.josm.tools.I18n.tr; 32 32 33 import java.awt.Color; 33 34 import java.awt.Component; … … 35 36 import java.awt.Rectangle; 36 37 import java.util.List; 38 37 39 import javax.swing.AbstractAction; 38 40 import javax.swing.Action; … … 52 54 import javax.swing.SwingConstants; 53 55 import javax.swing.border.LineBorder; 56 54 57 import org.openstreetmap.josm.plugins.mapdust.gui.component.model.ActionListModel; 55 58 import org.openstreetmap.josm.plugins.mapdust.gui.component.model.BugsListModel; … … 58 61 import org.openstreetmap.josm.plugins.mapdust.gui.component.renderer.BugListCellRenderer; 59 62 import org.openstreetmap.josm.plugins.mapdust.gui.value.MapdustAction; 63 import org.openstreetmap.josm.plugins.mapdust.service.value.BugType; 60 64 import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBug; 61 65 import org.openstreetmap.josm.tools.ImageProvider; … … 211 215 * @return A <code>JScrollPane</code> object 212 216 */ 213 public static JScrollPane createJScrollPane(JList list) { 217 public static JScrollPane createJScrollPane(JList<?> list) { 214 218 JScrollPane jScrollPane = new JScrollPane(); 215 219 jScrollPane.setViewportView(list); … … 224 228 * @return A <code>JList</code> object 225 229 */ 226 public static JList createJList(List<MapdustAction> list) { 227 final JList jList = new JList(new ActionListModel(list)); 230 public static JList<MapdustAction> createJList(List<MapdustAction> list) { 231 final JList<MapdustAction> jList = new JList<>(new ActionListModel(list)); 228 232 jList.setBorder(new LineBorder(Color.black, 1, false)); 229 233 jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); … … 240 244 * @return A <code>JList</code> 241 245 */ 242 public static JList createJList(List<MapdustBug> bugsList, 243 final JPopupMenu menu) { 244 final JList jList = new JList(new BugsListModel(bugsList)); 246 public static JList<MapdustBug> createJList(List<MapdustBug> bugsList, final JPopupMenu menu) { 247 final JList<MapdustBug> jList = new JList<>(new BugsListModel(bugsList)); 245 248 jList.setBorder(new LineBorder(Color.black, 1, false)); 246 249 jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); … … 296 299 * @return A <code>JComboBox</code> object 297 300 */ 298 public static JComboBox createJComboBox(Rectangle bounds, 299 ListCellRenderer renderer, Color backgroundColor) { 300 JComboBox jComboBox = new JComboBox(new TypesListModel()); 301 public static JComboBox<BugType> createJComboBox(Rectangle bounds, 302 ListCellRenderer<BugType> renderer, Color backgroundColor) { 303 JComboBox<BugType> jComboBox = new JComboBox<>(new TypesListModel()); 301 304 jComboBox.setSelectedIndex(0); 302 305 jComboBox.setBackground(backgroundColor);
Note:
See TracChangeset
for help on using the changeset viewer.