Changeset 32848 in osm for applications/editors/josm/plugins/pointInfo/src/org/openstreetmap
- Timestamp:
- 2016-08-20T04:27:57+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java
r32846 r32848 17 17 import javax.swing.JScrollPane; 18 18 import javax.swing.event.HyperlinkEvent; 19 import javax.swing.event.HyperlinkListener;20 19 21 20 import org.openstreetmap.josm.Main; … … 93 92 msgLabel.setEditable(false); 94 93 msgLabel.setOpaque(false); 95 msgLabel.addHyperlinkListener(new HyperlinkListener() { 96 @Override 97 public void hyperlinkUpdate(HyperlinkEvent hle) { 98 if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) { 99 if (hle.getURL() == null || hle.getURL().toString().isEmpty()) { 100 return; 101 } 102 System.out.println("URL: "+ hle.getURL()); 103 if (!hle.getURL().toString().startsWith("http")) { 104 mRuian.performAction(hle.getURL().toString()); 105 } else { 106 String ret = OpenBrowser.displayUrl(hle.getURL().toString()); 107 if (ret != null) { 108 PointInfoUtils.showNotification(ret, "error"); 109 } 94 msgLabel.addHyperlinkListener(hle -> { 95 if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) { 96 if (hle.getURL() == null || hle.getURL().toString().isEmpty()) { 97 return; 98 } 99 System.out.println("URL: "+ hle.getURL()); 100 if (!hle.getURL().toString().startsWith("http")) { 101 mRuian.performAction(hle.getURL().toString()); 102 } else { 103 String ret = OpenBrowser.displayUrl(hle.getURL().toString()); 104 if (ret != null) { 105 PointInfoUtils.showNotification(ret, "error"); 110 106 } 111 107 } … … 127 123 new Thread(infoTask).start(); 128 124 } catch (Exception e) { 129 e.printStackTrace();125 Main.error(e); 130 126 } 131 127 } -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoPlugin.java
r32845 r32848 13 13 public class PointInfoPlugin extends Plugin { 14 14 15 /** 16 * Constructs a new {@code PointInfoPlugin}. 17 * @param info plugin information 18 */ 15 19 public PointInfoPlugin(PluginInformation info) { 16 20 super(info); -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoUtils.java
r32846 r32848 9 9 import org.openstreetmap.josm.gui.Notification; 10 10 11 public abstract class PointInfoUtils { 11 public final class PointInfoUtils { 12 13 private PointInfoUtils() { 14 // Hide default constructor for utilities classes 15 } 12 16 13 17 /** … … 19 23 Notification note = new Notification(message); 20 24 21 if ( type.equals("info"))25 if ("info".equals(type)) 22 26 note.setIcon(JOptionPane.INFORMATION_MESSAGE); 23 else if ( type.equals("warning"))27 else if ("warning".equals(type)) 24 28 note.setIcon(JOptionPane.WARNING_MESSAGE); 25 else if ( type.equals("error"))29 else if ("error".equals(type)) 26 30 note.setIcon(JOptionPane.ERROR_MESSAGE); 27 31 else … … 40 44 public static String formatCoordinates(double lat, double lon) { 41 45 42 String r = "";43 46 DecimalFormatSymbols symbols = new DecimalFormatSymbols(); 44 47 symbols.setDecimalSeparator('.'); … … 46 49 DecimalFormat df = new DecimalFormat("#.00000", symbols); 47 50 48 r = "(" + df.format(lat) + ", " + df.format(lon) + ")"; 49 return r; 51 return "(" + df.format(lat) + ", " + df.format(lon) + ")"; 50 52 } 51 53 } -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/AddrPlaces.java
r32845 r32848 218 218 219 219 public String getVzdalenost() { 220 DecimalFormat df = new DecimalFormat("0.00"); 221 return df.format(m_vzdalenost) + "m"; 220 return new DecimalFormat("0.00").format(m_vzdalenost) + "m"; 222 221 } 223 222 } -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/RuianModule.java
r32846 r32848 14 14 public class RuianModule { 15 15 16 private String m_text = "";17 16 private String URL = "http://josm.poloha.net/pointInfo/v4/index.php"; 18 17 -
applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/ruian/RuianRecord.java
r32846 r32848 128 128 m_katastr_kraj_kod = 0; 129 129 m_katastr_kraj = ""; 130 131 130 } 132 131 133 132 /** 134 133 * Parse given JSON string and fill variables with RUIAN data 135 * 134 * @param jsonStr JSON string 136 135 */ 137 136 public void parseJSON(String jsonStr) { … … 663 662 664 663 if (m_objekt_ruian_id == 0 && 665 666 667 668 664 m_parcela_ruian_id == 0 && 665 m_adresni_mista.size() == 0 && 666 m_ulice_ruian_id == 0 && 667 m_katastr_ruian_id == 0) 669 668 return ""; 670 669 … … 769 768 770 769 // Reported errors 771 if (m_objekt_ruian_id > 0 && !m_err_user. equals("")) {770 if (m_objekt_ruian_id > 0 && !m_err_user.isEmpty()) { 772 771 r.append("<i><u>Nahlášený problém</u></i>"); 773 772 r.append(" <a href=" + url_ruian_error + m_objekt_ruian_id + ">"+ icon_ext_link +"</a><br/>"); … … 778 777 r.append("<b>Typ problému: </b>" + m_err_type); 779 778 r.append("<br/>"); 780 if (!m_err_note. equals("")) {779 if (!m_err_note.isEmpty()) { 781 780 r.append("<b>Poznámka: </b>" + m_err_note); 782 781 r.append("<br/>"); … … 842 841 843 842 // Near address places 844 if ( m_adresni_mista.size() > 0&& m_objekt_ruian_id == 0) {843 if (!m_adresni_mista.isEmpty() && m_objekt_ruian_id == 0) { 845 844 String x, x_name; 846 845 r.append("<i><u>Adresní místa v okolí</u></i><br/>"); … … 886 885 } 887 886 888 if ( m_so_bez_geometrie.size() > 0) {887 if (!m_so_bez_geometrie.isEmpty()) { 889 888 r.append("<i><u>Budovy bez geometrie v okolí</u></i><br/>"); 890 889 r.append("<table>"); … … 922 921 String[] parts = ruianDate.split("\\."); 923 922 try { 924 int day = Integer. valueOf(parts[0]);925 int month = Integer. valueOf(parts[1]);926 int year = Integer. valueOf(parts[2]);923 int day = Integer.parseInt(parts[0]); 924 int month = Integer.parseInt(parts[1]); 925 int year = Integer.parseInt(parts[2]); 927 926 r = Integer.toString(year) + "-" + String.format("%02d", month) + "-" + String.format("%02d", day); 928 927 } catch (Exception e) { … … 940 939 */ 941 940 String tagToString(String k, String v) { 942 String r = "\"" + k + "\"=\"" + v + "\"\n"; 943 return r; 941 return "\"" + k + "\"=\"" + v + "\"\n"; 944 942 } 945 943 … … 977 975 if (keyType.startsWith("ghost") && !m_so_bez_geometrie.isEmpty()) { 978 976 String[] key = keyType.split(":"); 979 int i = Integer. valueOf(key[1]);977 int i = Integer.parseInt(key[1]); 980 978 System.out.println("Ghost ID: " + i); 981 979 … … 1098 1096 if (cmd.startsWith("tags.create-on-place")) { 1099 1097 String[] key = cmd.split(":"); 1100 int i = Integer. valueOf(key[1]);1098 int i = Integer.parseInt(key[1]); 1101 1099 node = new Node(m_adresni_mista.get(i).getPosition()); 1102 1100 } else {
Note:
See TracChangeset
for help on using the changeset viewer.