Ignore:
Timestamp:
07/24/19 11:23:45 (5 years ago)
Author:
bln4
Message:

Renamed Frame.getItems() to Frame.getSortedItems() to better represent its functionality.

-> org.apollo.ApolloGestureActions
-> org.apollo.ApolloSystem
-> org.expeditee.actions.Actions
-> org.expeditee.actions.Debug
-> org.expeditee.actions.ExploratorySearchActions
-> org.expeditee.actions.JfxBrowserActions
-> org.expeditee.actions.Misc
-> org.expeditee.actions.Navigation
-> org.expeditee.actions.ScriptBase
-> org.expeditee.actions.Simple
-> org.expeditee.agents.ComputeTree
-> org.expeditee.agents.CopyTree
-> org.expeditee.agents.DisplayComet
-> org.expeditee.agents.DisplayTree
-> org.expeditee.agents.DisplayTreeLeaves
-> org.expeditee.agents.GraphFramesetLinks
-> org.expeditee.agents.TreeProcessor
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.DisplayController
-> org.expeditee.gui.FrameCreator
-> org.expeditee.gui.FrameIO
-> org.expeditee.io.DefaultTreeWriter
-> org.expeditee.io.JavaWriter
-> org.expeditee.io.PDF2Writer
-> org.expeditee.io.TXTWriter
-> org.expeditee.io.WebParser
-> org.expeditee.io.flowlayout.XGroupItem
-> org.expeditee.items.Dot
-> org.expeditee.items.Item
-> org.expeditee.items.ItemUtils
-> org.expeditee.network.FrameShare
-> org.expeditee.stats.TreeStats


Created ItemsList class to wrap ArrayList<Item>. Frames now use this new class to store its body list (used for display) as well as its primaryBody and surrogateBody.

-> org.expeditee.agents.Format
-> org.expeditee.agents.HFormat
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gui.Frame
-> org.expeditee.gui.FrameUtils


Refactorted Frame.setResort(bool) to Frame.invalidateSorted() to better function how it is intended to with a more accurate name.

-> org.expeditee.agents.Sort


When writing out .exp files and getting attributes to respond to LEFT + RIGHT click, boolean items are by default true. This has always been the case. An ammendment to this is that defaults can now be established.
Also added 'EnterClick' functionality. If cursored over a item with this property and you press enter, it acts as if you have clicked on it instead.

-> org.expeditee.assets.resources-public.framesets.authentication.1.exp to 6.exp
-> org.expeditee.gio.gesture.StandardGestureActions
-> org.expeditee.gio.input.KBMInputEvent
-> org.expeditee.gio.javafx.JavaFXConversions
-> org.expeditee.gio.swing.SwingConversions
-> org.expeditee.gui.AttributeUtils
-> org.expeditee.io.Conversion
-> org.expeditee.io.DefaultFrameWriter
-> org.expeditee.items.Item


Fixed a bug caused by calling Math.abs on Integer.MIN_VALUE returning unexpected result. Due to zero being a thing, you cannot represent Math.abs(Integer.MIN_VALUE) in a Integer object. The solution is to use Integer.MIN_VALUE + 1 instead of Integer.MIN_VALUE.

-> org.expeditee.core.bounds.CombinationBounds
-> org.expeditee.io.flowlayout.DimensionExtent


Recoded the contains function in EllipticalBounds so that intersection tests containing circles work correctly.

-> org.expeditee.core.bounds.EllipticalBounds


Added toString() to PolygonBounds to allow for useful printing during debugging.

-> org.expeditee.core.bounds.PolygonBounds

Implemented Surrogate Mode!

-> org.expeditee.encryption.io.EncryptedExpReader
-> org.expeditee.encryption.io.EncryptedExpWriter
-> org.expeditee.encryption.items.surrogates.EncryptionDetail
-> org.expeditee.encryption.items.surrogates.Label
-> org.expeditee.gui.FrameUtils
-> org.expeditee.gui.ItemsList
-> org.expeditee.items.Item
-> org.expeditee.items.Text


???? Use Integer.MAX_VALUE cast to a float instead of Float.MAX_VALUE. This fixed some bug which I cannot remember.

