Changeset 2386 in josm for trunk/src


Ignore:
Timestamp:
2009-11-02T19:21:26+01:00 (14 years ago)
Author:
Gubaer
Message:

applied #3833: patch by Daeron: Small translation cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r2381 r2386  
    112112
    113113    public final static class DataCountVisitor extends AbstractVisitor {
    114         public final int[] normal = new int[3];
    115         public final int[] deleted = new int[3];
    116         public final String[] names = {
    117                 OsmPrimitiveType.NODE.getAPIName(),
    118                 OsmPrimitiveType.WAY.getAPIName(),
    119                 OsmPrimitiveType.RELATION.getAPIName()
    120         };
    121 
    122         private void inc(final OsmPrimitive osm, final int i) {
    123             normal[i]++;
    124             if (osm.isDeleted()) {
    125                 deleted[i]++;
    126             }
    127         }
     114        public int nodes;
     115        public int ways;
     116        public int relations;
     117        public int deletedNodes;
     118        public int deletedWays;
     119        public int deletedRelations;
    128120
    129121        public void visit(final Node n) {
    130             inc(n, 0);
     122            nodes++;
     123            if (n.isDeleted()) {
     124                deletedNodes++;
     125            }
    131126        }
    132127
    133128        public void visit(final Way w) {
    134             inc(w, 1);
    135         }
    136         public void visit(final Relation w) {
    137             inc(w, 2);
     129            ways++;
     130            if (w.isDeleted()) {
     131                deletedWays++;
     132            }
     133        }
     134
     135        public void visit(final Relation r) {
     136            relations++;
     137            if (r.isDeleted()) {
     138                deletedRelations++;
     139            }
    138140        }
    139141    }
     
    249251
    250252    @Override public String getToolTipText() {
    251         String tool = "";
    252         tool += undeletedSize(data.getNodes())+" "+trn("node", "nodes", undeletedSize(data.getNodes()))+", ";
    253         tool += undeletedSize(data.getWays())+" "+trn("way", "ways", undeletedSize(data.getWays()));
     253        int nodes = undeletedSize(data.getNodes());
     254        int ways = undeletedSize(data.getWays());
     255
     256        String tool = trn("{0} node", "{0} nodes", nodes, nodes)+", ";
     257        tool += trn("{0} way", "{0} ways", ways, ways);
     258
    254259        if (data.version != null) {
    255260            tool += ", " + tr("version {0}", data.version);
     
    500505        }
    501506        final JPanel p = new JPanel(new GridBagLayout());
     507
     508        String nodeText = trn("{0} node", "{0} nodes", counter.nodes, counter.nodes);
     509        if (counter.deletedNodes > 0)
     510            nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+")";
     511
     512        String wayText = trn("{0} way", "{0} ways", counter.ways, counter.ways);
     513        if (counter.deletedWays > 0)
     514            wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+")";
     515
     516        String relationText = trn("{0} relation", "{0} relations", counter.relations, counter.relations);
     517        if (counter.deletedRelations > 0)
     518            relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+")";
     519
    502520        p.add(new JLabel(tr("{0} consists of:", getName())), GBC.eol());
    503         for (int i = 0; i < counter.normal.length; ++i) {
    504             String s = counter.normal[i]+" "+trn(counter.names[i],counter.names[i]+"s",counter.normal[i]);
    505             if (counter.deleted[i] > 0) {
    506                 s += tr(" ({0} deleted.)",counter.deleted[i]);
    507             }
    508             p.add(new JLabel(s, ImageProvider.get("data", counter.names[i]), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
    509         }
     521        p.add(new JLabel(nodeText, ImageProvider.get("data", "node"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
     522        p.add(new JLabel(wayText, ImageProvider.get("data", "way"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
     523        p.add(new JLabel(relationText, ImageProvider.get("data", "relation"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
    510524        p.add(new JLabel(tr("API version: {0}", (data.version != null) ? data.version : tr("unset"))));
    511525
Note: See TracChangeset for help on using the changeset viewer.