edu.cmu.hcii.calo.view.TaskSubpaneView Class Reference

Inherits edu.cmu.hcii.calo.view.AnimatedPane, and edu.cmu.hcii.calo.view.animation.AnimationListener.

Inheritance diagram for edu.cmu.hcii.calo.view.TaskSubpaneView:

Inheritance graph
[legend]
Collaboration diagram for edu.cmu.hcii.calo.view.TaskSubpaneView:

Collaboration graph
[legend]
List of all members.

Detailed Description

A view that shows some subset of TaskViews in an list, ordered by priority.

Author:
Brian Ellis


Public Member Functions

 TaskSubpaneView (String title, int normalCount, TaskFilter filter)
 Constructs a TaskSubpaneView with the given normal task count and task filter.
void markTaskShouldAnimate (Task t)
Dimension getPreferredScrollableViewportSize ()
int getScrollableBlockIncrement (Rectangle visibleRect, int orientation, int direction)
boolean getScrollableTracksViewportHeight ()
boolean getScrollableTracksViewportWidth ()
int getScrollableUnitIncrement (Rectangle visibleRect, int orientation, int direction)
Dimension recomputePreferredSize ()
 Should be implemented to return the preferred size of the container given its content.
SubpaneState getState ()
 Accessor method for state.
void setState (SubpaneState theState)
 Setter method for state.
void doLayout ()
TaskFilter getFilter ()
 Accessor method for filter.
void setFilter (TaskFilter filter)
 Setter method for filter.
void animationDidUpdate (final Animation a)
 Called by the AnimationManager when an animation is updated.
Dimension getPreferredSize ()
 Calls recomputePreferredSize() and returns the result, unless we have at least one animation in progress, in which case the value returned will be what recomputePreferredSize() returned the last time it was called.
void paint (Graphics g)
 Calls super.paint() unless ignorePaintRequests is true, in which case we draw our stored buffer instead.
void update ()
 Causes this view to synchronize itself with the TaskManager.
void validate ()
 Calls super.validate() unless we have at least one animation in progress, in which case no validation is performed.
void animationDidUpdate (Animation a)
 Called when a given Animation for which this class is a listener has updated its state.

Static Public Member Functions

static void main (String[] args)
 A test program that creates and shows a TaskSubpaneView.

Static Public Attributes

static final String SUBPANE_STATE_PROPERTY = "SubpaneState"
 PropertyChange key for subpane state.

Protected Member Functions

void doUpdate ()
 Lays out all the TaskManager's tasks in order of descending priority.
void prepareAnimations ()
 Should be implemented to record the positions of all the components in the view so they can be animated to their new positions later.
void doAnimations ()
 Should be implemented to record the positions of all the components in the view so they can be animated from their old positions, and then create and start the necessary Animation objects to perform these animations.
void safeUpdateAnimation (Animation a)
 Should be implemented to process an updated animation, just like AnimationListener.animationDidUpdate(Animation).
void decrementNumAnimating ()
 Subtracts one from the number of running animations.
int getNumAnimating ()
 Gets the number of animations that have successfully started running.
int getTotalAnimations ()
 Gets the total number of animations that must complete before the entire set of animations should be declared finished.
void incrementNumAnimating ()
 Adds one to the number of running animations.
void setIgnorePaintRequests (boolean ignorePaintRequests)
 Determines whether or not the view should ignore requests to paint itself.
void setNumAnimating (int numAnimating)
 Sets the number of animations that have successfully started running.
void setTotalAnimations (int totalAnimations)
 Sets the total number of animations that must complete before the entire set of animations should be declared finished.
Dimension getSystemPreferredSize ()

Package Attributes

JButton moreLink
 The link at the bottom of the subpane that allows the user to see more or fewer items.
int normalCount = 0
 The number of items that should be shown in this view when it is in the "normal" state.

Static Package Attributes

static TaskSubpaneView subpaneView
 Test instance.

Private Member Functions

void setup ()
 Sets up the appearance of the view.
boolean shouldAnimateAddDelete (TaskView c)
 
Parameters:
c 

void setShouldAnimateAddDelete (Task t, boolean shouldAnimate)
 
Parameters:
t 


Private Attributes

