Ignore:
Timestamp:
08/14/19 14:22:44 (5 years ago)
Author:
bln4
Message:

Fixed bug for when there are no surrogates left for a primary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/encryption/Actions.java

    r1414 r1430  
    2323import org.expeditee.gui.Frame;
    2424import org.expeditee.gui.FrameIO;
     25import org.expeditee.gui.MessageBay;
    2526import org.expeditee.items.Item;
    2627import org.expeditee.items.Text;
     
    3132public class Actions implements CryptographyConstants {
    3233       
    33         public static void TestSurrogate(Item primary) {
    34                 System.out.println("Test surrogates: ");
     34        public static void SetSurrogateFor(Text surrogate, Text action) {
     35                Frame frame = DisplayController.getCurrentFrame();
     36                String[] split = action.getText().split(" ");
     37               
     38                if (split.length >= 2) {
     39                        int primaryID = Integer.parseInt(split[1]);
     40                        Item itemWithID = frame.getItemWithID(primaryID);
     41                        if (itemWithID == null) {
     42                                MessageBay.displayMessage("No item with ID " + primaryID + " exists on this frame.");
     43                                return;
     44                        } else {
     45                                itemWithID.addToSurrogates(surrogate);
     46                        }
     47                } else {
     48                        MessageBay.displayMessage("Usage: SetSurrogateFor Int, inject desired surrogate.");
     49                }
    3550        }
    3651       
Note: See TracChangeset for help on using the changeset viewer.