Changeset 614 for trunk/src/org/expeditee/gui/FrameUtils.java
- Timestamp:
- 12/12/13 17:05:54 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameUtils.java
r605 r614 2 2 3 3 import java.awt.Color; 4 import java.awt.Font; 4 5 import java.awt.Point; 5 6 import java.awt.Polygon; … … 7 8 import java.io.File; 8 9 import java.io.FileInputStream; 9 import java.io.FileNotFoundException;10 10 import java.io.FileOutputStream; 11 import java.io.IOException;12 11 import java.io.InputStream; 13 12 import java.net.JarURLConnection; … … 26 25 import java.util.zip.ZipEntry; 27 26 28 import org.expeditee.agents.SearchGreenstone;29 import org.expeditee.agents.mail.MailSession;30 import org.expeditee.agents.wordprocessing.JSpellChecker;31 27 import org.expeditee.items.Circle; 32 28 import org.expeditee.items.Dot; … … 35 31 import org.expeditee.items.FrameImage; 36 32 import org.expeditee.items.Item; 33 import org.expeditee.items.Item.HighlightMode; 37 34 import org.expeditee.items.ItemUtils; 38 35 import org.expeditee.items.Line; … … 42 39 import org.expeditee.items.UserAppliedPermission; 43 40 import org.expeditee.items.XRayable; 44 import org.expeditee.items.Item.HighlightMode;45 41 import org.expeditee.items.widgets.InteractiveWidget; 46 42 import org.expeditee.items.widgets.InteractiveWidgetInitialisationFailedException; 47 43 import org.expeditee.items.widgets.InteractiveWidgetNotAvailableException; 48 import org.expeditee.items.widgets.Password;49 44 import org.expeditee.items.widgets.WidgetCorner; 50 45 import org.expeditee.items.widgets.WidgetEdge; 51 import org.expeditee.network.FrameShare;52 46 import org.expeditee.settings.Settings; 53 47 import org.expeditee.settings.UserSettings; … … 84 78 return _LastResponse; 85 79 } 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" }; 86 85 87 86 /** … … 1372 1371 int yPos = intialYPos; 1373 1372 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 1411 1413 extractDocumentation(); 1412 1414 … … 1425 1427 help.setColor(Item.COLOR_WHEEL[3]); 1426 1428 1427 xPos = 625;1429 xPos += 25; 1428 1430 1429 1431 for (File helpFrameset : helpFramesets) { … … 1436 1438 && ItemUtils.FindTag(indexFrame.getItems(), 1437 1439 "@HelpIndex") != null) { 1438 yPos += spacing; 1440 //yPos += spacing; 1441 yPos += 30; 1439 1442 t = profile.addText(xPos, yPos, '@' + indexFrame 1440 1443 .getFramesetName(), null); 1441 1444 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 1448 1510 FrameIO.SaveFrame(profile); 1449 1511 } … … 1557 1619 } 1558 1620 1621 /** 1622 * Loads documentation and template files from the jar or the src. 1623 */ 1559 1624 private static void extractDocumentation() { 1560 1625 System.out.println("docs"); … … 1576 1641 while(jarEntries.hasMoreElements()) { 1577 1642 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"))) { 1579 1644 continue; 1580 1645 } 1581 // NOTE: assumes HELP_PATH is "${PARENT_FOLDER}/documentation/" andDICT_PATH is "${PARENT_FOLDER}/dict/"1646 // NOTE: assumes HELP_PATH is "${PARENT_FOLDER}/documentation/", DICT_PATH is "${PARENT_FOLDER}/dict/" 1582 1647 File out = new File(FrameIO.PARENT_FOLDER + ze.getName().substring("org/expeditee/resources/".length())); 1583 1648 // System.out.println("Didn't crash here " + out.getPath()); … … 1640 1705 path = FrameIO.DICT_PATH; 1641 1706 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"; 1642 1710 } else { 1643 1711 continue;
Note:
See TracChangeset
for help on using the changeset viewer.