Changeset 997 for trunk/src/org/expeditee
- Timestamp:
- 02/05/16 09:33:19 (8 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Browser.java
r947 r997 197 197 try 198 198 { 199 URL iconURL = ClassLoader.getSystemResource("org/expeditee/assets/icons/expediteeicon128.png"); 199 URL iconURL = ClassLoader.getSystemResource("org/expeditee/assets/icons/expediteeicon128.png"); //this is ideal 200 200 if (iconURL != null) 201 201 { -
trunk/src/org/expeditee/gui/Frame.java
r979 r997 2370 2370 * every time this method is called 2371 2371 */ 2372 if (_interactableItems.size() > 0)2373 return _interactableItems;2372 //if (_interactableItems.size() > 0) 2373 // return _interactableItems; 2374 2374 2375 2375 for (Item i : _body) { … … 2384 2384 for (Item i : _overlayItems) { 2385 2385 if (i.hasPermission(UserAppliedPermission.followLinks)) { 2386 _interactableItems.add(i); 2387 } 2386 _interactableItems.add(i); 2387 } 2388 2389 2388 2390 } 2389 2391 -
trunk/src/org/expeditee/gui/FrameGraphics.java
r984 r997 72 72 // Start in XRay mode so that errors aren't thrown when parsing the profile 73 73 // frame if it has images on it 74 private static int _Mode = MODE_ XRAY;74 private static int _Mode = MODE_AUDIENCE; 75 75 76 76 private FrameGraphics() { -
trunk/src/org/expeditee/gui/FrameIO.java
r924 r997 32 32 import java.io.OutputStreamWriter; 33 33 import java.io.Writer; 34 import java.nio.channels.FileChannel; 34 35 import java.sql.Time; 35 36 import java.util.Collection; … … 214 215 } 215 216 217 //Loads the 'restore' version of a frame if there is one 218 public static Frame LoadRestoreFrame(Frame frameToRestore) { 219 220 String fullPath = getFrameFullPathName(frameToRestore.getPath(), frameToRestore 221 .getName()); 222 //System.out.println("fullpath: " + fullPath); 223 String restoreVersion = fullPath + ".restore"; 224 //System.out.println("restoreversion" + restoreVersion); 225 File source = new File(restoreVersion); 226 File dest = new File(fullPath); 227 228 FileChannel inputChannel = null; 229 FileChannel outputChannel = null; 230 231 try{ 232 FileInputStream source_fis = new FileInputStream(source); 233 inputChannel = source_fis.getChannel(); 234 235 FileOutputStream dest_fos = new FileOutputStream(dest); 236 outputChannel = dest_fos.getChannel(); 237 238 outputChannel.transferFrom(inputChannel, 0, inputChannel.size()); 239 inputChannel.close(); 240 outputChannel.close(); 241 source_fis.close(); 242 dest_fos.close(); 243 } 244 catch(Exception e){ 245 246 System.err.println("No restore point detected."); 247 } 248 String frameName = frameToRestore.getName(); 249 String frameNameLower = frameName.toLowerCase(); 250 251 // first try reading from cache 252 if (isCacheOn() && _Cache.containsKey(frameNameLower)) { 253 Logger.Log(Logger.SYSTEM, Logger.LOAD, "Clearing " + frameName 254 + " from cache."); 255 Frame frame = _Cache.get(frameNameLower); 256 _Cache.remove(frameNameLower); 257 } 258 259 return LoadFrame(frameName, frameToRestore.getPath(), true); 260 } 261 216 262 public static BufferedReader LoadPublicFrame(String frameName) { 217 263 String fullPath = FrameIO.getFrameFullPathName(PUBLIC_PATH, frameName); … … 294 340 public static synchronized String getFrameFullPathName(String path, 295 341 String frameName) { 296 String source = path + Conversion.getFramesetName(frameName) 297 + File.separator; 342 343 String source; 344 String fileName = null; 345 if(frameName.contains("restore")){ 346 source = path + File.separator;// + frameName; 347 fileName = path + File.separator + frameName + ExpReader.EXTENTION; 348 349 } 350 else 351 { 352 source = path + Conversion.getFramesetName(frameName) 353 + File.separator; 354 } 355 298 356 299 357 File tester = new File(source); … … 301 359 return null; 302 360 303 // check for the new file name format 304 String fullPath = source + Conversion.getFrameNumber(frameName) 305 + ExpReader.EXTENTION; 361 String fullPath; 362 363 if(frameName.contains("restore")){ 364 365 fullPath = fileName; 366 } 367 else 368 { 369 // check for the new file name format 370 fullPath = source + Conversion.getFrameNumber(frameName) 371 + ExpReader.EXTENTION; 372 } 373 306 374 tester = new File(fullPath); 307 375 … … 1022 1090 1023 1091 /** 1092 * Saves the given Frame to disk in the corresponding frameset directory as a RESTORE, if 1093 * inc is true then the saved frames counter is incremented, otherwise it is 1094 * untouched. 1095 * 1096 * @param toSave 1097 * The Frame to save to disk as the DEFAULT COPY 1098 * @param inc 1099 * True if the saved frames counter should be incremented, false 1100 * otherwise. 1101 * @param checkBackup 1102 * True if the frame should be checked for the back up tag 1103 */ 1104 public static String SaveFrameAsRestore(Frame toSave, boolean inc, 1105 boolean checkBackup) { 1106 1107 String sf = SaveFrame(toSave, inc, checkBackup); 1108 String originalFrameName = toSave.getFramesetName(); 1109 //System.out.println(originalFrameName + " : " + toSave.getPath()); 1110 String fullPath = getFrameFullPathName(toSave.getPath(), toSave 1111 .getName()); 1112 //System.out.println(fullPath); 1113 String restoreVersion = fullPath + ".restore"; 1114 File source = new File(fullPath); 1115 File dest = new File(restoreVersion); 1116 1117 FileChannel inputChannel = null; 1118 FileChannel outputChannel = null; 1119 1120 try{ 1121 FileInputStream source_fis = new FileInputStream(source); 1122 inputChannel = source_fis.getChannel(); 1123 1124 FileOutputStream dest_fos = new FileOutputStream(dest); 1125 outputChannel = dest_fos.getChannel(); 1126 1127 outputChannel.transferFrom(inputChannel, 0, inputChannel.size()); 1128 inputChannel.close(); 1129 outputChannel.close(); 1130 source_fis.close(); 1131 dest_fos.close(); 1132 } 1133 catch(Exception e){ 1134 e.printStackTrace(); 1135 } 1136 1137 return sf; 1138 } 1139 1140 /** 1024 1141 * @param toAdd 1025 1142 */ -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r949 r997 44 44 import java.util.List; 45 45 import java.util.Set; 46 import java.util.TimerTask; 46 47 47 48 import javax.swing.Timer; … … 53 54 import org.expeditee.gui.indirect.mouse.MouseAction; 54 55 import org.expeditee.gui.indirect.mouse.MouseInfo; 56 import org.expeditee.gui.Frame; 55 57 import org.expeditee.io.ExpClipReader; 56 58 import org.expeditee.io.ItemSelection; … … 68 70 import org.expeditee.items.UserAppliedPermission; 69 71 import org.expeditee.items.XRayable; 72 import org.expeditee.items.widgets.ButtonWidget; 70 73 import org.expeditee.items.widgets.InteractiveWidget; 71 74 import org.expeditee.items.widgets.WidgetCorner; … … 83 86 84 87 private boolean _autoStamp = false; 85 88 86 89 private FrameMouseActions() { 87 90 IndirectMouseActions.getInstance().setBackAction(new MouseAction() { … … 898 901 int buttonPressed = e.getButton(); 899 902 _mouseDown += buttonPressed; 903 //when border of bin is clicked we can pick up the widget has been clicked 900 904 _lastClickedOn = FrameUtils.getCurrentItem(); 901 905 // load any frame if necessary … … 1345 1349 private void leftButton(Item clicked, Collection<Item> clickedIn, 1346 1350 boolean isShiftDown, boolean isControlDown) { 1351 1352 //Gets the current frame 1353 Frame f = DisplayIO.getCurrentFrame(); 1354 1355 //Checks if the current frame is an overlay 1356 if(f.getOverlays() != null && FrameUtils.getCurrentItem() != null){ 1357 Item i = FrameUtils.getCurrentItem(); 1358 1359 //Checks if the item clicked in the overlay is a Rubbish Bin. If it is, delete the item attached to the cursor and return. 1360 if(i instanceof WidgetCorner){ 1361 1362 try{ 1363 WidgetCorner wc = (WidgetCorner)i; 1364 ButtonWidget bw = (ButtonWidget) wc.getWidgetSource(); 1365 1366 //Should call a button widgets 'itemheldwhileclicked' method, and process depending on the widget type - else will return false. 1367 if(bw.itemHeldWhileClicked((InteractiveWidget)bw) == true){ 1368 //if(bw.ItemsLeftClickDropped() == true){ 1369 1370 return; 1371 } 1372 } 1373 catch (Exception e){ 1374 1375 e.printStackTrace(); 1376 } 1377 } 1378 1379 Item on = _lastClickedOn; 1380 _lastClickedIn = FrameUtils.getCurrentItems(on); 1381 } 1382 1347 1383 1348 1384 // if the user is pointing at something then either follow the link or … … 1354 1390 // System.out.println(mouseX + "," + mouseY); 1355 1391 for (Item i : DisplayIO.getCurrentFrame().getItems()) { 1392 //System.out.println(i.getName().toString()); 1356 1393 if (i instanceof Text) { 1357 1394 if (i.isNear(mouseX, mouseY)) { … … 1377 1414 && _lastClickedIn.size() >= 4) { 1378 1415 1379 // Check to see if the use clicked into a widgets empty space1416 // Check to see if the user clicked into a widgets empty space 1380 1417 InteractiveWidget iw = null; 1381 1418 … … 1398 1435 } 1399 1436 1400 // Note: must en't directly use source for handling the link1437 // Note: mustn't directly use source for handling the link 1401 1438 // because all link operations will by-pass the widgets special 1402 1439 // handling with links... … … 2296 2333 } 2297 2334 2335 2298 2336 public void refreshHighlights() { 2299 2337 // ByMike: Get the item the mouse is hovering over … … 2342 2380 // Item.SelectedMode.Connected); 2343 2381 // TODO: The method below is for the most part redundant 2382 2383 //start a timer to check how long mouse hovers over item for 2384 //java.util.Timer timer = new java.util.Timer(); 2385 //timer.schedule(new TimerTask() { 2386 //@Override 2387 //public void run() { 2388 2389 //System.out.println("The mouse hovered over an item for 3 seconds"); 2390 //} 2391 //}, 10000); 2392 2393 2394 2395 2344 2396 on = FrameGraphics.Highlight(on.getEditTarget()); 2345 2397 } -
trunk/src/org/expeditee/gui/FrameUtils.java
r980 r997 59 59 import org.expeditee.items.UserAppliedPermission; 60 60 import org.expeditee.items.XRayable; 61 import org.expeditee.items.widgets.ButtonWidget; 61 62 import org.expeditee.items.widgets.InteractiveWidget; 62 63 import org.expeditee.items.widgets.InteractiveWidgetInitialisationFailedException; 63 64 import org.expeditee.items.widgets.InteractiveWidgetNotAvailableException; 65 import org.expeditee.items.widgets.RubbishBin; 64 66 import org.expeditee.items.widgets.WidgetCorner; 65 67 import org.expeditee.items.widgets.WidgetEdge; … … 1222 1224 checkList.addAll(toCheck.getInteractableItems()); 1223 1225 checkList.add(toCheck.getNameItem()); 1226 1224 1227 for (Item i : checkList) { 1228 1225 1229 // do not check annotation items in audience mode 1226 1230 if (i.isVisible() 1227 1231 && !(FrameGraphics.isAudienceMode() && i.isAnnotation())) { 1228 if (i.contains(x, y) 1229 && !FreeItems.getInstance().contains(i)) { 1230 possibles.add(i); 1232 if(i instanceof WidgetCorner){ 1233 WidgetCorner wc = (WidgetCorner)i; 1234 if(wc.getWidgetSource() instanceof ButtonWidget){ 1235 ButtonWidget bw = (ButtonWidget) wc.getWidgetSource(); 1236 1237 if(bw.getdropInteractableStatus() == true){ 1238 InteractiveWidget iw = wc.getWidgetSource(); 1239 1240 if(iw.getBounds().contains(x, y)){ 1241 1242 if( !FreeItems.getInstance().contains(i)) 1243 { 1244 possibles.add(i); 1245 } 1246 } 1247 } 1248 1249 } 1250 1251 } 1252 1253 if (i.contains(x, y)){ 1254 if( !FreeItems.getInstance().contains(i)) 1255 { 1256 possibles.add(i); 1257 } 1231 1258 } 1259 1232 1260 } 1233 1261 } … … 1263 1291 } 1264 1292 1265 } 1293 } 1266 1294 1267 1295 return closest;
Note:
See TracChangeset
for help on using the changeset viewer.