Changeset 21 for trunk/src/org/expeditee/gui/FrameUtils.java
- Timestamp:
- 05/08/08 14:30:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameUtils.java
r19 r21 246 246 247 247 for (Item i : current.getItems()) 248 i.s howHighlight(false);248 i.setSelectedMode(Item.SelectedMode.None); 249 249 return true; 250 250 } … … 354 354 _LastResponse = ResponseTimer.getElapsedSeconds(); 355 355 _ResponseTimeSum += _LastResponse; 356 DisplayIO.UpdateTitle(); 356 357 } 357 358 … … 454 455 return true; 455 456 } 456 457 457 458 /** 458 * Creates an interactive widget and adds it to a frame. 459 * If txt has noparent the parent will be set to frame.460 * 461 * @param frame 462 * 463 * 464 * @param txt 465 * 459 * Creates an interactive widget and adds it to a frame. If txt has no 460 * parent the parent will be set to frame. 461 * 462 * @param frame 463 * Frame to add widget to. Must not be null. 464 * 465 * @param txt 466 * Text to create the widget from. Must not be null. 466 467 * 467 468 * @return True if created/added. False if coul not create. … … 471 472 private static boolean createWidget(Frame frame, Text txt) { 472 473 473 if (frame == null) throw new NullPointerException("frame"); 474 if (txt == null) throw new NullPointerException("txt"); 475 474 if (frame == null) 475 throw new NullPointerException("frame"); 476 if (txt == null) 477 throw new NullPointerException("txt"); 478 476 479 // Safety 477 if (txt.getParent() == null) txt.setParent(frame); 478 480 if (txt.getParent() == null) 481 txt.setParent(frame); 482 479 483 InteractiveWidget iw = null; 480 484 481 485 try { 482 486 483 487 iw = InteractiveWidget.CreateWidget(txt); 484 488 485 489 } catch (InteractiveWidgetNotAvailableException e) { 486 490 e.printStackTrace(); 487 FrameGraphics.ErrorMessage("Cannot create iWidget: " + e.getMessage()); 488 489 } catch (IllegalArgumentException e) { 491 FrameGraphics.ErrorMessage("Cannot create iWidget: " 492 + e.getMessage()); 493 494 } catch (IllegalArgumentException e) { 490 495 e.printStackTrace(); 491 FrameGraphics.ErrorMessage("Cannot create iWidget: " + e.getMessage()); 492 } 493 494 if (iw == null) return false; 496 FrameGraphics.ErrorMessage("Cannot create iWidget: " 497 + e.getMessage()); 498 } 499 500 if (iw == null) 501 return false; 495 502 496 503 frame.removeItem(txt); 497 504 498 505 frame.addAllItems(iw.getItems()); 499 506 … … 682 689 // if XRayMode is on, replace pictures with their underlying text 683 690 if (FrameGraphics.isXRayMode()) { 684 691 685 692 // BROOK: Must handle these a little different 686 //List<InteractiveWidget> widgets = toParse.getInteractiveWidgets(); 693 // List<InteractiveWidget> widgets = 694 // toParse.getInteractiveWidgets(); 687 695 ArrayList<InteractiveWidget> widgets = new ArrayList<InteractiveWidget>(); 688 696 /* 697 * for (Item i : items) { if (i instanceof Picture) { 698 * toParse.removeItem(i); toParse.addItem(((Picture) i).getText()); } 699 * else if (i instanceof WidgetCorner) { toParse.removeItem(i); } 700 * else if (i instanceof WidgetEdge) { toParse.removeItem(i); } } 701 */ 689 702 for (Item i : items) { 690 703 if (i instanceof Picture) { … … 693 706 } else if (i instanceof WidgetCorner) { 694 707 toParse.removeItem(i); 695 } else if (i instanceof WidgetEdge) { 696 toParse.removeItem(i); 697 } 698 }*/ 699 for (Item i : items) { 700 if (i instanceof Picture) { 701 toParse.removeItem(i); 702 toParse.addItem(((Picture) i).getText()); 703 } else if (i instanceof WidgetCorner) { 704 toParse.removeItem(i); 705 InteractiveWidget iw = ((WidgetCorner)i).getWidgetSource(); 706 if (!widgets.contains(iw)) { // hmmm I should be using a set... meh 708 InteractiveWidget iw = ((WidgetCorner) i).getWidgetSource(); 709 if (!widgets.contains(iw)) { // hmmm I should be using a 710 // set... meh 707 711 widgets.add(iw); 708 712 } 709 } else if (i instanceof WidgetEdge) toParse.removeItem(i);710 }711 713 } else if (i instanceof WidgetEdge) 714 toParse.removeItem(i); 715 } 712 716 713 717 for (InteractiveWidget iw : widgets) { 714 718 toParse.addItem(iw.getSource()); 715 719 } 716 720 717 721 // update the list of items 718 722 items.clear(); … … 918 922 if (message.contains(x, y)) { 919 923 message.Permission = Item.PERMISSION_COPY; 920 } 921 possibles.add(message); 924 possibles.add(message); 925 } else 926 // Not sure why but if the line below is removed then 927 // several items can be highlighted at once 928 message.setSelectedMode(Item.SelectedMode.None); 922 929 } 923 930 } … … 927 934 if (FrameGraphics.MessageLink.contains(x, y)) { 928 935 FrameGraphics.MessageLink.Permission = Item.PERMISSION_COPY; 929 } 930 possibles.add(FrameGraphics.MessageLink); 931 } 932 y -= FrameGraphics.getMaxFrameSize().getHeight(); 936 possibles.add(FrameGraphics.MessageLink); 937 } 938 } 939 940 // this is taken into account in contains 941 // y -= FrameGraphics.getMaxFrameSize().height; 933 942 // otherwise, the mouse is on the frame 934 943 } else { … … 942 951 } else 943 952 LastEdited = null; 944 953 945 954 ArrayList<Item> checkList = new ArrayList<Item>(); 946 955 checkList.addAll(toCheck.getItems()); … … 1028 1037 return null; 1029 1038 1030 return getItemsEnclosedBy(DisplayIO.getCurrentFrame(), enclosure.get(0) 1031 .getEnclosedShape()); 1039 List<Item> enclosed = getItemsEnclosedBy(DisplayIO.getCurrentFrame(), 1040 enclosure.get(0).getEnclosedShape()); 1041 for (Item i : enclosed) { 1042 if (!enclosure.contains(i)) 1043 i.setSelectedMode(Item.SelectedMode.None); 1044 } 1045 1046 return enclosed; 1032 1047 } 1033 1048 … … 1123 1138 // if the item is on the frame 1124 1139 if (item.getParent() == frame || item.getParent() == null) { 1125 // TODO this is a bit of a hack...1126 // the1127 // item1128 // parent1129 // should1130 // really1131 // be1132 // set1133 // when1134 // the1135 // polygon1136 // is1137 // created...1138 1140 item.Permission = Item.PERMISSION_FULL; 1139 1141 results.add(item);
Note:
See TracChangeset
for help on using the changeset viewer.