HashMap< Component, Rectangle > oldRects
 Map containing the old bounds of the components before the current update.
SubpaneState state = SubpaneState.NORMAL
 The current state of this subpane.
String title
 The title of this subpane.
TaskFilter filter
 The TaskFilter that is used to determine which tasks show up in this subpane.
TaskSubpaneTitleView titleView
 The title view for this subpane.
Map< Task, Boolean > addDeleteAnimateMap


Constructor & Destructor Documentation

edu.cmu.hcii.calo.view.TaskSubpaneView.TaskSubpaneView ( String  title,
int  normalCount,
TaskFilter  filter 
)

Constructs a TaskSubpaneView with the given normal task count and task filter.

It will be populated with tasks from the TaskManager. Note that an item will be shown in the maximized state as long as it matches the filter, and in normal mode only if it both matches the filter and is one of the normalCount highest-priority tasks that match the filter.

Parameters:
title the title of this subpane
normalCount the number of tasks to show in the normal state
filter the task filter to use for this subpane


Member Function Documentation

static void edu.cmu.hcii.calo.view.TaskSubpaneView.main ( String[]  args  )  [static]

A test program that creates and shows a TaskSubpaneView.

Parameters:
args command-line args; don't bother passing any

void edu.cmu.hcii.calo.view.TaskSubpaneView.setup (  )  [private]

Sets up the appearance of the view.

void edu.cmu.hcii.calo.view.TaskSubpaneView.markTaskShouldAnimate ( Task  t  ) 

void edu.cmu.hcii.calo.view.TaskSubpaneView.doUpdate (  )  [protected, virtual]

Lays out all the TaskManager's tasks in order of descending priority.

Implements edu.cmu.hcii.calo.view.AnimatedPane.

void edu.cmu.hcii.calo.view.TaskSubpaneView.prepareAnimations (  )  [protected, virtual]

Should be implemented to record the positions of all the components in the view so they can be animated to their new positions later.

prepareAnimations() is called from update() before doUpdate() is invoked, so the component positions are unchanged from what they were before the update.

Implements edu.cmu.hcii.calo.view.AnimatedPane.

void edu.cmu.hcii.calo.view.TaskSubpaneView.doAnimations (  )  [protected, virtual]

Should be implemented to record the positions of all the components in the view so they can be animated from their old positions, and then create and start the necessary Animation objects to perform these animations.

Implements edu.cmu.hcii.calo.view.AnimatedPane.

boolean edu.cmu.hcii.calo.view.TaskSubpaneView.shouldAnimateAddDelete ( TaskView  c  )  [private]

Parameters:
c 

Returns:
Todo:
This should apply to movement animation as well.

void edu.cmu.hcii.calo.view.TaskSubpaneView.setShouldAnimateAddDelete ( Task  t,
boolean  shouldAnimate 
) [private]

Parameters:
t 

Parameters:
shouldAnimate 
Todo:
This should apply to movement animation as well.

Dimension edu.cmu.hcii.calo.view.TaskSubpaneView.getPreferredScrollableViewportSize (  ) 

int edu.cmu.hcii.calo.view.TaskSubpaneView.getScrollableBlockIncrement ( Rectangle  visibleRect,
int  orientation,
int  direction 
)

boolean edu.cmu.hcii.calo.view.TaskSubpaneView.getScrollableTracksViewportHeight (  ) 

boolean edu.cmu.hcii.calo.view.TaskSubpaneView.getScrollableTracksViewportWidth (  ) 

int edu.cmu.hcii.calo.view.TaskSubpaneView.getScrollableUnitIncrement ( Rectangle  visibleRect,
int  orientation,
int  direction 
)

Dimension edu.cmu.hcii.calo.view.TaskSubpaneView.recomputePreferredSize (  )  [virtual]

Should be implemented to return the preferred size of the container given its content.

This may be as simple as a call to super.getPreferredSize(), but in some layout managers this will cause a deferred validation which will interfere with the animation. If this occurs for you, you will need to calculate the preferred size manually by looking at the component positions.

Returns:
the preferred size of the container

Implements edu.cmu.hcii.calo.view.AnimatedPane.

void edu.cmu.hcii.calo.view.TaskSubpaneView.safeUpdateAnimation ( Animation  a  )  [protected, virtual]

