edu.cmu.sun.folds
Class LayoutMatcher

java.lang.Object
  extended by edu.cmu.sun.folds.LayoutMatcher

public class LayoutMatcher
extends java.lang.Object

When the Folded Scrolling window changes, we need to make a smooth transition between scenes. In order to do this, we run the LayoutTransitioner. One of the steps in the transition is to match component from the current layout to the next layout. These matched components will animate between one another. The LayoutMatcher matches together components based on a number of limits: First, the LayoutComponents must be of the same type. Edge folds (TOP_FOLD or BOTTOM_FOLD) are matched before any other component. Next, the manager matches components in the order of their overlap. For example, it Matches all components with an EXACT_OVERLAP first. Then, after all matching has been done for EXACT_OVERLAP, the matcher moves on to TOTAL_OVERLAP, then PARTIAL_OVERLAP. Once components have been matched, they can be built together into a layout that acts as an animation plan.

Author:
Braden Kowitz
See Also:
LayoutTransitioner, LayoutComponent, IndexRange

Nested Class Summary
(package private) static class LayoutMatcher.Mode
           
 
Field Summary
(package private)  Layout layout1
          first layotu to match against.
(package private)  Layout layout2
          second layout to match against.
(package private)  LayoutMatcher.Mode mode
          The mode of operation for the matchLayouts() call.
(package private)  IndexRange.Overlap.Type overlapMode
          The types of overlap that will be accepted as a match when matchLayouts() is called.
 
Constructor Summary
LayoutMatcher()
           
 
Method Summary
private  boolean doesMatch(LayoutComponent lc1, LayoutComponent lc2)
          Returns True if the two components are matched based on the specs in the mode field and the overlapMode field.
 void match(Layout firstLayout, Layout secondLayout)
          Mathces components between these two layouts.
private  void matchLayouts()
          Go through each pair of components (cross product) and call tryToMatch();
private  void tryToMatch(LayoutComponent lc1, LayoutComponent lc2)
          Tries to match two components together using the doesMatch() method as a test to see if the components should match together.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

LayoutMatcher.Mode mode
The mode of operation for the matchLayouts() call. Edge mode will only match edge components (TOP_FOLD or BOTTOM_FOLD). OVERLAP MODE will match components based on the overlapMode field.


overlapMode

IndexRange.Overlap.Type overlapMode
The types of overlap that will be accepted as a match when matchLayouts() is called.


layout1

Layout layout1
first layotu to match against.


layout2

Layout layout2
second layout to match against.

Constructor Detail

LayoutMatcher

public LayoutMatcher()
Method Detail

match

public void match(Layout firstLayout,
                  Layout secondLayout)
Mathces components between these two layouts.


matchLayouts

private void matchLayouts()
Go through each pair of components (cross product) and call tryToMatch();


tryToMatch

private void tryToMatch(LayoutComponent lc1,
                        LayoutComponent lc2)
Tries to match two components together using the doesMatch() method as a test to see if the components should match together.


doesMatch

private boolean doesMatch(LayoutComponent lc1,
                          LayoutComponent lc2)
Returns True if the two components are matched based on the specs in the mode field and the overlapMode field.