-> org.expeditee.gio.TextLayoutManager
-> org.expeditee.gio.swing.SwingTextLayoutManager


Improved solution for dealing with the F10 key taking focus away from Expeditee due to it being a assessibility key.

-> org.expeditee.gio.swing.SwingInputManager


Renamed variable visibleItems in FrameGraphics.paintFrame to itemsToPaintCanditates to better represent functional intent.

-> org.expeditee.gui.FrameGraphics


Improved checking for if personal resources exist before recreating them

-> org.expeditee.gui.FrameIO


Repeated messages to message bay now have a visual feedback instead of just a beep. This visual feedback is in the form of a count of the amount of times it has repeated.

-> org.expeditee.gui.MessageBay


Updated comment on the Vector class to explain what vectors are.

-> org.expeditee.gui.Vector


Added constants to represent all of the property keys in DefaultFrameReader and DefaultFrameWriter.

-> org.expeditee.io.DefaultFrameReader
-> org.expeditee.io.DefaultFrameWriter


Updated the KeyList setting to be more heirarcial with how users will store their Secrets.

-> org.expeditee.settings.identity.secrets.KeyList

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r1407 r1415  
    6060import org.expeditee.core.bounds.AxisAlignedBoxBounds;
    6161import org.expeditee.core.bounds.PolygonBounds;
     62import org.expeditee.encryption.items.surrogates.Label;
    6263import org.expeditee.gio.EcosystemManager;
    6364import org.expeditee.gio.gesture.StandardGestureActions;
     
    384385                }
    385386
    386                 for (Item i : current.getItems()) {
     387                for (Item i : current.getSortedItems()) {
    387388                        i.setHighlightMode(Item.HighlightMode.None);
    388389                        i.setHighlightColorToDefault();
     
    642643         * @return True if the image was created successfully, false otherwise
    643644         */
    644         private static boolean createPicture(Frame frame, Text txt) {
     645        private static boolean createPicture(Frame frame, Text txt, ItemsList items) {
    645646                // attempt to create the picture
    646647                Picture pic = ItemUtils.CreatePicture(txt);
     
    659660                        return false;
    660661                }
    661                 frame.addItem(pic);
     662                frame.addItem(pic, true, items);
    662663
    663664                return true;
     665        }
     666       
     667        private static boolean createPictureInBody(Frame frame, Text txt) {
     668                return createPicture(frame, txt, frame.getBody());
    664669        }
    665670
     
    678683         * @author Brook Novak
    679684         */
    680         private static boolean createWidget(Frame frame, Text txt) {
     685        private static boolean createWidget(Frame frame, Text txt, ItemsList list) {
    681686
    682687                if (frame == null) {
     
    713718                }
    714719
    715                 frame.removeItem(txt);
    716 
    717                 frame.addAllItems(iw.getItems());
     720                frame.removeItem(txt, true, list);
     721
     722                frame.addAllItems(iw.getItems(), list);
    718723
    719724                return true;
     725        }
     726       
     727        private static boolean createWidgetInBody(Frame frame, Text txt) {
     728                return createWidget(frame, txt, frame.getBody());
    720729        }
    721730
     
    857866                return dirsToAdd;
    858867        }
    859 
    860         public static void Parse(Frame toParse) {
    861                 Parse(toParse, false);
    862         }
    863 
    864         /**
    865          * Checks for any special Annotation items and updates the display as necessary.
    866          * Special Items: Images, overlays, sort.
    867          *
    868          */
    869         public static void Parse(Frame toParse, boolean firstParse) {
    870                 Parse(toParse, firstParse, false);
    871         }
    872 
    873         /**
    874          *
    875          * @param toParse
    876          * @param firstParse
    877          * @param ignoreAnnotations
    878          *            used to prevent infinate loops such as when performing TDFC with
    879          *            an ao tag linked to a frame with an frameImage of a frame which
    880          *            also has an ao tag on it.
    881          */
    882         public static void Parse(Frame toParse, boolean firstParse, boolean ignoreAnnotations) {
    883                 // TODO check why we are getting toParse == null... when profile frame
    884                 // is being created and change the lines below
    885                 if (toParse == null) {
    886                         return;
    887                 }
    888 
    889                 if (firstParse) {
    890                         ItemUtils.EnclosedCheck(toParse.getItems());
    891                 }
    892 
    893                 List<Item> items = toParse.getItems();
    894 
     868       
     869        private static void transformOutOfPlaceItems(Frame toParse, ItemsList toTransform) {
     870                // Get all items from toTransform that have not been marked as deleted.
     871                List<Item> items = toParse.getItems(false, toTransform);
     872               
    895873                // if XRayMode is on, replace pictures with their underlying text
    896874                if (DisplayController.isXRayMode()) {
     
    901879                        for (Item i : items) {
    902880                                if (i instanceof XRayable) {
    903                                         toParse.removeItem(i);
     881                                        toParse.removeItem(i, true, toTransform);
    904882                                        // Show the items
    905883                                        for (Item item : ((XRayable) i).getConnected()) {
     
    908886                                        }
    909887                                } else if (i instanceof WidgetCorner) {
    910                                         toParse.removeItem(i);
     888                                        toParse.removeItem(i, true, toTransform);
    911889                                } else if (i instanceof WidgetEdge) {
    912                                         toParse.removeItem(i);
     890                                        toParse.removeItem(i, true, toTransform);
    913891                                } else if (i.hasFormula()) {
    914892                                        i.setText(i.getFormula());
     
    920898
    921899                        for (Widget iw : widgets) {
    922                                 toParse.addItem(iw.getSource());
    923                         }
    924                 }
    925 
    926                 // Text title = null;
    927                 // Text template = UserSettingsTemplate.copy();
    928 
    929                 List<Overlay> overlays = new ArrayList<Overlay>();
    930                 List<Vector> vectors = new ArrayList<Vector>();
     900                                toParse.addItem(iw.getSource(), true, toTransform);
     901                        }
     902                }
     903
    931904
    932905                // disable reading of cached overlays if in twinframes mode
     
    935908                }
    936909
    937                 // DotType pointtype = DotType.square;
    938                 // boolean filledPoints = true;
    939 
    940                 UserAppliedPermission permission = toParse.getUserAppliedPermission();
    941910                toParse.clearAnnotations();
    942911
    943912                // check for any new overlay items
    944                 for (Item i : toParse.getItems()) {
     913                items = toParse.getItems(false, toTransform);
     914                for (Item i : items) {
    945915                        try {
    946                                 // reset overlay permission
    947                                 i.setOverlayPermission(null);
    948                                 // i.setPermission(permission);
    949916                                if (i instanceof WidgetCorner) {
    950917                                        // TODO improve efficiency so it only updates once... using
     
    952919                                        i.update();
    953920                                } else if (i instanceof Text) {
     921                                        if (!DisplayController.isXRayMode() && i.isAnnotation()) {
     922                                                if (ItemUtils.startsWithTag(i, ItemUtils.TAG_IMAGE, true)) {
     923                                                        if (!i.hasEnclosures()) {
     924                                                                createPicture(toParse, (Text) i, toTransform);
     925                                                        }
     926                                                        // check for frame images
     927                                                } else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_FRAME_IMAGE) && i.getLink() != null
     928                                                                && !i.getAbsoluteLink().equalsIgnoreCase(toParse.getName())) {
     929                                                        XRayable image = null;
     930                                                        if (i.hasEnclosures()) {
     931                                                                // i.setHidden(true);
     932                                                                // image =
     933                                                                // i.getEnclosures().iterator().next();
     934                                                                // image.refresh();
     935                                                        } else {
     936                                                                image = new FrameImage((Text) i, null);
     937                                                        }
     938                                                        // TODO Add the image when creating new
     939                                                        // FrameImage
     940                                                        toParse.addItem(image, true, toTransform);
     941                                                } else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_BITMAP_IMAGE) && i.getLink() != null
     942                                                                && !i.getAbsoluteLink().equalsIgnoreCase(toParse.getName())) {
     943                                                        XRayable image = null;
     944                                                        if (i.hasEnclosures()) {
     945                                                                // image =
     946                                                                // i.getEnclosures().iterator().next();
     947                                                                // image.refresh();
     948                                                                // i.setHidden(true);
     949                                                        } else {
     950                                                                // If a new bitmap is created for a
     951                                                                // frame which already has a bitmap dont
     952                                                                // recreate the bitmap
     953                                                                image = new FrameBitmap((Text) i, null);
     954                                                        }
     955                                                        toParse.addItem(image, true, toTransform);
     956                                                } else if (ItemUtils.startsWithTag(i, "@c")) {
     957                                                        // Can only have a @c
     958                                                        if (!i.hasEnclosures() && i.getLines().size() == 1) {
     959                                                                Circle circle = new Circle((Text) i);
     960                                                                toParse.addItem(circle, true, toTransform);
     961                                                        }
     962                                                        // Check for JSItem
     963                                                } else if (ItemUtils.startsWithTag(i, "@js")) {
     964                                                        JSItem jsItem = new JSItem((Text) i);
     965                                                        toParse.addItem(jsItem, true, toTransform);
     966                                                        // Check for interactive widgets
     967                                                } else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_IWIDGET)) {
     968                                                        createWidget(toParse, (Text) i, toTransform);
     969                                                }
     970
     971                                                // TODO decide exactly what to do here!!
     972                                                toParse.addAnnotation((Text) i);
     973                                        } else if (!DisplayController.isXRayMode() && i.hasFormula()) {
     974                                                i.calculate(i.getFormula());
     975                                        }
     976                                }
     977                        } catch (Exception e) {
     978                                Logger.Log(e);
     979                                e.printStackTrace();
     980                                System.err
     981                                                .println("**** Have temporarily supressed MessageBay call, as resulted in infinite recursion");
     982                                // MessageBay.warningMessage("Exception occured when loading " +
     983                                // i.getClass().getSimpleName() + "(ID: "
     984                                // + i.getID() + ") " + e.getMessage() != null ? e.getMessage() : "");
     985                        }
     986                }
     987
     988                /*
     989                 * for (Item i : items) { if (i instanceof Dot) { ((Dot)
     990                 * i).setPointType(pointtype); ((Dot) i).useFilledPoints(filledPoints); } }
     991                 */
     992
     993                if (DisplayController.isTwinFramesOn()) {
     994                        FrameIO.ResumeCache();
     995                }
     996
     997
     998        }
     999       
     1000        private static void generatingSupportingItems(Frame toParse,
     1001                        ItemsList toBuildOff, boolean ignoreAnnotations) {
     1002                // Get all items from toBuildOff that have not been marked as deleted.
     1003                List<Item> items = toParse.getItems(false, toBuildOff);
     1004
     1005                List<Overlay> overlays = new ArrayList<Overlay>();
     1006                List<Vector> vectors = new ArrayList<Vector>();
     1007
     1008                // disable reading of cached overlays if in twinframes mode
     1009                if (DisplayController.isTwinFramesOn()) {
     1010                        FrameIO.SuspendCache();
     1011                }
     1012
     1013                UserAppliedPermission permission = toParse.getUserAppliedPermission();
     1014                // check for any new overlay items
     1015                for (Item i : items) {
     1016                        try {
     1017                                // reset overlay permission
     1018                                i.setOverlayPermission(null);
     1019                                if (i instanceof Text) {
    9541020                                        if (i.isAnnotation()) {
    955                                                 if (ItemUtils.startsWithTag(i, ItemUtils.TAG_POINTTYPE)) {
    956                                                         Text txt = (Text) i;
    957                                                         String line = txt.getFirstLine();
    958                                                         line = ItemUtils.StripTag(line, ItemUtils.GetTag(ItemUtils.TAG_POINTTYPE));
    959 
    960                                                         if (line != null) {
    961                                                                 line = line.toLowerCase();
    962                                                                 if (line.indexOf(" ") > 0) {
    963                                                                         String fill = line.substring(line.indexOf(" ") + 1);
    964                                                                         if (fill.startsWith("nofill")) {
    965                                                                                 // filledPoints = false;
    966                                                                         } else {
    967                                                                                 // filledPoints = true;
    968                                                                         }
    969                                                                 }
    970 
    971                                                                 if (line.startsWith("circle")) {
    972                                                                         // pointtype = DotType.circle;
    973                                                                 } else {
    974                                                                         // pointtype = DotType.square;
    975                                                                 }
    976                                                         }
    977                                                 } // check for new VECTOR items
    978                                                 else if (!DisplayController.isXRayMode() && ItemUtils.startsWithTag(i, ItemUtils.TAG_VECTOR)
     1021                                                if (!DisplayController.isXRayMode() && ItemUtils.startsWithTag(i, ItemUtils.TAG_VECTOR)
    9791022                                                                && i.getLink() != null) {
    9801023                                                        if (!i.getAbsoluteLink().equals(toParse.getName())) {
     
    10471090                                                        }
    10481091                                                }
    1049                                                 // check for Images and widgets
    1050                                                 else {
    1051                                                         if (!DisplayController.isXRayMode()) {
    1052                                                                 if (ItemUtils.startsWithTag(i, ItemUtils.TAG_IMAGE, true)) {
    1053                                                                         if (!i.hasEnclosures()) {
    1054                                                                                 createPicture(toParse, (Text) i);
    1055                                                                         }
    1056                                                                         // check for frame images
    1057                                                                 } else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_FRAME_IMAGE) && i.getLink() != null
    1058                                                                                 && !i.getAbsoluteLink().equalsIgnoreCase(toParse.getName())) {
    1059                                                                         XRayable image = null;
    1060                                                                         if (i.hasEnclosures()) {
    1061                                                                                 // i.setHidden(true);
    1062                                                                                 // image =
    1063                                                                                 // i.getEnclosures().iterator().next();
    1064                                                                                 // image.refresh();
    1065                                                                         } else {
    1066                                                                                 image = new FrameImage((Text) i, null);
    1067                                                                         }
    1068                                                                         // TODO Add the image when creating new
    1069                                                                         // FrameImage
    1070                                                                         toParse.addItem(image);
    1071                                                                 } else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_BITMAP_IMAGE) && i.getLink() != null
    1072                                                                                 && !i.getAbsoluteLink().equalsIgnoreCase(toParse.getName())) {
    1073                                                                         XRayable image = null;
    1074                                                                         if (i.hasEnclosures()) {
    1075                                                                                 // image =
    1076                                                                                 // i.getEnclosures().iterator().next();
    1077                                                                                 // image.refresh();
    1078                                                                                 // i.setHidden(true);
    1079                                                                         } else {
    1080                                                                                 // If a new bitmap is created for a
    1081                                                                                 // frame which already has a bitmap dont
    1082                                                                                 // recreate the bitmap
    1083                                                                                 image = new FrameBitmap((Text) i, null);
    1084                                                                         }
    1085                                                                         toParse.addItem(image);
    1086                                                                 } else if (ItemUtils.startsWithTag(i, "@c")) {
    1087                                                                         // Can only have a @c
    1088                                                                         if (!i.hasEnclosures() && i.getLines().size() == 1) {
    1089                                                                                 toParse.addItem(new Circle((Text) i));
    1090                                                                         }
    1091                                                                         // Check for JSItem
    1092                                                                 } else if (ItemUtils.startsWithTag(i, "@js")) {
    1093                                                                         toParse.addItem(new JSItem((Text) i));
    1094                                                                         // Check for interactive widgets
    1095                                                                 } else if (ItemUtils.startsWithTag(i, ItemUtils.TAG_IWIDGET)) {
    1096                                                                         createWidget(toParse, (Text) i);
    1097                                                                 }
    1098                                                         }
    1099                                                         // TODO decide exactly what to do here!!
    1100                                                         toParse.addAnnotation((Text) i);
    1101                                                 }
    1102                                         } else if (!DisplayController.isXRayMode() && i.hasFormula()) {
    1103                                                 i.calculate(i.getFormula());
     1092                                               
    11041093                                        }
    11051094                                }
     
    11181107                 */
    11191108
    1120                 FrameIO.ResumeCache();
     1109                if (DisplayController.isTwinFramesOn()) {
     1110                        FrameIO.ResumeCache();
     1111                }
    11211112
    11221113                toParse.clearOverlays();
     
    11241115                toParse.addAllOverlays(overlays);
    11251116                toParse.addAllVectors(vectors);
    1126 
     1117        }
     1118
     1119        public static void Parse(Frame toParse) {
     1120                Parse(toParse, false);
     1121        }
     1122
     1123        /**
     1124         * Checks for any special Annotation items and updates the display as necessary.
     1125         * Special Items: Images, overlays, sort.
     1126         *
     1127         */
     1128        public static void Parse(Frame toParse, boolean firstParse) {
     1129                Parse(toParse, firstParse, false);
     1130        }
     1131
     1132        /**
     1133         *
     1134         * @param toParse
     1135         * @param firstParse
     1136         * @param ignoreAnnotations
     1137         *            used to prevent infinate loops such as when performing TDFC with
     1138         *            an ao tag linked to a frame with an frameImage of a frame which
     1139         *            also has an ao tag on it.
     1140         */     
     1141        public static void Parse(Frame toParse, boolean firstParse, boolean ignoreAnnotations) {
     1142                List<String> accessList = Label.getAccessibleLabelsNames(new ItemsList(toParse.getPrimaryBody()));
     1143               
     1144                ItemsList primaries = toParse.getPrimaryBody();
     1145                ItemsList surrogates = toParse.getSurrogateBody();
     1146               
     1147                transformOutOfPlaceItems(toParse, primaries);
     1148                transformOutOfPlaceItems(toParse, surrogates);
     1149               
     1150                toParse.getInteractableItems().clear();
     1151                List<Item> newBody = parseFromPrimary(primaries, accessList);
     1152                toParse.getBody().clear();
     1153                toParse.getBody().addAll(newBody);
     1154                generatingSupportingItems(toParse, toParse.getBody(), ignoreAnnotations);
     1155               
     1156                if (firstParse) {
     1157                        ItemUtils.EnclosedCheck(toParse.getSortedItems());
     1158                }
     1159        }
     1160
     1161        private static List<Item> parseFromPrimary(ItemsList primaryBody, List<String> access) {
     1162                List<Item> parsedBody = new ArrayList<Item>();
     1163               
     1164                for (Item item: primaryBody) {
     1165                        String encryptionLabel = item.getEncryptionLabel();
     1166                        if (encryptionLabel == null || encryptionLabel.isEmpty()) {
     1167                                parsedBody.add(item);
     1168                        } else if (access.contains(encryptionLabel)) {
     1169                                parsedBody.add(item);
     1170                        } else {
     1171                                parsedBody.addAll(item.getSurrogates());
     1172                        }
     1173                }
     1174               
     1175                return parsedBody;
    11271176        }
    11281177
     
    12251274                                if (LastEdited.contains(x, y) && !FreeItems.getInstance().contains(LastEdited)
    12261275                                                && LastEdited.getParent() == DisplayController.getCurrentFrame()
    1227                                                 && LastEdited.getParent().getItems().contains(LastEdited)) {
     1276                                                && LastEdited.getParent().getSortedItems().contains(LastEdited)) {
    12281277                                        LastEdited.setOverlayPermission(UserAppliedPermission.full);
    12291278                                        return LastEdited;
     
    14121461                        return null;
    14131462                }
    1414                 List<Item> items = current.getItems();
     1463                List<Item> items = current.getSortedItems();
    14151464
    14161465                // Remove all items that are connected to freeItems
     
    15721621                        MessageBay.suppressMessages(true);
    15731622                        int lastNumber = FrameIO.getLastNumber(defaultFrame.getFramesetName());
    1574                         for (int i = 1; i <= lastNumber; i++) {
     1623                        for (int i = 1; i <= lastNumber; i++) {                         
    15751624                                // Load in next default, if it doesn't exist continue loop.
    15761625                                defaultFrame = FrameIO.LoadFrame(defaultFrame.getFramesetName() + i);
     
    16701719                                                Frame indexFrame = FrameIO.LoadFrame(framesetName + '1');
    16711720                                                // Look through the folder for help index pages
    1672                                                 if (indexFrame != null && ItemUtils.FindTag(indexFrame.getItems(), "@HelpIndex") != null) {
     1721                                                if (indexFrame != null && ItemUtils.FindTag(indexFrame.getSortedItems(), "@HelpIndex") != null) {
    16731722                                                        // yPos += spacing;
    16741723                                                        yPos += 30;
Note: See TracChangeset for help on using the changeset viewer.