Should be implemented to process an updated animation, just like AnimationListener.animationDidUpdate(Animation).

This method exists because AnimatedPane performs some automatic setup and teardown in animationDidUpdate(Animation), and calls safeUpdateAnimation(Animation) in between.

Implements edu.cmu.hcii.calo.view.AnimatedPane.

SubpaneState edu.cmu.hcii.calo.view.TaskSubpaneView.getState (  ) 

Accessor method for state.

Returns:
the value of state

void edu.cmu.hcii.calo.view.TaskSubpaneView.setState ( SubpaneState  theState  ) 

Setter method for state.

Parameters:
theState The new value for state

void edu.cmu.hcii.calo.view.TaskSubpaneView.doLayout (  ) 

TaskFilter edu.cmu.hcii.calo.view.TaskSubpaneView.getFilter (  ) 

Accessor method for filter.

Returns:
the value of filter

void edu.cmu.hcii.calo.view.TaskSubpaneView.setFilter ( TaskFilter  filter  ) 

Setter method for filter.

Parameters:
filter the filter to set

void edu.cmu.hcii.calo.view.AnimatedPane.animationDidUpdate ( final Animation  a  )  [inherited]

Called by the AnimationManager when an animation is updated.

Subclasses should NOT override this method to handle animations, and should instead implement safeUpdateAnimation(Animation).

Parameters:
a the animation being updated

Dimension edu.cmu.hcii.calo.view.AnimatedPane.getPreferredSize (  )  [inherited]

Calls recomputePreferredSize() and returns the result, unless we have at least one animation in progress, in which case the value returned will be what recomputePreferredSize() returned the last time it was called.

This prevents the preferred size to be recalculated based on components that are in the middle of moving from one place to another.

Note that under no circumstances will this call super.getPreferredSize(), as in some layout managers getPreferredSize will automatically invoke revalidate(), which causes race conditions and other related nastiness. If you know this is not the case for the layout manager you are using, simply implement recomputePreferredSize() to return super.getPreferredSize(). Otherwise, you can compute the preferred size manually to avoid this.

Returns:
the preferred size of the container
See also:
javax.swing.JComponent.getPreferredSize()

void edu.cmu.hcii.calo.view.AnimatedPane.paint ( Graphics  g  )  [inherited]

Calls super.paint() unless ignorePaintRequests is true, in which case we draw our stored buffer instead.

This ameliorates the effect of the views snapping to their eventual destination positions when validate is called just before the animation begins, though it does not completely eliminate the effect in all instances.

Parameters:
g the Graphics instance to paint into
See also:
javax.swing.JComponent.paint(java.awt.Graphics)

void edu.cmu.hcii.calo.view.AnimatedPane.update (  )  [inherited]

Causes this view to synchronize itself with the TaskManager.

Specifically, the view first calls prepareAnimations() to allow the old positions of its components to be recorded. Next, it sets ignorePaintRequests to true if the view is visible onscreen, and calls doUpdate(). Then, validate() is called to recompute the positions of all the components in the view, and the view is resized to its preferred size. Lastly, doAnimations() is called to allow the new positions of the components to be recorded and the animations to be started.

void edu.cmu.hcii.calo.view.AnimatedPane.validate (  )  [inherited]

Calls super.validate() unless we have at least one animation in progress, in which case no validation is performed.

This prevents ancestor views from messing up the animation by forcing the container to recompute its layout in the middle.

See also:
java.awt.Container.validate()

void edu.cmu.hcii.calo.view.AnimatedPane.decrementNumAnimating (  )  [protected, inherited]

Subtracts one from the number of running animations.

Exactly equivalent to setNumAnimating(getNumAnimating() - 1). You usually do not need to call this method; the number of animations will automatically be decremented by AnimatedPane when each animation finishes.

int edu.cmu.hcii.calo.view.AnimatedPane.getNumAnimating (  )  [protected, inherited]

Gets the number of animations that have successfully started running.

This number will change when you call setNumAnimating(int) or incrementNumAnimating(), and will also decrement automatically when animations finish.

Returns:
the number of running animations

int edu.cmu.hcii.calo.view.AnimatedPane.getTotalAnimations (  )  [protected, inherited]

