Changeset 1423 for trunk


Ignore:
Timestamp:
07/31/19 12:19:15 (5 years ago)
Author:
bln4
Message:

When setting encryption label on a XRayable then pass that instruction along to the source.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/XRayable.java

    r1420 r1423  
    2525import org.expeditee.core.Colour;
    2626import org.expeditee.core.Point;
     27import org.expeditee.encryption.items.surrogates.Label;
    2728import org.expeditee.gui.DisplayController;
    2829
     
    4142        @Override
    4243        public void setEncryptionLabel(String label) {
    43                 // When the encryption label is set on a XRayable is sets it on its source as well.
    44                 super.setEncryptionLabel(label);
    4544                _source.setEncryptionLabel(label);
     45        }
     46       
     47        public boolean sourceIsAccessible() {
     48                String encryptionLabel = _source.getEncryptionLabel();
     49                if (encryptionLabel == null || encryptionLabel.isEmpty()) {
     50                        return true;
     51                } else {
     52                        List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(this.getParent().getBody());
     53                        return accessibleLabelsNames.contains(encryptionLabel);
     54                }
    4655        }
    4756       
Note: See TracChangeset for help on using the changeset viewer.