Changeset 80 for trunk/src/org/expeditee/gui/Frame.java
- Timestamp:
- 05/30/08 10:14:43 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Frame.java
r78 r80 35 35 public class Frame implements ImageObserver { 36 36 37 public static final Color[] COLOR_WHEEL = { Color.BLACK, Color.GRAY,37 public static Color[] COLOR_WHEEL = { Color.BLACK, Color.WHITE, Color.GRAY, 38 38 new Color(235, 235, 235), new Color(225, 225, 255), 39 39 new Color(195, 255, 255), new Color(225, 255, 225), … … 60 60 private String _frozenDate = null; 61 61 62 private Color _background; 63 64 private Color _foreground = Item.DEFAULT_FOREGROUND; 62 // Background color is clear 63 private Color _background = null; 64 65 // Foreground color is automatic by default 66 private Color _foreground = null; 65 67 66 68 public String path; … … 236 238 } 237 239 } 238 bodyTextItems.remove(getTitle ());240 bodyTextItems.remove(getTitleItem()); 239 241 240 242 return bodyTextItems; … … 285 287 */ 286 288 public void setTitle(String title) { 287 if (title == null || title == "")289 if (title == null || title.equals("")) 288 290 return; 289 291 … … 292 294 // remove any numbering this title has 293 295 title = title.replaceAll("^\\d*[.] *", ""); 294 Text frameTitle = getTitle ();296 Text frameTitle = getTitleItem(); 295 297 296 298 if (frameTitle == null) { … … 305 307 addItem(frameTitle); 306 308 } else { 309 // If it begins with a tag remove it 310 311 // Remove the @ symbol if it is there 312 title = ItemUtils.StripTagSymbol(title); 307 313 frameTitle.setText(title); 308 title = ItemUtils.StripTagSymbol(title); 314 // If the @ symbol is followed by numbering or a bullet remove that 315 // too 309 316 String autoBulletText = FrameKeyboardActions.getAutoBullet(title); 310 317 if (autoBulletText.length() > 0) … … 314 321 // Brook: Cannot figure what is going on above... widget annot titles 315 322 // should be stripped always 316 if (ItemUtils 317 . isTag(frameTitle, ItemUtils.GetTag(ItemUtils.TAG_IWIDGET))) {323 if (ItemUtils.startsWithTag(frameTitle, ItemUtils 324 .GetTag(ItemUtils.TAG_IWIDGET))) { 318 325 frameTitle.stripFirstWord(); 319 326 } … … 325 332 } 326 333 327 public Text getTitle () {334 public Text getTitleItem() { 328 335 List<Item> items = getItems(); 329 336 for (Item i : items) { 330 337 if (i instanceof Text && i.getX() < UserSettings.TitlePosition 331 && i.getY() < UserSettings.TitlePosition )338 && i.getY() < UserSettings.TitlePosition && i.getY() > 0) 332 339 return (Text) i; 333 340 } … … 336 343 } 337 344 338 public Item getFrameNameItem() { 345 public String getTitle() { 346 Text title = getTitleItem(); 347 if (title == null) 348 return getName(); 349 350 return title.getFirstLine(); 351 } 352 353 public Item getNameItem() { 339 354 return _frameName; 340 355 } … … 424 439 } 425 440 426 public void set FrameName(String framename) {441 public void setName(String framename) { 427 442 int num = Conversion.getFrameNumber(framename); 428 443 String frameset = Conversion.getFrameset(framename, false); 429 444 430 set FrameName(frameset, num);445 setName(frameset, num); 431 446 } 432 447 … … 465 480 * @return The Frame number of this Frame or -1 if it is not set. 466 481 */ 467 public int get FrameNumber() {482 public int getNumber() { 468 483 return _number; 469 484 } … … 575 590 _body.add(item); 576 591 item.setParent(this); 592 593 // If the item is a line end and has constraints with items already 594 // on the frame then make sure the constraints hold 595 if (item.isLineEnd()) { 596 item.setPosition(item.getPosition()); 597 } 577 598 578 599 _sorted = false; … … 636 657 * The List of Items to add to the undo stack. 637 658 */ 638 public void addAllToUndo( List<Item> items) {659 public void addAllToUndo(Collection<Item> items) { 639 660 if (items.size() < 1) 640 661 return; … … 718 739 } 719 740 720 public String get FrameName() {741 public String getName() { 721 742 return getFramesetName() + _number; 722 743 } … … 765 786 _background = back; 766 787 change(); 767 FrameGraphics.Repaint();788 // FrameGraphics.Repaint(); 768 789 } 769 790 … … 784 805 _foreground = front; 785 806 change(); 786 FrameGraphics.Repaint();807 // FrameGraphics.Repaint(); 787 808 } 788 809 … … 792 813 793 814 public Color getPaintForegroundColor() { 794 final int GRAY = 127;815 final int GRAY = Color.gray.getBlue(); 795 816 final int THRESHOLD = 10; 796 817 … … 802 823 return Color.WHITE; 803 824 804 Color fore = new Color(Math.abs(255 - back.getRed()), Math 805 .abs(255 - back.getGreen()), Math.abs(255 - back.getBlue())); 825 Color fore = new Color( 826 Math.abs(Conversion.RGB_MAX - back.getRed()), Math 827 .abs(Conversion.RGB_MAX - back.getGreen()), Math 828 .abs(Conversion.RGB_MAX - back.getBlue())); 806 829 return fore; 807 // return Item.DEFAULT_FOREGROUND;808 830 } 809 831 … … 1167 1189 public boolean equals(Object o) { 1168 1190 if (o instanceof String) { 1169 return (String.CASE_INSENSITIVE_ORDER .compare((String) o,1170 getFrameName()) == 0);1191 return (String.CASE_INSENSITIVE_ORDER 1192 .compare((String) o, getName()) == 0); 1171 1193 } 1172 1194 1173 1195 if (o instanceof Frame) { 1174 return get FrameName().equals(((Frame) o).getFrameName());1196 return getName().equals(((Frame) o).getName()); 1175 1197 } 1176 1198 … … 1188 1210 1189 1211 List<Item> copies = ItemUtils.CopyItems(toMergeWith.getItems()); 1190 copies.remove(toMergeWith.get FrameNameItem());1212 copies.remove(toMergeWith.getNameItem()); 1191 1213 1192 1214 for (Item i : copies) { … … 1234 1256 List<Item> newBody = new ArrayList<Item>(0); 1235 1257 for (Item i : _body) 1236 if (i.isAnnotation() || i == get FrameNameItem() || i == getTitle())1258 if (i.isAnnotation() || i == getNameItem() || i == getTitleItem()) 1237 1259 newBody.add(i); 1238 1260 … … 1300 1322 // check for an updated template... 1301 1323 for (Item i : this.getItems()) { 1302 if (ItemUtils. isTag(i, templateTag)) {1324 if (ItemUtils.startsWithTag(i, templateTag)) { 1303 1325 t = (Text) i; 1304 1326 break; … … 1401 1423 */ 1402 1424 public boolean isNormalTextItem(Item it) { 1403 if (it instanceof Text && it != getTitle () && it != _frameName1425 if (it instanceof Text && it != getTitleItem() && it != _frameName 1404 1426 && !((Text) it).isSpecialAnnotation()) { 1405 1427 return true; … … 1455 1477 if (it instanceof Text) { 1456 1478 Text t = (Text) it; 1457 if (t.getText NoList().toLowerCase().startsWith("@start")1458 || t.getText NoList().toLowerCase().equals("@start:")) {1479 if (t.getText().toLowerCase().startsWith("@start") 1480 || t.getText().toLowerCase().equals("@start:")) { 1459 1481 t.stripFirstWord(); 1460 1482 1461 if (t.getText NoList().equals(""))1483 if (t.getText().equals("")) 1462 1484 DisplayIO.getCurrentFrame().removeItem(t); 1463 1485 if (!Frame.itemAttachedToCursor()) { … … 1491 1513 } 1492 1514 1493 return _frameName.getText NoList();1515 return _frameName.getText(); 1494 1516 } 1495 1517 … … 1499 1521 } 1500 1522 1501 public void set FrameName(String frameset, int i) {1523 public void setName(String frameset, int i) { 1502 1524 setFrameset(frameset); 1503 1525 setFrameNumber(i);
Note:
See TracChangeset
for help on using the changeset viewer.