001         package com.croftsoft.core.animation.collector;
002    
003         import java.awt.Rectangle;
004    
005         import com.croftsoft.core.animation.RepaintCollector;
006    
007         /*********************************************************************
008         * Repaints entire component if there is a repaint request of any size.
009         *
010         * <p>
011         * Another way to think of this RepaintCollector implementation is
012         * "all-or-nothing".
013         * </p>
014         *
015         * @version
016         *   2002-12-01
017         * @since
018         *   2002-11-30
019         * @author
020         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
021         *********************************************************************/
022    
023         public class  BooleanRepaintCollector
024           implements RepaintCollector
025         //////////////////////////////////////////////////////////////////////
026         //////////////////////////////////////////////////////////////////////
027         {
028    
029         private static final Rectangle [ ]  REPAINT_REGIONS
030           = new Rectangle [ ] {
031           new Rectangle ( Integer.MAX_VALUE, Integer.MAX_VALUE ) };
032    
033         //
034    
035         private boolean  doRepaint;
036    
037         //////////////////////////////////////////////////////////////////////
038         // accessor methods
039         //////////////////////////////////////////////////////////////////////
040    
041         public int  getCount ( )
042         //////////////////////////////////////////////////////////////////////
043         {
044           return doRepaint ? 1 : 0;
045         }
046    
047         public Rectangle [ ]  getRepaintRegions ( )
048         //////////////////////////////////////////////////////////////////////
049         {
050           return REPAINT_REGIONS;
051         }
052    
053         //////////////////////////////////////////////////////////////////////
054         // mutator methods
055         //////////////////////////////////////////////////////////////////////
056    
057         public void  repaint (
058           int  x,
059           int  y,
060           int  width,
061           int  height )
062         //////////////////////////////////////////////////////////////////////
063         {
064           doRepaint = true;
065         }
066    
067         public void  repaint ( )
068         //////////////////////////////////////////////////////////////////////
069         {
070           doRepaint = true;
071         }
072    
073         public void  reset ( )
074         //////////////////////////////////////////////////////////////////////
075         {
076           doRepaint = false;
077         }
078    
079         //////////////////////////////////////////////////////////////////////
080         //////////////////////////////////////////////////////////////////////
081         }