Ignore:
Timestamp:
2015-05-18T02:14:30+02:00 (9 years ago)
Author:
Don-vip
Message:

Sonar - various performance improvements

File:
1 edited

Legend:

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

    r8378 r8390  
    572572         */
    573573        private JLabel popupBuildPrimitiveLabels(final OsmPrimitive osm) {
    574             final StringBuilder text = new StringBuilder();
     574            final StringBuilder text = new StringBuilder(32);
    575575            String name = osm.getDisplayName(DefaultNameFormatter.getInstance());
    576576            if (osm.isNewOrUndeleted() || osm.isModified()) {
     
    583583
    584584            if (!osm.isNew() && !idShown) {
    585                 text.append(" [id="+osm.getId()+"]");
     585                text.append(" [id=").append(osm.getId()).append(']');
    586586            }
    587587
    588588            if(osm.getUser() != null) {
    589                 text.append(" [" + tr("User:") + " " + osm.getUser().getName() + "]");
     589                text.append(" [").append(tr("User:")).append(' ').append(osm.getUser().getName()).append(']');
    590590            }
    591591
    592592            for (String key : osm.keySet()) {
    593                 text.append("<br>" + key + "=" + osm.get(key));
     593                text.append("<br>").append(key).append('=').append(osm.get(key));
    594594            }
    595595
    596596            final JLabel l = new JLabel(
    597                     "<html>" +text.toString() + "</html>",
     597                    "<html>" + text.toString() + "</html>",
    598598                    ImageProvider.get(osm.getDisplayType()),
    599599                    JLabel.HORIZONTAL
     
    601601                // This is necessary so the label updates its colors when the
    602602                // selection is changed from the outside
    603                 @Override public void validate() {
     603                @Override
     604                public void validate() {
    604605                    super.validate();
    605606                    popupSetLabelColors(this, osm);
     
    613614            l.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    614615            l.addMouseListener(new MouseAdapter(){
    615                 @Override public void mouseEntered(MouseEvent e) {
     616                @Override
     617                public void mouseEntered(MouseEvent e) {
    616618                    l.setBackground(SystemColor.info);
    617619                    l.setForeground(SystemColor.infoText);
    618620                }
    619                 @Override public void mouseExited(MouseEvent e) {
     621                @Override
     622                public void mouseExited(MouseEvent e) {
    620623                    popupSetLabelColors(l, osm);
    621624                }
    622                 @Override public void mouseClicked(MouseEvent e) {
     625                @Override
     626                public void mouseClicked(MouseEvent e) {
    623627                    DataSet ds = Main.main.getCurrentDataSet();
    624628                    // Let the user toggle the selection
Note: See TracChangeset for help on using the changeset viewer.