jfreerails.client.common
Class RepaintManagerForActiveRendering

java.lang.Object
  extended by javax.swing.RepaintManager
      extended by jfreerails.client.common.RepaintManagerForActiveRendering

public final class RepaintManagerForActiveRendering
extends javax.swing.RepaintManager

This RepaintManager is intended to be used when we are using active rendering to paint a top level component. Repaint requests for components whose TopLevelAncestor is the component being actively rendered in the game loop are ignored; repaint requests for components whose TopLevelAncestor is not the component being actively rendered in the game loop are processed normally. This behaviour is needed because when menus extend outside the bounds of their parent window, they have a different top level component to the parent window, so are not painted when paintCompoments is called from the game loop.

Author:
Luke

Field Summary
private static java.util.HashSet<javax.swing.JFrame> activelyRendereredComponents
          The JFrame(s) that are being actively rendered in the game loop(s).
private static RepaintManagerForActiveRendering instance
           
private static long numRepaintRequests
           
 
Constructor Summary
private RepaintManagerForActiveRendering()
           
 
Method Summary
 void addDirtyRegion(javax.swing.JComponent c, int x, int y, int w, int h)
           
 void addInvalidComponent(javax.swing.JComponent invalidComponent)
           
static void addJFrame(javax.swing.JFrame f)
           
static long getNumRepaintRequests()
           
private  boolean hasDifferentAncester(javax.swing.JComponent aComponent)
           
 void markCompletelyClean(javax.swing.JComponent aComponent)
           
 void markCompletelyDirty(javax.swing.JComponent aComponent)
           
static void setAsCurrentManager()
           
 
Methods inherited from class javax.swing.RepaintManager
currentManager, currentManager, getDirtyRegion, getDoubleBufferMaximumSize, getOffscreenBuffer, getVolatileOffscreenBuffer, isCompletelyDirty, isDoubleBufferingEnabled, paintDirtyRegions, removeInvalidComponent, setCurrentManager, setDoubleBufferingEnabled, setDoubleBufferMaximumSize, toString, validateInvalidComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activelyRendereredComponents

private static final java.util.HashSet<javax.swing.JFrame> activelyRendereredComponents
The JFrame(s) that are being actively rendered in the game loop(s).


instance

private static final RepaintManagerForActiveRendering instance

numRepaintRequests

private static long numRepaintRequests
Constructor Detail

RepaintManagerForActiveRendering

private RepaintManagerForActiveRendering()
Method Detail

setAsCurrentManager

public static void setAsCurrentManager()

addDirtyRegion

public void addDirtyRegion(javax.swing.JComponent c,
                           int x,
                           int y,
                           int w,
                           int h)
Overrides:
addDirtyRegion in class javax.swing.RepaintManager

addJFrame

public static void addJFrame(javax.swing.JFrame f)

addInvalidComponent

public void addInvalidComponent(javax.swing.JComponent invalidComponent)
Overrides:
addInvalidComponent in class javax.swing.RepaintManager

markCompletelyClean

public void markCompletelyClean(javax.swing.JComponent aComponent)
Overrides:
markCompletelyClean in class javax.swing.RepaintManager

markCompletelyDirty

public void markCompletelyDirty(javax.swing.JComponent aComponent)
Overrides:
markCompletelyDirty in class javax.swing.RepaintManager

hasDifferentAncester

private boolean hasDifferentAncester(javax.swing.JComponent aComponent)

getNumRepaintRequests

public static long getNumRepaintRequests()