Changeset 15824 in josm


Ignore:
Timestamp:
2020-02-06T21:59:49+01:00 (3 weeks ago)
Author:
Don-vip
Message:

fix #18677 - Add "download" and "locked" status to osm data layer info

File:
1 edited

Legend:

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

    r15496 r15824  
    715715        p.add(new JLabel(tr("API version: {0}", (data.getVersion() != null) ? data.getVersion() : tr("unset"))),
    716716                GBC.eop().insets(15, 0, 0, 0));
    717         if (isUploadDiscouraged()) {
    718             p.add(new JLabel(tr("Upload is discouraged")), GBC.eop().insets(15, 0, 0, 0));
    719         }
    720         if (data.getUploadPolicy() == UploadPolicy.BLOCKED) {
    721             p.add(new JLabel(tr("Upload is blocked")), GBC.eop().insets(15, 0, 0, 0));
    722         }
     717        addConditionalInformation(p, tr("Layer is locked"), isLocked());
     718        addConditionalInformation(p, tr("Download is blocked"), data.getDownloadPolicy() == DownloadPolicy.BLOCKED);
     719        addConditionalInformation(p, tr("Upload is discouraged"), isUploadDiscouraged());
     720        addConditionalInformation(p, tr("Upload is blocked"), data.getUploadPolicy() == UploadPolicy.BLOCKED);
    723721
    724722        return p;
    725723    }
    726724
    727     @Override public Action[] getMenuEntries() {
     725    private static void addConditionalInformation(JPanel p, String text, boolean condition) {
     726        if (condition) {
     727            p.add(new JLabel(text), GBC.eop().insets(15, 0, 0, 0));
     728        }
     729    }
     730
     731    @Override
     732    public Action[] getMenuEntries() {
    728733        List<Action> actions = new ArrayList<>();
    729734        actions.addAll(Arrays.asList(
Note: See TracChangeset for help on using the changeset viewer.