Changeset 29388 in osm for applications/editors/josm/plugins
- Timestamp:
- 2013-03-23T18:45:59+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/imagery_offset_db/src/iodb
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery_offset_db/src/iodb/IODBReader.java
r29384 r29388 100 100 fields.position = parseLatLon(attributes); 101 101 fields.id = Integer.parseInt(attributes.getValue("id")); 102 if( attributes.getValue("flagged") != null && attributes.getValue("flagged").equals("yes") ) 103 fields.flagged = true; 102 104 } 103 105 } else { … … 183 185 public String imagery; 184 186 public int minZoom, maxZoom; 187 public boolean flagged; 185 188 public List<LatLon> geometry; 186 189 … … 208 211 minZoom = -1; 209 212 maxZoom = -1; 213 flagged = false; 210 214 geometry = new ArrayList<LatLon>(); 211 215 } … … 234 238 result.setBasicInfo(position, author, description, date); 235 239 result.setDeprecated(abandonDate, abandonAuthor, abandonReason); 240 if( flagged ) 241 result.setFlagged(flagged); 236 242 return result; 237 243 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/ImageryOffsetBase.java
r29384 r29388 23 23 protected String abandonAuthor; 24 24 protected String abandonReason; 25 protected boolean flagged; 25 26 26 27 /** … … 34 35 this.date = date; 35 36 this.abandonDate = null; 37 this.flagged = false; 36 38 } 37 39 … … 52 54 this.abandonAuthor = author; 53 55 this.abandonReason = reason; 56 } 57 58 public boolean isFlagged() { 59 return flagged; 60 } 61 62 public void setFlagged( boolean flagged ) { 63 this.flagged = flagged; 54 64 } 55 65 -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java
r29386 r29388 214 214 } else 215 215 selectedOffset = null; 216 NavigatableComponent.removeZoomChangeListener(this); 217 setVisible(false); 216 boolean closeDialog = MODAL || selectedOffset == null 217 || selectedOffset instanceof CalibrationObject 218 || Main.pref.getBoolean("iodb.close.on.select", true); 219 if( closeDialog ) { 220 NavigatableComponent.removeZoomChangeListener(this); 221 setVisible(false); 222 } 218 223 if( !MODAL ) { 219 Main.map.mapView.removeTemporaryLayer(this); 220 Main.map.mapView.repaint(); 221 if( selectedOffset != null ) 224 if( closeDialog ) { 225 Main.map.mapView.removeTemporaryLayer(this); 226 Main.map.mapView.repaint(); 227 } 228 if( selectedOffset != null ) { 222 229 applyOffset(); 230 if( !closeDialog ) 231 updateButtonPanel(); 232 } 223 233 } 224 234 } -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialogButton.java
r29386 r29388 72 72 73 73 String description = offset.isDeprecated() ? offset.getAbandonReason() : offset.getDescription(); 74 description = description.replace("<", "<").replace(">", ">"); 74 75 JLabel descriptionLabel = new JLabel("<html><div style=\"width: 300px;\">"+description+"</div></html>"); 76 Font descriptionFont = new Font(descriptionLabel.getFont().getName(), Font.BOLD, descriptionLabel.getFont().getSize() - 2); 77 descriptionLabel.setFont(descriptionFont); 75 78 76 79 double offsetDistance = offset instanceof ImageryOffset -
applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetInfoAction.java
r29387 r29388 2 2 3 3 import java.awt.event.ActionEvent; 4 import java.io.UnsupportedEncodingException; 5 import java.net.URLEncoder; 4 6 import java.text.SimpleDateFormat; 5 7 import javax.swing.AbstractAction; … … 18 20 public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd MMMM yyyy"); 19 21 20 private Object info;22 ImageryOffsetBase offset; 21 23 22 24 /** … … 27 29 super(tr("Offset Information")); 28 30 putValue(SMALL_ICON, ImageProvider.get("info")); 29 if( offset != null ) 30 this.info = getInformationObject(offset); 31 this.offset = offset; 31 32 setEnabled(offset != null); 32 33 } 33 34 34 35 /** 35 * Shows a dialog with the pre-constructed message. 36 * Shows a dialog with the pre-constructed message. Allows a user 37 * to report the given offset. 36 38 */ 37 39 public void actionPerformed(ActionEvent e) { 38 JOptionPane.showMessageDialog(Main.parent, info, ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE); 40 Object info = offset == null ? null : getInformationObject(offset); 41 if( offset.isFlagged() ) 42 JOptionPane.showMessageDialog(Main.parent, info, ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE); 43 else { 44 int result = JOptionPane.showOptionDialog(Main.parent, info, ImageryOffsetTools.DIALOG_TITLE, 45 JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, 46 new String[] { "OK", tr("Report this offset") }, null); 47 if( result == 1 ) { 48 // ask for a reason 49 Object reason = JOptionPane.showInputDialog(Main.parent, 50 tr("You are to notify moderators of this offset. Why they should look into this case?"), 51 ImageryOffsetTools.DIALOG_TITLE, JOptionPane.PLAIN_MESSAGE); 52 if( reason != null && reason.toString().length() > 0 ) { 53 try { 54 String query = "report?id=" + offset.getId() 55 + "&reason=" + URLEncoder.encode(reason.toString(), "UTF8"); 56 SimpleOffsetQueryTask reportTask = 57 new SimpleOffsetQueryTask(query, tr("Reporting the offset...")); 58 Main.worker.submit(reportTask); 59 } catch( UnsupportedEncodingException ex ) { 60 // WTF 61 } 62 } 63 } 64 } 39 65 } 40 66 … … 57 83 ImageryOffsetTools.formatDistance(dist))); 58 84 59 sb.append( '\n').append('\n');60 sb.append(tr("Created by {0} on {1} \n", offset.getAuthor(),85 sb.append("\n\n"); 86 sb.append(tr("Created by {0} on {1}", offset.getAuthor(), 61 87 DATE_FORMAT.format(offset.getDate()))).append('\n'); 62 88 sb.append(tr("Description")).append(": ").append(offset.getDescription()); 63 89 64 90 if( offset.isDeprecated() ) { 65 sb.append( '\n').append('\n');66 sb.append(tr("Deprecated by {0} on {1} \n",offset.getAbandonAuthor(),91 sb.append("\n\n"); 92 sb.append(tr("Deprecated by {0} on {1}",offset.getAbandonAuthor(), 67 93 DATE_FORMAT.format(offset.getAbandonDate()))).append('\n'); 68 94 sb.append(tr("Reason")).append(": ").append(offset.getAbandonReason()); 69 95 } 96 97 if( offset.isFlagged() ) { 98 sb.append("\n\n").append(tr("This entry has been reported.")); 99 } 100 70 101 return sb.toString(); 71 102 }
Note:
See TracChangeset
for help on using the changeset viewer.