Changeset 614


Ignore:
Timestamp:
12/12/13 17:05:54 (10 years ago)
Author:
csl14
Message:

Small changes to profile frame and added start pages - a.k.a templates

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Misc.java

    r603 r614  
    5050import org.expeditee.items.widgets.JfxBrowser;
    5151import org.expeditee.math.ExpediteeJEP;
     52import org.expeditee.settings.UserSettings;
    5253import org.expeditee.simple.SString;
    5354import org.expeditee.stats.CometStats;
     
    13631364                System.out.println(text.getText());
    13641365        }
     1366       
     1367        /**
     1368         * Rebuilds the default frame, restoring its original presentation.
     1369         */
     1370        public static void resetDefaultFrame() {
     1371                try {
     1372                        Frame frame = FrameIO.CreateNewProfile(UserSettings.ProfileName);
     1373                        FrameUtils.DisplayFrame(frame.getName());
     1374                } catch (Exception e) {
     1375                        e.printStackTrace();
     1376                }
     1377        }
    13651378}
  • trunk/src/org/expeditee/gui/FrameIO.java

    r601 r614  
    8585
    8686        public static String HELP_PATH;
     87       
     88        public static String TEMPLATES_PATH;
    8789       
    8890        public static String DICT_PATH;
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r605 r614  
    22
    33import java.awt.Color;
     4import java.awt.Font;
    45import java.awt.Point;
    56import java.awt.Polygon;
     
    78import java.io.File;
    89import java.io.FileInputStream;
    9 import java.io.FileNotFoundException;
    1010import java.io.FileOutputStream;
    11 import java.io.IOException;
    1211import java.io.InputStream;
    1312import java.net.JarURLConnection;
     
    2625import java.util.zip.ZipEntry;
    2726
    28 import org.expeditee.agents.SearchGreenstone;
    29 import org.expeditee.agents.mail.MailSession;
    30 import org.expeditee.agents.wordprocessing.JSpellChecker;
    3127import org.expeditee.items.Circle;
    3228import org.expeditee.items.Dot;
     
    3531import org.expeditee.items.FrameImage;
    3632import org.expeditee.items.Item;
     33import org.expeditee.items.Item.HighlightMode;
    3734import org.expeditee.items.ItemUtils;
    3835import org.expeditee.items.Line;
     
    4239import org.expeditee.items.UserAppliedPermission;
    4340import org.expeditee.items.XRayable;
    44 import org.expeditee.items.Item.HighlightMode;
    4541import org.expeditee.items.widgets.InteractiveWidget;
    4642import org.expeditee.items.widgets.InteractiveWidgetInitialisationFailedException;
    4743import org.expeditee.items.widgets.InteractiveWidgetNotAvailableException;
    48 import org.expeditee.items.widgets.Password;
    4944import org.expeditee.items.widgets.WidgetCorner;
    5045import org.expeditee.items.widgets.WidgetEdge;
    51 import org.expeditee.network.FrameShare;
    5246import org.expeditee.settings.Settings;
    5347import org.expeditee.settings.UserSettings;
     
    8478                return _LastResponse;
    8579        }
     80       
     81        /**
     82         * The list of known start pages framesets which will have prepopulated links in the home frame.
     83         */
     84        public static final String[] startPages = { "exploratorysearch", "webbrowser" };
    8685
    8786        /**
     
    13721371                int yPos = intialYPos;
    13731372
    1374                 yPos += spacing;
    1375                 profile.addText(xPos, yPos, "@HomeFrame", null, profile.getName());
    1376                 yPos += spacing;
    1377                 String defaultFrameName = profile.getFramesetName() + "0";
    1378                 profile.addText(xPos, yPos, "@DefaultFrame", null, defaultFrameName);
    1379                 yPos += spacing;
    1380 
    1381                 profile.addText(xPos, yPos, "@InitialWidth: "
    1382                                 + UserSettings.InitialWidth, null);
    1383                 yPos += spacing;
    1384 
    1385                 profile.addText(xPos, yPos, "@InitialHeight: "
    1386                                 + UserSettings.InitialHeight, null);
    1387                 yPos += spacing;
    1388 
    1389                 Text t = profile.addText(xPos, yPos, "@ItemTemplate", null);
    1390                 t.setColor(null);
    1391 
    1392                 yPos += spacing;
    1393                 t = profile.addText(xPos, yPos, "@AnnotationTemplate", null);
    1394                 t.setColor(Color.gray);
    1395 
    1396                 yPos += spacing;
    1397                 t = profile.addText(xPos, yPos, "@CommentTemplate", null);
    1398                 t.setColor(Color.green.darker());
    1399 
    1400                 yPos += spacing;
    1401                 t = profile.addText(xPos, yPos, "@StatsTemplate", null);
    1402                 t.setColor(Color.BLACK);
    1403                 t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F));
    1404                 t.setFamily(Text.MONOSPACED_FONT);
    1405                 t.setSize(14);
    1406 
    1407                 xPos = 600;
    1408                 yPos = intialYPos + spacing;
    1409 
    1410                 // Load documentation
     1373//              yPos += spacing;
     1374//              profile.addText(xPos, yPos, "@HomeFrame", null, profile.getName());
     1375//              yPos += spacing;
     1376//              String defaultFrameName = profile.getFramesetName() + "0";
     1377//              profile.addText(xPos, yPos, "@DefaultFrame", null, defaultFrameName);
     1378//              yPos += spacing;
     1379//
     1380//              profile.addText(xPos, yPos, "@InitialWidth: "
     1381//                              + UserSettings.InitialWidth, null);
     1382//              yPos += spacing;
     1383//
     1384//              profile.addText(xPos, yPos, "@InitialHeight: "
     1385//                              + UserSettings.InitialHeight, null);
     1386//              yPos += spacing;
     1387//
     1388//              Text t = profile.addText(xPos, yPos, "@ItemTemplate", null);
     1389//              t.setColor(null);
     1390//
     1391//              yPos += spacing;
     1392//              t = profile.addText(xPos, yPos, "@AnnotationTemplate", null);
     1393//              t.setColor(Color.gray);
     1394//
     1395//              yPos += spacing;
     1396//              t = profile.addText(xPos, yPos, "@CommentTemplate", null);
     1397//              t.setColor(Color.green.darker());
     1398//
     1399//              yPos += spacing;
     1400//              t = profile.addText(xPos, yPos, "@StatsTemplate", null);
     1401//              t.setColor(Color.BLACK);
     1402//              t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F));
     1403//              t.setFamily(Text.MONOSPACED_FONT);
     1404//              t.setSize(14);
     1405
     1406                Text t;
     1407               
     1408                xPos = 300;
     1409                //yPos = intialYPos + spacing;
     1410                yPos = 100;
     1411               
     1412                // Load documentation and start pages
    14111413                extractDocumentation();
    14121414               
     
    14251427                                help.setColor(Item.COLOR_WHEEL[3]);
    14261428
    1427                                 xPos = 625;
     1429                                xPos += 25;
    14281430
    14291431                                for (File helpFrameset : helpFramesets) {
     
    14361438                                                        && ItemUtils.FindTag(indexFrame.getItems(),
    14371439                                                                        "@HelpIndex") != null) {
    1438                                                 yPos += spacing;
     1440                                                //yPos += spacing;
     1441                                                yPos += 30;
    14391442                                                t = profile.addText(xPos, yPos, '@' + indexFrame
    14401443                                                                .getFramesetName(), null);
    14411444                                                t.setLink(indexFrame.getName());
    1442                                         }
    1443                                 }
    1444                         }
    1445                 }
    1446 
    1447                 // FrameUtils.Parse(profile);
     1445                                                t.setColor(Color.gray);
     1446                                        }
     1447                                }
     1448                        }
     1449                }
     1450
     1451                xPos = 50;
     1452                yPos = 100;
     1453               
     1454                // Populate Start Pages and Settings
     1455                File framesetDirectory = new File(FrameIO.FRAME_PATH);
     1456               
     1457                if(framesetDirectory.exists()) {                       
     1458                        File[] startpagesFramesets = framesetDirectory.listFiles();
     1459
     1460                        if(startpagesFramesets != null) {
     1461                                // Add Start Page title
     1462                                Text templates = profile.addText(xPos, yPos, "@Start Pages", null);
     1463                                templates.setSize(25);
     1464                                templates.setFontStyle("Bold");
     1465                                templates.setFamily("SansSerif");
     1466                                templates.setColor(Item.COLOR_WHEEL[3]);
     1467                               
     1468                                xPos += 25;
     1469                               
     1470                                boolean settingsFound = false;
     1471
     1472                                // Start Pages should be the first frame in its own frameset + frameset name should be present in FrameUtils.startPages[].
     1473                                for(File startpagesFrameset : startpagesFramesets) {                                   
     1474                                        String framesetName = startpagesFrameset.getName();
     1475                                       
     1476                                        // Only add link if frameset is a startpage
     1477                                        for(int i = 0; i < startPages.length ; i++) {
     1478                                                if(framesetName.equals(startPages[i])) {
     1479                                                        Frame indexFrame = FrameIO.LoadFrame(framesetName + '1');
     1480                                                       
     1481                                                        // Add start page link
     1482                                                        if(indexFrame != null) {
     1483                                                                yPos += 30;
     1484                                                                t = profile.addText(xPos, yPos, '@' + indexFrame.getFramesetName(), null);
     1485                                                                t.setLink(indexFrame.getName());
     1486                                                                t.setColor(Color.gray);
     1487                                                        }
     1488                                                }
     1489                                               
     1490                                                // Populate settings frameset
     1491                                                if(!settingsFound && framesetName.equals("settings")) {
     1492                                                        Frame indexFrame = FrameIO.LoadFrame(framesetName + "1");
     1493                                                       
     1494                                                        if(indexFrame != null) {
     1495                                                                settingsFound = true;
     1496                                                               
     1497                                                                t = profile.addText(550, 100, "@" + indexFrame.getFramesetName(), null);
     1498                                                                t.setLink(indexFrame.getName());
     1499                                                                t.setSize((float) 25.0);
     1500                                                                t.setFamily("SansSerif");
     1501                                                                t.setFontStyle("Bold");
     1502                                                                t.setColor(Color.gray);
     1503                                                        }
     1504                                                }
     1505                                        }
     1506                                }
     1507                        }
     1508                }
     1509               
    14481510                FrameIO.SaveFrame(profile);
    14491511        }
     
    15571619        }
    15581620       
     1621        /**
     1622         * Loads documentation and template files from the jar or the src.
     1623         */
    15591624        private static void extractDocumentation() {
    15601625                System.out.println("docs");
     
    15761641                                while(jarEntries.hasMoreElements()) {
    15771642                                        ze = jarEntries.nextElement();
    1578                                         if(!(ze.getName().startsWith("org/expeditee/resources/documentation") || ze.getName().startsWith("org/expeditee/resources/dict"))) {
     1643                                        if(!(ze.getName().startsWith("org/expeditee/resources/documentation") || ze.getName().startsWith("org/expeditee/resources/dict") || ze.getName().startsWith("org/expeditee/resources/framesets"))) {
    15791644                                                continue;
    15801645                                        }
    1581                                         // NOTE: assumes HELP_PATH is "${PARENT_FOLDER}/documentation/" and DICT_PATH is "${PARENT_FOLDER}/dict/"
     1646                                        // NOTE: assumes HELP_PATH is "${PARENT_FOLDER}/documentation/", DICT_PATH is "${PARENT_FOLDER}/dict/"
    15821647                                        File out = new File(FrameIO.PARENT_FOLDER + ze.getName().substring("org/expeditee/resources/".length()));
    15831648                                        // System.out.println("Didn't crash here " + out.getPath());
     
    16401705                                                path = FrameIO.DICT_PATH;
    16411706                                                classPath = "org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "dict";
     1707                                        } else if(file.getPath().contains("org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "framesets")) {
     1708                                                path = FrameIO.FRAME_PATH;
     1709                                                classPath = "org" + File.separator + "expeditee" + File.separator + "resources" + File.separator + "framesets";
    16421710                                        } else {
    16431711                                                continue;
Note: See TracChangeset for help on using the changeset viewer.