Ignore:
Timestamp:
11/28/18 16:16:29 (6 years ago)
Author:
bln4
Message:

org.expeditee.auth.gio.EncryptedExpReader ->
org.expeditee.auth.gio.EncryptedExpWriter ->
org.expeditee.io.DefaultFrameReader ->
org.expeditee.io.DefaultFrameWriter ->
org.expeditee.io.ExpReader ->
org.expeditee.io.ExpWriter ->

The beginnings of a authentication system for Expeditee. Frame files (.exp) can now be encrypted with a password. A login system is being developed to accompany this.


org.expeditee.gui.AttributeUtils ->
org.expeditee.gui.Frame ->
org.expeditee.gui.FrameUtils ->
org.expeditee.items.Item ->
org.expeditee.items.PermissionPair ->
org.expeditee.items.Text ->

As part of the development the login screen. Modifications to Text Items have been made. New properties are 'Mask' and 'MinWidth'. Mask allows you to set a character to use as...a mask...for example, a password field using '*'. MinWidth allows you to specify a minimum width for text boxes. A text box with a minimum width never shrinks below this width; even when it has no content.

Location:
trunk/src/org/expeditee/io
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/DefaultFrameReader.java

    r1102 r1200  
    9696                                        pColor));
    9797
     98                        // Note: As of 26/11/18 there are no unused letter item tags.  Use other characters.
    9899                        _ItemTags.put('S', Item.class.getMethod("setID", pInt));
    99100                        _ItemTags.put('s', Item.class.getMethod("setDateCreated", pString));
     
    150151                        _ItemTags.put('m', Text.class.getMethod("setInitialSpacing", pFloat));
    151152                        _ItemTags.put('w', Text.class.getMethod("setWidth", pIntO));
     153                        _ItemTags.put('M', Text.class.getMethod("setMinWidth", pIntO));
    152154                        _ItemTags.put('k', Text.class.getMethod("setJustification", pJustification));
    153155                        _ItemTags.put('r', Text.class.getMethod("setAutoWrap", pBool));
     
    161163                       
    162164                        _ItemTags.put('p', Item.class.getMethod("setPermission", pPermission));
     165                       
     166                        _ItemTags.put('O', Text.class.getMethod("setMask", pIntO));
    163167                       
    164168                        // Lines and constraints are created differently
  • trunk/src/org/expeditee/io/DefaultFrameWriter.java

    r1102 r1200  
    3333import org.expeditee.agents.WriteTree;
    3434import org.expeditee.gio.EcosystemManager;
    35 import org.expeditee.gui.Browser;
    3635import org.expeditee.gui.Frame;
    3736import org.expeditee.gui.FrameIO;
     
    8079                        _FrameTags.put('B', Frame.class.getMethod("getBackgroundColor"));
    8180                       
     81                        // Note: As of 26/11/18 there are no unused letter item tags.  Use other characters.
    8282                        _ItemTags.put('S', Item.class.getMethod("getTypeAndID"));
    8383                        _ItemTags.put('s', Item.class.getMethod("getDateCreated"));
     
    120120                        _ItemTags.put('f', Text.class.getMethod("getFont"));
    121121                        _ItemTags.put('t', Text.class.getMethod("getSpacing"));
     122                       
     123                        _ItemTags.put('O', Text.class.getMethod("getMask"));
    122124
    123125                        // TODO set a boolean flag to indicate that the text is a formula
     
    129131                        _ItemTags.put('m', Text.class.getMethod("getInitialSpacing"));
    130132                        _ItemTags.put('w', Text.class.getMethod("getWidthToSave"));
     133                        _ItemTags.put('M', Text.class.getMethod("getMinWidthToSave"));
    131134                        _ItemTags.put('k', Text.class.getMethod("getJustification"));
    132135                        _ItemTags.put('r', Text.class.getMethod("getAutoWrapToSave"));
  • trunk/src/org/expeditee/io/ExpReader.java

    r1189 r1200  
    6868         */
    6969        protected static boolean isValidLine(String s) {
    70                 return s.length() >= 2 && s.charAt(1) == ' '
    71                                 && (Character.isLetter(s.charAt(0)) || s.charAt(0) == '[' || s.charAt(0) == ']' || s.charAt(0) == '^' || s.charAt(0) == '_');
     70                // Previously lines in a .exp file had to start with a letter (A-Z, a-z).  This allowed for an efficient check for valid lines.
     71                // As we started to run out of spare letters to use for properties, we wished to use the full range of characters.  But we did not
     72                // wish to loose the efficiency of the Character.isLetter check.  In order to maintain as much of this efficiency as possible, but
     73                // allow for all characters, we take advantage of how || is evaluated:
     74                //              if the check for Character.isLetter passes, then the more complex map lookup operation does not take place.
     75                return s.length() >= 2 && (Character.isLetter(s.charAt(0)) || _ItemTags.keySet().contains(s.charAt(0)));
    7276        }
    7377
     
    117121                                                        break;
    118122                                                }
    119                                                 _linePoints.put(currentItem.getID(), currentItem);
     123                                                _linePoints.put(currentItem.getID(), currentItem);                                             
    120124                                                newFrame.addItem(currentItem);
    121125                                        } else if (currentItem != null && actionShouldBeDelayed(getTag(next))) {
     
    123127                                        } else if (currentItem != null) {
    124128                                                processBodyLine(currentItem, next);
     129//                                              final boolean hasSpecifiedPermission = currentItem.getPermission() != null;
     130//                                              final boolean hasSpecifiedOwner = currentItem.getOwner() != null;
     131//                                              if (hasSpecifiedPermission && hasSpecifiedOwner && currentItem.getPermission().getPermission(currentItem.getOwner()) == UserAppliedPermission.denied) {
     132//                                                      newFrame.removeItem(currentItem);
     133//                                                      newFrame.addItemHidden(currentItem);
     134//                                                      continue;
     135//                                              }
    125136                                        } else {
    126137                                                System.err.println("Error while reading in frame (ExpReader): Found body line but no current item to apply it to.");
     
    236247                Character tag = getTag(line);
    237248                String value = getValue(line);
    238 
     249               
    239250                Method toRun = _ItemTags.get(tag);
     251                               
    240252                if (toRun == null) {
    241253                        System.out.println("Error accessing tag method: " + tag);
    242254                }
     255                               
    243256                Object[] vals = Conversion.Convert(toRun, value);
    244 
    245257                try {
    246258                        if (vals != null) {
     
    322334                                        String value = getValue(next);
    323335                                        if (tag.equals('V')) {
     336                                                reader.close();
    324337                                                return Integer.parseInt(value);
    325338                                        }
    326339                                }
    327340                        }
     341                        reader.close();
    328342                } catch (Exception e) {
    329343                }
  • trunk/src/org/expeditee/io/ExpWriter.java

    r919 r1200  
    4747public class ExpWriter extends DefaultFrameWriter {
    4848
    49         private ProxyWriter _writer = null;
     49        protected ProxyWriter _writer = null;
    5050
    5151        protected StringBuilder _stringWriter = null;
     
    104104                if (_writer == null)
    105105                        return;
     106               
     107                preOutputFrame();
    106108
    107109                writeHeader(frame);
     
    109111                // write each item in the frame
    110112                for (Item i : frame.getItemsToSave()) {
     113                        assert (!(i instanceof Line));
     114                        writeItem(i);
     115                }
     116               
     117                for (final Item i: frame.getBodyItemsWithInsufficientPermissions()) {
    111118                        assert (!(i instanceof Line));
    112119                        writeItem(i);
     
    122129
    123130                return;
     131        }
     132
     133        protected void preOutputFrame() {
    124134        }
    125135
Note: See TracChangeset for help on using the changeset viewer.