Changeset 1321 for trunk


Ignore:
Timestamp:
04/17/19 11:30:18 (5 years ago)
Author:
bln4
Message:

Added the ability to use strings as item tags in .exp files. In order to maintain back compatibility and to maximise efficiency, these strings must start with a underscore character.

Location:
trunk/src/org/expeditee
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/assets/resources-public/framesets/authentication/1.exp

    r1311 r1321  
    1 V 788
     1V 800
    22p 40
    33U authadmin
    44D 23Nov2018[12:31]
    55M authadmin
    6 d 15Apr2019[15:11]
     6d 17Apr2019[11:24]
    77B 100 100 39 100
    88Z
     
    7474K 0 0 0 100
    7575P 350 287
    76 T bln4
     76T
    7777x F
    7878D txtUsername
     
    8888h 1.0
    8989p 44
    90 = Username
     90_ph Username
    9191
    9292S T 1291
     
    111111h 1.0
    112112p 44
    113 = Password
     113_ph Password
    114114
    115115S T 1374
     
    181181Z
    182182
    183 ActiveTime:13802283:07:22
    184 DarkTime:-13797066:-21:-5
    185 11:53:057 89 251 Md
    186 11:53:179 89 252 Rd
    187 11:53:568 89 252 Ru
    188 11:53:633 89 252 Mu
     183ActiveTime:16394710:10:09
     184DarkTime:-16387934:-21:-21
     18524:22:328 83 242 kSHIFT
     18624:22:571 83 242 kT
     18724:22:746 94 242 kO
     18824:23:091 103 242 kG
     18924:23:241 112 242 kG
     19024:23:371 121 242 kL
     19124:23:492 126 242 kE
     19224:26:443 134 242 kBACKSPACE
     19324:26:587 126 242 kBACKSPACE
     19424:26:731 121 242 kBACKSPACE
     19524:26:834 112 242 kBACKSPACE
     19624:26:971 103 242 kBACKSPACE
     19724:27:098 94 242 kBACKSPACE
  • trunk/src/org/expeditee/assets/resources-public/framesets/authentication/2.exp

    r1311 r1321  
    1 V 250
     1V 254
    22p 40
    33U authadmin
    44D 07Dec2018[12:19]
    55M authadmin
    6 d 15Apr2019[15:12]
     6d 17Apr2019[11:24]
    77B 100 100 39 100
    88Z
     
    103103h 1.0
    104104p 44
    105 = Username
     105_ph Username
    106106
    107107S T 111
     
    126126h 1.0
    127127p 44
    128 = Password
     128_ph Password
    129129
    130130S T 130
     
    149149h 1.0
    150150p 44
    151 = Password Again
     151_ph Password Again
    152152
    153153S T 672
     
    171171h 1.0
    172172p 44
    173 = Email Again
     173_ph Email Again
    174174
    175175S T 671
     
    193193h 1.0
    194194p 44
    195 = Email
     195_ph Email
    196196
    197197S T 190
     
    263263Z
    264264
    265 ActiveTime:01:11:23
     265ActiveTime:01:14:57
    266266DarkTime:01:31:57
    267 12:56:260 116 494 Md
    268 12:56:379 116 498 Rd
    269 12:56:562 115 501 Ru
    270 12:56:601 115 501 Mu
    271 12:57:073 157 494 kLEFT_ARROW
     26724:15:545 211 281 Ld
     26824:15:698 211 281 Rd
     26924:15:841 211 281 Ru
     27024:15:872 211 281 Lu
     27124:17:969 41 223 Md
     27224:18:132 41 223 Rd
     27324:18:649 41 223 Mu
     27424:18:657 41 223 Ru
     27524:21:195 41 223 kLEFT_ARROW
  • trunk/src/org/expeditee/auth/Actions.java

    r1320 r1321  
    392392                String message = "Creating new user account...";
    393393                int progress = 0;
    394                 int step = 20;
     394                int step = 16;
    395395
    396396                // Extract user details
     
    519519                Path destinationFile = destinationDirectory.resolve(AuthenticatorBrowser.CREDENTIALS_FRAME + ExpReader.EXTENTION);
    520520                FrameIO.migrateFrame(credentialsFrame, destinationFile);
    521                
    522                 MessageBay.displayMessage(message + "Creating Individual Space.");
     521
     522                try {
     523                        progressBar.UpdateMessage(message + "Creating Individual Space.", progress += step);
     524                } catch (Exception e) {
     525                        e.printStackTrace();
     526                }
    523527                DisplayController.refreshBayArea();
    524528               
     
    543547               
    544548                try {
    545                         progressBar.UpdateMessage(message + "Done.", progress += step);
     549                        progressBar.UpdateMessage(message + "Done.", 100);
    546550                } catch (Exception e) {
    547551                        e.printStackTrace();
  • trunk/src/org/expeditee/auth/account/Authenticate.java

    r1320 r1321  
    2525import org.expeditee.auth.Actions;
    2626import org.expeditee.auth.AuthenticatorBrowser;
    27 import org.expeditee.auth.Mail;
    2827import org.expeditee.auth.gui.MailBay;
    2928import org.expeditee.auth.tags.AuthenticationTag;
  • trunk/src/org/expeditee/io/DefaultFrameReader.java

    r1296 r1321  
    4646       
    4747        protected static LinkedHashMap<Character, Method> _ItemTags = null;
     48        // IMPORTANT: keys in _ItemTagsExt must start with underscore as their first character
     49        protected static LinkedHashMap<String, Method> _ItemTagsExt = null;
    4850       
    4951        protected static List<Character> _DelayedItemTags = null;
     
    7476
    7577                _ItemTags = new LinkedHashMap<Character, Method>();
     78                _ItemTagsExt = new LinkedHashMap<String, Method>();
    7679                _FrameTags = new LinkedHashMap<Character, Method>();
    7780                _DelayedItemTags = new LinkedList<Character>();
     
    161164                        _ItemTags.put('O', Text.class.getMethod("setMask", pIntO));
    162165                       
    163                         _ItemTags.put('=', Text.class.getMethod("setPlaceholder", pString));
    164                        
    165166                        // Lines and constraints are created differently
    166167                        _ItemTags.put('L', Line.class.getMethod("setStartItem", pItem));
     
    173174                        _ItemTags.put('^', Item.class.getMethod("setMagnetizedItemTop", pInt));
    174175                        _DelayedItemTags.add('^');
    175                         _ItemTags.put('_', Item.class.getMethod("setMagnetizedItemBottom", pInt));
    176                         _DelayedItemTags.add('_');
     176                        _ItemTags.put('/', Item.class.getMethod("setMagnetizedItemBottom", pInt));
     177                        _DelayedItemTags.add('/');
     178                       
     179                        _ItemTagsExt.put("_ph", Text.class.getMethod("setPlaceholder", pString));
    177180                } catch (Exception e) {
    178181                        e.printStackTrace();
  • trunk/src/org/expeditee/io/DefaultFrameWriter.java

    r1296 r1321  
    5656        // keep track of methods that are put on the same line
    5757        protected static LinkedHashMap<Character, Method> _ItemTags = null;
     58        // IMPORTANT: keys in _ItemTagsExt must start with underscore as their first character
     59        protected static LinkedHashMap<String, Method> _ItemTagsExt = null;
    5860
    5961        protected static LinkedHashMap<Character, Method> _FrameTags = null;
     
    6567
    6668                _ItemTags = new LinkedHashMap<Character, Method>();
     69                _ItemTagsExt = new LinkedHashMap<String, Method>();
    6770                _FrameTags = new LinkedHashMap<Character, Method>();
    6871
     
    148151                        _ItemTags.put(']', Item.class.getMethod("getMagnetizedItemRight"));
    149152                        _ItemTags.put('^', Item.class.getMethod("getMagnetizedItemTop"));
    150                         _ItemTags.put('_', Item.class.getMethod("getMagnetizedItemBottom"));
    151                        
    152                         _ItemTags.put('=', Text.class.getMethod("getPlaceholder"));
     153                        _ItemTags.put('/', Item.class.getMethod("getMagnetizedItemBottom"));
     154                       
     155                        //_ItemTags.put('=', Text.class.getMethod("getPlaceholder"));
     156                        _ItemTagsExt.put("_ph", Text.class.getMethod("getPlaceholder"));
    153157                } catch (Exception e) {
    154158                        e.printStackTrace();
  • trunk/src/org/expeditee/io/ExpReader.java

    r1242 r1321  
    7474                // allow for all characters, we take advantage of how || is evaluated:
    7575                //              if the check for Character.isLetter passes, then the more complex map lookup operation does not take place.
    76                 return s.length() >= 2 && (Character.isLetter(s.charAt(0)) || _ItemTags.keySet().contains(s.charAt(0)));
     76               
     77                if (s.length() < 2) {
     78                        return false;
     79                }
     80                char charZero = s.charAt(0);
     81               
     82                if (charZero == '_') {
     83                        // If the character at the start is a underscore then we are dealing with the extended collection and must extract a string.
     84                        // This requires that the line contains a space character to split on and that the resulting split has at least two parts.
     85                        String[] parts = s.split(" ");
     86                        if (parts.length < 2) {
     87                                return false;
     88                        }
     89                        boolean isStringTag = _ItemTagsExt.keySet().contains(parts[0]);
     90                        if (isStringTag) {
     91                                return true;
     92                        }
     93                } else {
     94                        // If we are looking at a letter then we can save ourselves from the less efficient general character check.
     95                        boolean isLetter = Character.isLetter(charZero);
     96                        if (isLetter) {
     97                                return true;
     98                        }
     99                       
     100                        // If we are not looking at a letter but we are looking at a character that is not _ then it must be in the existing collection to be valid
     101                        boolean isCharacterTag = _ItemTags.keySet().contains(charZero);
     102                        if (isCharacterTag) {
     103                                return true;
     104                        }
     105                }
     106                               
     107                // If we have somehow found a entry which does not pass any of the above tests then the line is invalid.
     108                return false;
    77109        }
    78110
     
    246278         */
    247279        protected void processBodyLine(Item item, String line) {
     280                Method toRun = null;
     281               
    248282                // separate the tag from the value
    249                 Character tag = getTag(line);
    250                 String value = getValue(line);
    251                
    252                 Method toRun = _ItemTags.get(tag);
     283                String tag = getTag(line).toString();
     284                String value = null;
     285                if (tag.charAt(0) != '_') {
     286                        value = getValue(line);
     287                        toRun = _ItemTags.get(tag.charAt(0));
     288                } else {
     289                        tag = getTagExt(line);
     290                        value = getValueExt(line);
     291                        toRun = _ItemTagsExt.get(tag);
     292                }
     293               
    253294                               
    254295                if (toRun == null) {
     
    271312                return line.charAt(0);
    272313        }
     314       
     315        protected static String getTagExt(String line) {
     316                assert(line.length() >= 2 && line.contains(" "));
     317                String[] parts = line.split(" ");
     318                assert(parts.length >= 2);
     319                return parts[0];
     320        }
    273321
    274322        protected static String getValue(String line) {
     
    278326                        return "";
    279327                }
     328        }
     329       
     330        protected static String getValueExt(String line) {
     331                assert(line.length() >= 2 && line.contains(" "));
     332                return line.substring(line.indexOf(" ") + 1);
    280333        }
    281334       
  • trunk/src/org/expeditee/io/ExpWriter.java

    r1208 r1321  
    277277        private void writeClass(Object toWrite) throws IOException {
    278278                Iterator<Character> it = _ItemTags.keySet().iterator();
     279                Iterator<String> itExt = _ItemTagsExt.keySet().iterator();
    279280                Object[] param = {};
    280281
     
    300301                        }
    301302                }
     303               
     304                while (itExt.hasNext()) {
     305                        String tag = itExt.next();
     306                        Method toRun = _ItemTagsExt.get(tag);
     307                        Class<?> declarer = toRun.getDeclaringClass();
     308                        if (declarer.isAssignableFrom(toWrite.getClass())) {
     309                                try {
     310                                        Object o = toRun.invoke(toWrite, param);
     311                                        o = Conversion.ConvertToExpeditee(toRun, o);
     312                                        if (o != null) {
     313                                                if (o instanceof List) {
     314                                                        for (Object line : (List) o) {
     315                                                                writeLine(tag.toString(), line.toString());
     316                                                        }
     317                                                } else
     318                                                        writeLine(tag.toString(), o.toString());
     319                                        }
     320                                } catch (Exception e) {
     321                                        e.printStackTrace();
     322                                }
     323                        }
     324                }
    302325        }
    303326
Note: See TracChangeset for help on using the changeset viewer.