Changeset 5059 in josm for trunk


Ignore:
Timestamp:
2012-03-08T22:01:06+01:00 (8 years ago)
Author:
simon04
Message:

fix #6561 - fix several overflowing dialog texts

Location:
trunk/src/org/openstreetmap/josm
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r4982 r5059  
    215215                    HelpAwareOptionPane.showOptionDialog(
    216216                            Main.parent,
    217                             tr(
    218                                     "Cannot merge nodes: Would have to delete way ''{0}'' which is still used.",
    219                                     w.getDisplayName(DefaultNameFormatter.getInstance())
    220                             ),
     217                            tr("Cannot merge nodes: Would have to delete way {0} which is still used by {1}",
     218                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w),
     219                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w.getReferrers())),
    221220                            tr("Warning"),
    222221                            JOptionPane.WARNING_MESSAGE,
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java

    r4907 r5059  
    160160        };
    161161
    162         String message = "<html>"
    163                 + trn("There is {0} object in your local dataset which "
    164                         + "might be deleted on the server. If you later try to delete or "
    165                         + "update this the server is likely to report a conflict.",
    166                         "There are {0} objects in your local dataset which "
    167                                 + "might be deleted on the server. If you later try to delete or "
    168                                 + "update them the server is likely to report a conflict.", potentiallyDeleted.size(), potentiallyDeleted.size())
    169                                 + "<br>"
    170                                 + trn("Click <strong>{0}</strong> to check the state of this object on the server.",
    171                                         "Click <strong>{0}</strong> to check the state of these objects on the server.",
    172                                         potentiallyDeleted.size(),
    173                                         options[0].text) + "<br>"
    174                                         + tr("Click <strong>{0}</strong> to ignore." + "</html>", options[1].text);
     162        String message = "<html>" + trn(
     163                "There is {0} object in your local dataset which "
     164                + "might be deleted on the server.<br>If you later try to delete or "
     165                + "update this the server is likely to report a conflict.",
     166                "There are {0} objects in your local dataset which "
     167                + "might be deleted on the server.<br>If you later try to delete or "
     168                + "update them the server is likely to report a conflict.",
     169                potentiallyDeleted.size(), potentiallyDeleted.size())
     170                + "<br>"
     171                + trn("Click <strong>{0}</strong> to check the state of this object on the server.",
     172                "Click <strong>{0}</strong> to check the state of these objects on the server.",
     173                potentiallyDeleted.size(),
     174                options[0].text) + "<br>"
     175                + tr("Click <strong>{0}</strong> to ignore." + "</html>", options[1].text);
    175176
    176177        int ret = HelpAwareOptionPane.showOptionDialog(
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r4918 r5059  
    474474
    475475    private static boolean confirmRelationDeletion(Collection<Relation> relations) {
    476         String relationString = "<ul>";
    477         for(Relation r:relations) {
    478             relationString += "<li>"+DefaultNameFormatter.getInstance().format(r) + "</li>";
    479         }
    480         relationString += "</ul>";
    481        
    482476        JPanel msg = new JPanel(new GridBagLayout());
    483477        msg.add(new JLabel("<html>" + trn(
     
    492486                + "<br/>"
    493487                + "Do you really want to delete?",
    494                 relations.size(), relations.size(), relationString) + "</html>"));
     488                relations.size(), relations.size(), DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(relations))
     489                + "</html>"));
    495490        boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
    496491                "delete_relations",
  • trunk/src/org/openstreetmap/josm/data/osm/DataIntegrityProblemException.java

    r3083 r5059  
    44public class DataIntegrityProblemException extends RuntimeException {
    55
     6    private String htmlMessage;
     7
    68    public DataIntegrityProblemException(String message) {
    79        super(message);
    810    }
    911
     12    public DataIntegrityProblemException(String message, String htmlMessage) {
     13        super(message);
     14        this.htmlMessage = htmlMessage;
     15    }
     16
     17    public String getHtmlMessage() {
     18        return htmlMessage;
     19    }
    1020}
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r4682 r5059  
    1414import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
    1515import org.openstreetmap.josm.data.osm.visitor.Visitor;
     16import org.openstreetmap.josm.gui.DefaultNameFormatter;
    1617import org.openstreetmap.josm.tools.CopyList;
    1718import org.openstreetmap.josm.tools.Pair;
     
    508509            for (Node n: nodes) {
    509510                if (n.getDataSet() != dataSet)
    510                     throw new DataIntegrityProblemException("Nodes in way must be in the same dataset");
     511                    throw new DataIntegrityProblemException("Nodes in way must be in the same dataset",
     512                            tr("Nodes in way must be in the same dataset"));
    511513                if (n.isDeleted())
    512                     throw new DataIntegrityProblemException("Deleted node referenced: " + toString());
     514                    throw new DataIntegrityProblemException("Deleted node referenced: " + toString(),
     515                            "<html>" + tr("Deleted node referenced by {0}", DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>");
    513516            }
    514517            if (Main.pref.getBoolean("debug.checkNullCoor", true)) {
    515518                for (Node n: nodes) {
    516519                    if (!n.isIncomplete() && (n.getCoor() == null || n.getEastNorth() == null))
    517                         throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + n.get3892DebugInfo());
     520                        throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + n.get3892DebugInfo(),
     521                                "<html>" + tr("Complete node {0} with null coordinates in way {1}",
     522                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(n),
     523                                DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this)) + "</html>");
    518524                }
    519525            }
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r4882 r5059  
    99import java.util.ArrayList;
    1010import java.util.Arrays;
     11import java.util.Collection;
    1112import java.util.Collections;
    1213import java.util.Comparator;
     
    2324import org.openstreetmap.josm.data.osm.NameFormatter;
    2425import org.openstreetmap.josm.data.osm.Node;
     26import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2527import org.openstreetmap.josm.data.osm.OsmUtils;
    2628import org.openstreetmap.josm.data.osm.Relation;
     
    708710        return sb.toString();
    709711    }
     712
     713    public String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives) {
     714        StringBuilder sb = new StringBuilder(1024);
     715        sb.append("<ul>");
     716        for (OsmPrimitive i : primitives) {
     717            sb.append("<li>").append(i.getDisplayName(this)).append("</li>");
     718        }
     719        sb.append("</ul>");
     720        return sb.toString();
     721    }
     722
     723    public String formatAsHtmlUnorderedList(OsmPrimitive... primitives) {
     724        return formatAsHtmlUnorderedList(Arrays.asList(primitives));
     725    }
    710726}
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r5025 r5059  
    329329            JOptionPane.showMessageDialog(
    330330                    Main.parent,
    331                     e.getMessage(),
     331                    e.getHtmlMessage() != null ? e.getHtmlMessage() : e.getMessage(),
    332332                    tr("Error"),
    333333                    JOptionPane.ERROR_MESSAGE
Note: See TracChangeset for help on using the changeset viewer.