Ignore:
Timestamp:
11/08/19 13:23:37 (5 years ago)
Author:
bnemhaus
Message:

Changed Label::progressSurrogate mode so that a null return values signifies that asking for surrogate mode makes no sense because there are no labels in play.

Fixed bug with DisplayController::toggleSurrogateMode. It was printing incorrect messages to the message bay when the user was supposed to be exiting surrogate mode. This was fixed by querying Label::isInSurrogateMode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/encryption/items/surrogates/Label.java

    r1431 r1443  
    3838        }
    3939       
     40        public static boolean isInSurrogateMode() {
     41                return isInSurrogateMode;
     42        }
     43       
     44        /**
     45         * Progresses surrogate mode and returns a list of labels that are currently in effect.
     46         * @param context The list of expeditee Items to be considered for context.  These are checked for labels.
     47         * @return Returns either:
     48         *      <ol type='a'>
     49         *              <li> A list of length 1 specifying the label that the current surrogate mode accepts or </li>
     50         *              <li> A list of length 0 which specifies that surrogate mode is in unprivileged view or </li>
     51         *              <li> Null, which means there are no labels in play on this frame
     52         *                      (so asking for surrogate mode does not make sense) </li>
     53         *  </ol>
     54         */
    4055        public static List<String> progressSurrogateMode(ItemsList context) {
    4156                // Maintain the local cache of user labels
     
    4560               
    4661                List<String> localLabels = getLabelsFromContext(context);
    47                 if (userLabels.isEmpty() || localLabels.isEmpty()) {
    48                         // If either the labels in the context are empty or the user
    49                         // has no labels then we are not able to enter surrogate mode.
    50                         return userLabels;
    51                 }
     62                if (localLabels.isEmpty()) {
     63                        // If there are no labels on this Frame return null;
     64                        return null;
     65                }
    5266               
    5367                ArrayList<String> intersection = new ArrayList<String>(userLabels);
Note: See TracChangeset for help on using the changeset viewer.