edu.cmu.sun.controller
Class FoldViewController

java.lang.Object
  extended by edu.cmu.sun.controller.FoldViewController

public class FoldViewController
extends java.lang.Object

Handles all click events for folded scrolling. Each fold in the window listens to its own click events and passes the information to this conrtorller, which is responsible for updating the model to scroll the list correctly. The controller makes a distinction between three types of foldes to sroll correctly. Clicks directly above and below the main portion of the list act differently than click on other folds that are seperated from the main list.

Author:
Braden Kowitz

Nested Class Summary
private static class FoldViewController.Position
          DIRECTLY_ABOVE is the fold that is directly above the main list portion.
 
Field Summary
private  LayoutComponent layout
          The current layout component for the list that this controller is using.
private  FoldViewController.Position position
          The detected position for the fold of interest for a click.
private  IndexRange primaryRange
          Internal variable to store the range of the main portion of the list.
 
Constructor Summary
FoldViewController(LayoutComponent layout)
          Create a new fold controller to handle mouse clikc events for folds.
 
Method Summary
private  void activateWindowAndUpdate()
          Makes this window the active window in the column, and updates the TransitionManager.
 void clickOnEnd()
          Handles click events on the right portion of the fold.
 void clickOnFold()
          Handles click events on the center portion of the fold.
 void clickOnStart()
          Handles click events on the left portion of the fold.
private  void discoverPositionType()
          Discovers the type of fold (described above) that this component is.
private  void gotoBottomOfFold()
          Move the list to the bottom of the current view.
private  void gotoTopOfFold()
          Move the list to the top of the current fold.
private  void scrollDown()
          Scroll the main portion of the list down by one page.
private  void scrollUp()
          Scroll the main portion of the list up by one page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

layout

private LayoutComponent layout
The current layout component for the list that this controller is using. The layout contains the Model which we need to access.


primaryRange

private IndexRange primaryRange
Internal variable to store the range of the main portion of the list.


position

private FoldViewController.Position position
The detected position for the fold of interest for a click.

Constructor Detail

FoldViewController

public FoldViewController(LayoutComponent layout)
Create a new fold controller to handle mouse clikc events for folds.

Parameters:
layout - The layout that represnets the list under control. The LayoutComponent has a pointer to greater Layout context.
Method Detail

gotoTopOfFold

private void gotoTopOfFold()
Move the list to the top of the current fold.


gotoBottomOfFold

private void gotoBottomOfFold()
Move the list to the bottom of the current view.


scrollDown

private void scrollDown()
Scroll the main portion of the list down by one page. The bottom item in the list will now be the top item.


scrollUp

private void scrollUp()
Scroll the main portion of the list up by one page. The top item in the list will now be the bottom item


discoverPositionType

private void discoverPositionType()
Discovers the type of fold (described above) that this component is. It stores the type of fold in the position field.


clickOnFold

public void clickOnFold()
Handles click events on the center portion of the fold.


clickOnEnd

public void clickOnEnd()
Handles click events on the right portion of the fold. This side corresponds to the end of list in most cases.


clickOnStart

public void clickOnStart()
Handles click events on the left portion of the fold. This side corresponds to the begining of list in most cases.


activateWindowAndUpdate

private void activateWindowAndUpdate()
Makes this window the active window in the column, and updates the TransitionManager. By making the window the active window, we make more room in the column to show the items under the fold.