Changeset 4003 in josm for trunk/src/org


Ignore:
Timestamp:
2011-03-25T21:08:07+01:00 (13 years ago)
Author:
bastiK
Message:

toString() improvements

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
2 edited

Legend:

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

    r3999 r4003  
    122122        }
    123123
     124        @Override
     125        public String toString() {
     126            return "NodeTextElement{" + toStringImpl() + '}';
     127        }
     128
     129        protected String toStringImpl() {
     130            return super.toStringImpl() + " hAlign=" + hAlign + " vAlign=" + vAlign;
     131        }
    124132    }
    125133
     
    452460    @Override
    453461    public String toString() {
    454         return "NodeElemStyle{" + super.toString() +
    455                 (icon != null ? ("icon=" + icon + " iconAlpha=" + iconAlpha) : "") +
    456                 (symbol != null ? (" symbol=[" + symbol + "]") : "") + '}';
     462        StringBuilder s = new StringBuilder("NodeElemStyle{");
     463        s.append(super.toString());
     464        if (icon != null) {
     465            s.append(" icon=" + icon + " iconAlpha=" + iconAlpha);
     466        }
     467        if (symbol != null) {
     468            s.append(" symbol=[" + symbol + "]");
     469        }
     470        if (text != null) {
     471            s.append(" text=[" + text.toStringImpl() + "]");
     472        }
     473        s.append('}');
     474        return s.toString();
    457475    }
    458476
  • trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java

    r3992 r4003  
    157157    @Override
    158158    public String toString() {
     159        return "TextElement{" + toStringImpl() + '}';
     160    }
     161
     162    protected String toStringImpl() {
    159163        StringBuilder sb = new StringBuilder();
    160         sb.append("{TextElement ");
    161         sb.append("strategy=");
    162         sb.append(labelCompositionStrategy == null ? "null" : labelCompositionStrategy.toString());
    163         sb.append("}");
     164        sb.append("labelCompositionStrategy=" + labelCompositionStrategy);
     165        sb.append(" font=" + font);
     166        if (xOffset != 0) {
     167            sb.append(" xOffset=" + xOffset);
     168        }
     169        if (yOffset != 0) {
     170            sb.append(" yOffset=" + yOffset);
     171        }
     172        sb.append(" color=" + Utils.toString(color));
     173        if (haloRadius != null) {
     174            sb.append(" haloRadius=" + haloRadius);
     175            sb.append(" haloColor=" + haloColor);
     176        }
    164177        return sb.toString();
    165178    }
Note: See TracChangeset for help on using the changeset viewer.