Changeset 6865 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-02-17T22:59:07+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r6864 r6865 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trc;6 5 7 6 import java.awt.BorderLayout; … … 15 14 import java.util.Observer; 16 15 16 import javax.swing.JComponent; 17 17 import javax.swing.JLabel; 18 18 import javax.swing.JPanel; … … 44 44 private UrlLabel lblUser; 45 45 private UrlLabel lblChangeset; 46 private JPanel pnlChangesetComment;47 46 private JPanel pnlChangesetSource; 48 private JLabel lblComment;49 47 private JLabel lblSource; 50 48 private JTextArea lblChangesetComment; … … 93 91 lblChangesetSource = buildTextArea(tr("Changeset source")); 94 92 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); 99 94 pnlChangesetSource = buildTextPanel(lblSource, lblChangesetSource); 100 95 … … 110 105 add(pnlUserAndChangeset, gc); 111 106 gc.gridy = 2; 112 add( pnlChangesetComment, gc);107 add(lblChangesetComment, gc); 113 108 gc.gridy = 3; 114 109 add(pnlChangesetSource, gc); … … 223 218 224 219 final Changeset oppCs = model.getPointInTime(pointInTimeType.opposite()).getChangeset(); 225 updateText(cs, "comment", lblChangesetComment, lblComment, oppCs, pnlChangesetComment);220 updateText(cs, "comment", lblChangesetComment, null, oppCs, lblChangesetComment); 226 221 updateText(cs, "source", lblChangesetSource, lblSource, oppCs, pnlChangesetSource); 227 222 } 228 223 229 protected static void updateText(Changeset cs, String attr, JTextArea textArea, JLabel label, Changeset oppCs, J Panel panel) {224 protected static void updateText(Changeset cs, String attr, JTextArea textArea, JLabel label, Changeset oppCs, JComponent container) { 230 225 final String text = cs != null ? cs.get(attr) : null; 231 226 // 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 } 233 230 textArea.setText(text); 234 // Hide panelif values of both versions are empty235 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)); 236 233 } 237 234 }
Note:
See TracChangeset
for help on using the changeset viewer.