Changeset 980 for trunk/src/org/expeditee
- Timestamp:
- 12/14/15 13:40:04 (9 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameGraphics.java
r940 r980 30 30 import java.awt.RenderingHints; 31 31 import java.awt.geom.Area; 32 import java.lang.reflect.Method; 32 33 import java.awt.image.BufferedImage; 33 34 import java.util.Collection; … … 599 600 Color background) { 600 601 602 // Triggers a FrameTransition is this has been signalled 603 // through an '@frameTransition: xxxx' on the frame. The type of 604 // transition is specified in the 'xxxx' part 605 606 601 607 // if TwinFrames mode is on, then clipping etc has to be set 602 608 if (DisplayIO.isTwinFramesOn()) { … … 617 623 Item.DEFAULT_BACKGROUND, null); 618 624 619 // otherwise, just draw whichever side is active 620 } else { 621 if (DisplayIO.getCurrentSide() == 0) 622 g.drawImage(left, 0, 0, Item.DEFAULT_BACKGROUND, null); 623 else 624 g.drawImage(right, 0, 0, Item.DEFAULT_BACKGROUND, null); 625 } 626 627 } 625 626 } 627 // otherwise, just draw whichever side is active 628 else { 629 if (DisplayIO.getCurrentSide() == 0) { 630 g.drawImage(left, 0, 0, Item.DEFAULT_BACKGROUND, null); 631 paintTransition(g,left); 632 } 633 else { 634 g.drawImage(right, 0, 0, Item.DEFAULT_BACKGROUND, null); 635 paintTransition(g,right); 636 } 637 } 638 639 } 640 641 642 private static void paintTransition(Graphics g, Image image) 643 { 644 645 //If we are doing a transition 646 if(FrameTransitions.getSlide() == true){ 647 648 String input = "org.expeditee.gui.FrameTransitions"; 649 String slide_mode_method = FrameTransitions.getslideModeMethod(); 650 651 try { 652 Class<?> c = Class.forName(input); 653 System.out.println(c.toString()); 654 Object t; 655 656 t = c.newInstance(); 657 658 Class[] cArg = new Class[3]; 659 cArg[0] = Graphics.class; 660 cArg[1] = Image.class; 661 cArg[2] = Dimension.class; 662 663 //Gets the method of transition and calls it 664 Method lMethod = c.getDeclaredMethod(slide_mode_method, cArg); 665 666 if(lMethod != null){ 667 668 System.out.println("method = " + lMethod.toString()); 669 Object o = lMethod.invoke(t, g, image, _MaxSize); 670 } 671 else{ 672 System.err.println("Unable to locate the transition '" + slide_mode_method + "'"); 673 } 674 675 } catch (Exception e) { 676 677 System.err.println("An Reflection Exception occurred trying to invoke '" + slide_mode_method + "'"); 678 e.printStackTrace(); 679 } 680 } 681 //Tells the frame to only transition once 682 FrameTransitions.setSlideFalse(); 683 } 684 628 685 629 686 public static void Clear() { -
trunk/src/org/expeditee/gui/FrameUtils.java
r977 r980 421 421 } 422 422 423 // TODO: consider reloating this method to Frame class? 424 protected static Item getAnnotation(Frame frame, String annotationStr) 425 { 426 Item matched_item = null; 427 428 // check for an updated template... 429 for (Item i : frame.getAnnotationItems()) { 430 431 if (ItemUtils.startsWithTag(i, annotationStr)) { 432 433 matched_item = i; 434 break; 435 } 436 } 437 438 return matched_item; 439 } 440 441 protected static void doFrameTransition(Item frameTransition, Frame from, Frame to) 442 { 443 String s = frameTransition.getText(); 444 String[] s_array = s.split(":"); 445 if(s_array.length > 1){ 446 String slide_mode_method = s_array[1].trim(); 447 448 FrameTransitions.setSlideModeMethod(slide_mode_method); 449 System.out.println("Triggered on annotation: " + s); 450 FrameTransitions.setSlideTrue(); 451 FrameTransitions.setSlideModeBaseImage(FrameGraphics.getBuffer(from, false, false)); 452 } 453 else { 454 System.err.println("Warning: failed to detect frameTransition type"); 455 // TODO: print list as a result of reflection listing 456 } 457 } 458 423 459 /** 424 460 * Displays the given Frame on the display. If the current frame has changed … … 502 538 503 539 Parse(toDisplay); 540 541 // Test to see if frame transition required, and perform it if one if found 542 Item frameTransition = getAnnotation(toDisplay, "@frameTransition"); 543 if (frameTransition != null) { 544 doFrameTransition(frameTransition,current,toDisplay); 545 } 546 504 547 DisplayIO.setCurrentFrame(toDisplay, incrementStats); 505 548 FrameMouseActions.updateCursor();
Note:
See TracChangeset
for help on using the changeset viewer.