home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / swing / BufferStrategyPaintManager$BufferInfo.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  5.4 KB  |  261 lines

  1. package javax.swing;
  2.  
  3. import java.applet.Applet;
  4. import java.awt.AWTException;
  5. import java.awt.BufferCapabilities;
  6. import java.awt.Container;
  7. import java.awt.ImageCapabilities;
  8. import java.awt.Window;
  9. import java.awt.BufferCapabilities.FlipContents;
  10. import java.awt.event.ComponentAdapter;
  11. import java.awt.event.ComponentEvent;
  12. import java.awt.event.WindowEvent;
  13. import java.awt.event.WindowListener;
  14. import java.awt.image.BufferStrategy;
  15. import java.lang.ref.WeakReference;
  16. import java.lang.reflect.InvocationTargetException;
  17. import java.util.logging.Level;
  18. import sun.awt.SubRegionShowable;
  19.  
  20. class BufferStrategyPaintManager$BufferInfo extends ComponentAdapter implements WindowListener {
  21.    private WeakReference<BufferStrategy> weakBS;
  22.    private WeakReference<Container> root;
  23.    private boolean usingFlip;
  24.    private boolean inSync;
  25.    private boolean contentsLostDuringExpose;
  26.    private boolean paintAllOnExpose;
  27.    // $FF: synthetic field
  28.    static final boolean $assertionsDisabled = !BufferStrategyPaintManager.class.desiredAssertionStatus();
  29.    // $FF: synthetic field
  30.    final BufferStrategyPaintManager this$0;
  31.  
  32.    public BufferStrategyPaintManager$BufferInfo(BufferStrategyPaintManager var1, Container var2) {
  33.       this.this$0 = var1;
  34.       this.root = new WeakReference(var2);
  35.       var2.addComponentListener(this);
  36.       if (var2 instanceof Window) {
  37.          ((Window)var2).addWindowListener(this);
  38.       }
  39.  
  40.    }
  41.  
  42.    public void setPaintAllOnExpose(boolean var1) {
  43.       this.paintAllOnExpose = var1;
  44.    }
  45.  
  46.    public boolean getPaintAllOnExpose() {
  47.       return this.paintAllOnExpose;
  48.    }
  49.  
  50.    public void setContentsLostDuringExpose(boolean var1) {
  51.       this.contentsLostDuringExpose = var1;
  52.    }
  53.  
  54.    public boolean getContentsLostDuringExpose() {
  55.       return this.contentsLostDuringExpose;
  56.    }
  57.  
  58.    public void setInSync(boolean var1) {
  59.       this.inSync = var1;
  60.    }
  61.  
  62.    public boolean isInSync() {
  63.       return this.inSync;
  64.    }
  65.  
  66.    public Container getRoot() {
  67.       return this.root == null ? null : (Container)this.root.get();
  68.    }
  69.  
  70.    public BufferStrategy getBufferStrategy(boolean var1) {
  71.       BufferStrategy var2 = this.weakBS == null ? null : (BufferStrategy)this.weakBS.get();
  72.       if (var2 == null && var1) {
  73.          var2 = this.createBufferStrategy();
  74.          if (var2 != null) {
  75.             this.weakBS = new WeakReference(var2);
  76.          }
  77.  
  78.          if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
  79.             BufferStrategyPaintManager.access$700().finer("getBufferStrategy: created bs: " + var2);
  80.          }
  81.       }
  82.  
  83.       return var2;
  84.    }
  85.  
  86.    public boolean usingFlip() {
  87.       return this.usingFlip;
  88.    }
  89.  
  90.    public boolean hasBufferStrategyChanged() {
  91.       Container var1 = this.getRoot();
  92.       if (var1 != null) {
  93.          Object var2 = null;
  94.          BufferStrategy var3 = null;
  95.          BufferStrategy var8 = this.getBufferStrategy(false);
  96.          if (var1 instanceof Window) {
  97.             var3 = ((Window)var1).getBufferStrategy();
  98.          } else {
  99.             try {
  100.                var3 = (BufferStrategy)BufferStrategyPaintManager.access$800().invoke(var1);
  101.             } catch (InvocationTargetException var5) {
  102.                if (!$assertionsDisabled) {
  103.                   throw new AssertionError();
  104.                }
  105.             } catch (IllegalArgumentException var6) {
  106.                if (!$assertionsDisabled) {
  107.                   throw new AssertionError();
  108.                }
  109.             } catch (IllegalAccessException var7) {
  110.                if (!$assertionsDisabled) {
  111.                   throw new AssertionError();
  112.                }
  113.             }
  114.          }
  115.  
  116.          if (var3 != var8) {
  117.             if (var8 != null) {
  118.                var8.dispose();
  119.             }
  120.  
  121.             this.weakBS = null;
  122.             return true;
  123.          }
  124.       }
  125.  
  126.       return false;
  127.    }
  128.  
  129.    private BufferStrategy createBufferStrategy() {
  130.       Container var2 = this.getRoot();
  131.       if (var2 == null) {
  132.          return null;
  133.       } else {
  134.          BufferStrategy var3 = null;
  135.          if (BufferStrategyPaintManager.access$900()) {
  136.             var3 = this.createBufferStrategy(var2, FlipContents.COPIED);
  137.             this.usingFlip = true;
  138.             if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
  139.                BufferStrategyPaintManager.access$700().finer("createBufferStrategy: using flip strategy");
  140.             }
  141.          }
  142.  
  143.          if (var3 == null) {
  144.             var3 = this.createBufferStrategy(var2, (BufferCapabilities.FlipContents)null);
  145.             this.usingFlip = false;
  146.          }
  147.  
  148.          if (!(var3 instanceof SubRegionShowable)) {
  149.             var3 = null;
  150.          }
  151.  
  152.          return var3;
  153.       }
  154.    }
  155.  
  156.    private BufferStrategy createBufferStrategy(Container var1, BufferCapabilities.FlipContents var2) {
  157.       BufferCapabilities var3 = new BufferCapabilities(new ImageCapabilities(true), new ImageCapabilities(true), var2);
  158.       BufferStrategy var4 = null;
  159.       if (var1 instanceof Applet) {
  160.          try {
  161.             BufferStrategyPaintManager.access$1000().invoke(var1, 2, var3);
  162.             var4 = (BufferStrategy)BufferStrategyPaintManager.access$800().invoke(var1);
  163.          } catch (InvocationTargetException var7) {
  164.             if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
  165.                BufferStrategyPaintManager.access$700().log(Level.FINER, "createBufferStratety failed", var7);
  166.             }
  167.          } catch (IllegalArgumentException var8) {
  168.             if (!$assertionsDisabled) {
  169.                throw new AssertionError();
  170.             }
  171.          } catch (IllegalAccessException var9) {
  172.             if (!$assertionsDisabled) {
  173.                throw new AssertionError();
  174.             }
  175.          }
  176.       } else {
  177.          try {
  178.             ((Window)var1).createBufferStrategy(2, var3);
  179.             var4 = ((Window)var1).getBufferStrategy();
  180.          } catch (AWTException var6) {
  181.             if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
  182.                BufferStrategyPaintManager.access$700().log(Level.FINER, "createBufferStratety failed", var6);
  183.             }
  184.          }
  185.       }
  186.  
  187.       return var4;
  188.    }
  189.  
  190.    public void dispose() {
  191.       Container var1 = this.getRoot();
  192.       if (BufferStrategyPaintManager.access$700().isLoggable(Level.FINER)) {
  193.          BufferStrategyPaintManager.access$700().log(Level.FINER, "disposed BufferInfo for: " + var1);
  194.       }
  195.  
  196.       if (var1 != null) {
  197.          var1.removeComponentListener(this);
  198.          if (var1 instanceof Window) {
  199.             ((Window)var1).removeWindowListener(this);
  200.          }
  201.  
  202.          BufferStrategy var2 = this.getBufferStrategy(false);
  203.          if (var2 != null) {
  204.             var2.dispose();
  205.          }
  206.       }
  207.  
  208.       this.root = null;
  209.       this.weakBS = null;
  210.    }
  211.  
  212.    public void componentHidden(ComponentEvent var1) {
  213.       Container var2 = this.getRoot();
  214.       if (var2 != null && var2.isVisible()) {
  215.          var2.repaint();
  216.       } else {
  217.          this.setPaintAllOnExpose(true);
  218.       }
  219.  
  220.    }
  221.  
  222.    public void windowIconified(WindowEvent var1) {
  223.       this.setPaintAllOnExpose(true);
  224.    }
  225.  
  226.    public void windowClosed(WindowEvent var1) {
  227.       synchronized(this.this$0) {
  228.          while(BufferStrategyPaintManager.access$200(this.this$0)) {
  229.             try {
  230.                this.this$0.wait();
  231.             } catch (InterruptedException var5) {
  232.             }
  233.          }
  234.  
  235.          BufferStrategyPaintManager.access$300(this.this$0).remove(this);
  236.       }
  237.  
  238.       this.dispose();
  239.    }
  240.  
  241.    public void windowOpened(WindowEvent var1) {
  242.    }
  243.  
  244.    public void windowClosing(WindowEvent var1) {
  245.    }
  246.  
  247.    public void windowDeiconified(WindowEvent var1) {
  248.    }
  249.  
  250.    public void windowActivated(WindowEvent var1) {
  251.    }
  252.  
  253.    public void windowDeactivated(WindowEvent var1) {
  254.    }
  255.  
  256.    // $FF: synthetic method
  257.    static boolean access$500(BufferStrategyPaintManager$BufferInfo var0) {
  258.       return var0.usingFlip;
  259.    }
  260. }
  261.