Gets the total number of animations that must complete before the entire set of animations should be declared finished.

Returns:
the total number of animations to be run

void edu.cmu.hcii.calo.view.AnimatedPane.incrementNumAnimating (  )  [protected, inherited]

Adds one to the number of running animations.

Exactly equivalent to setNumAnimating(getNumAnimating() + 1).

void edu.cmu.hcii.calo.view.AnimatedPane.setIgnorePaintRequests ( boolean  ignorePaintRequests  )  [protected, inherited]

Determines whether or not the view should ignore requests to paint itself.

If set to true, AnimatedPane will make a cached buffer of the window contents as they appear right now, and any subsequent requests to paint will be fulfilled by using this buffer. Thus, there will be no flickering or "giant eraser" effect, but any changes to the layout will be hidden until you are ready to show them.

Note:
This differs from JComponent.setIgnoreRepaint(boolean) in that setIgnorePaintRequests affects ALL paint requests, including paint events generated in software by the AWT. While ignorePaintRequests is set, the screen is guaranteed never to update.
Parameters:
ignorePaintRequests true to ignore paint requests, false to service them as usual.

void edu.cmu.hcii.calo.view.AnimatedPane.setNumAnimating ( int  numAnimating  )  [protected, inherited]

Sets the number of animations that have successfully started running.

It is often more convenient to use incrementNumAnimating() instead.

Parameters:
numAnimating the new number of running animations
See also:
incrementNumAnimating()

void edu.cmu.hcii.calo.view.AnimatedPane.setTotalAnimations ( int  totalAnimations  )  [protected, inherited]

Sets the total number of animations that must complete before the entire set of animations should be declared finished.

This should be called in doAnimations() so that AnimatedPane can determine when to begin servicing paint events again.

Parameters:
totalAnimations the total number of animations to be run

Dimension edu.cmu.hcii.calo.view.AnimatedPane.getSystemPreferredSize (  )  [protected, inherited]

void edu.cmu.hcii.calo.view.animation.AnimationListener.animationDidUpdate ( Animation  a  )  [inherited]

Called when a given Animation for which this class is a listener has updated its state.

This method will be called as often as possible while the Animation is running, and at least once when it has finished. A class can listen to more than one Animation at a time, in which case it should use the parameter to this method to determine which Animation has updated.

Parameters:
a the Animation that has updated

Implemented in edu.cmu.hcii.calo.test.AnimationTest, edu.cmu.hcii.calo.test.manual.AnimationDemo, and edu.cmu.hcii.calo.test.manual.PanelSwapDemo.


Member Data Documentation

final String edu.cmu.hcii.calo.view.TaskSubpaneView.SUBPANE_STATE_PROPERTY = "SubpaneState" [static]

PropertyChange key for subpane state.

TaskSubpaneView edu.cmu.hcii.calo.view.TaskSubpaneView.subpaneView [static, package]

Test instance.

HashMap<Component, Rectangle> edu.cmu.hcii.calo.view.TaskSubpaneView.oldRects [private]

Map containing the old bounds of the components before the current update.

SubpaneState edu.cmu.hcii.calo.view.TaskSubpaneView.state = SubpaneState.NORMAL [private]

The current state of this subpane.

String edu.cmu.hcii.calo.view.TaskSubpaneView.title [private]

The title of this subpane.

TaskFilter edu.cmu.hcii.calo.view.TaskSubpaneView.filter [private]

The TaskFilter that is used to determine which tasks show up in this subpane.

TaskSubpaneTitleView edu.cmu.hcii.calo.view.TaskSubpaneView.titleView [private]

The title view for this subpane.

JButton edu.cmu.hcii.calo.view.TaskSubpaneView.moreLink [package]

The link at the bottom of the subpane that allows the user to see more or fewer items.

int edu.cmu.hcii.calo.view.TaskSubpaneView.normalCount = 0 [package]

The number of items that should be shown in this view when it is in the "normal" state.

Map<Task, Boolean> edu.cmu.hcii.calo.view.TaskSubpaneView.addDeleteAnimateMap [private]


The documentation for this class was generated from the following file:
Generated on Mon Jul 9 12:34:42 2007 for CALO by  doxygen 1.5.2