Ignore:
Timestamp:
2014-02-17T22:59:07+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #9659 - better display of changeset source in history dialog

File:
1 edited

Legend:

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

    r6864 r6865  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.trc;
    65
    76import java.awt.BorderLayout;
     
    1514import java.util.Observer;
    1615
     16import javax.swing.JComponent;
    1717import javax.swing.JLabel;
    1818import javax.swing.JPanel;
     
    4444    private UrlLabel lblUser;
    4545    private UrlLabel lblChangeset;
    46     private JPanel pnlChangesetComment;
    4746    private JPanel pnlChangesetSource;
    48     private JLabel lblComment;
    4947    private JLabel lblSource;
    5048    private JTextArea lblChangesetComment;
     
    9391        lblChangesetSource = buildTextArea(tr("Changeset source"));
    9492
    95         lblComment = buildLabel(trc("comment", "<b>c</b>:"), tr("Changeset comment"), lblChangesetComment);
    96         lblSource = buildLabel(trc("source", "<b>s</b>:"), tr("Changeset source"), lblChangesetSource);
    97 
    98         pnlChangesetComment = buildTextPanel(lblComment, lblChangesetComment);
     93        lblSource = buildLabel(tr("<b>Source</b>:"), tr("Changeset source"), lblChangesetSource);
    9994        pnlChangesetSource = buildTextPanel(lblSource, lblChangesetSource);
    10095
     
    110105        add(pnlUserAndChangeset, gc);
    111106        gc.gridy = 2;
    112         add(pnlChangesetComment, gc);
     107        add(lblChangesetComment, gc);
    113108        gc.gridy = 3;
    114109        add(pnlChangesetSource, gc);
     
    223218
    224219        final Changeset oppCs = model.getPointInTime(pointInTimeType.opposite()).getChangeset();
    225         updateText(cs, "comment", lblChangesetComment, lblComment, oppCs, pnlChangesetComment);
     220        updateText(cs, "comment", lblChangesetComment, null, oppCs, lblChangesetComment);
    226221        updateText(cs, "source", lblChangesetSource, lblSource, oppCs, pnlChangesetSource);
    227222    }
    228223   
    229     protected static void updateText(Changeset cs, String attr, JTextArea textArea, JLabel label, Changeset oppCs, JPanel panel) {
     224    protected static void updateText(Changeset cs, String attr, JTextArea textArea, JLabel label, Changeset oppCs, JComponent container) {
    230225        final String text = cs != null ? cs.get(attr) : null;
    231226        // Update text, hide prefixing label if empty
    232         label.setVisible(text != null && !Utils.strip(text).isEmpty());
     227        if (label != null) {
     228            label.setVisible(text != null && !Utils.strip(text).isEmpty());
     229        }
    233230        textArea.setText(text);
    234         // Hide panel if values of both versions are empty
    235         panel.setVisible(text != null || (oppCs != null && oppCs.get(attr) != null));
     231        // Hide container if values of both versions are empty
     232        container.setVisible(text != null || (oppCs != null && oppCs.get(attr) != null));
    236233    }
    237234}
Note: See TracChangeset for help on using the changeset viewer.