edu.umd.cs.jazz.util
Class ZCanvas.ZBasicRepaintManager

java.lang.Object
  |
  +--javax.swing.RepaintManager
        |
        +--edu.umd.cs.jazz.util.ZCanvas.ZBasicRepaintManager
Enclosing class:
ZCanvas

public class ZCanvas.ZBasicRepaintManager
extends javax.swing.RepaintManager

This is an internal class used by Jazz to support Swing components in Jazz. This should not be instantiated, though all the public methods of javax.swing.RepaintManager may still be called and perform in the expected manner. ZBasicRepaint Manager is an extension of RepaintManager that traps those repaints called by the Swing components that have been added to the ZCanvas and passes these repaints to the SwingVisualComponent rather than up the component hierarchy as usually happens. Also traps revalidate calls made by the Swing components added to the ZCanvas to reshape the applicable Visual Component. Also keeps a list of ZSwings that are painting. This disables repaint until the component has finished painting. This is to address a problem introduced by Swing's CellRendererPane which is itself a work-around. The problem is that JTable's, JTree's, and JList's cell renderers need to be validated before repaint. Since we have to repaint the entire Swing component hierarchy (in the case of a Swing component group used as a Jazz visual component). This causes an infinite loop. So we introduce the restriction that no repaints can be triggered by a call to paint.


Constructor Summary
ZCanvas.ZBasicRepaintManager()
           
 
Method Summary
 void addDirtyRegion(javax.swing.JComponent c, int x, int y, int w, int h)
          This is the method "repaint" now calls in the Swing components.
 void addInvalidComponent(javax.swing.JComponent invalidComponent)
          This is the method "revalidate" calls in the Swing components.
 boolean isPainting(javax.swing.JComponent c)
          Returns true if repaint is currently locked for a component and false otherwise
 void lockRepaint(javax.swing.JComponent c)
          Locks repaint for a particular (Swing) component displayed by ZCanvas
 void unlockRepaint(javax.swing.JComponent c)
          Unlocks repaint for a particular (Swing) component displayed by ZCanvas
 
Methods inherited from class javax.swing.RepaintManager
currentManager, currentManager, getDirtyRegion, getDoubleBufferMaximumSize, getOffscreenBuffer, getVolatileOffscreenBuffer, isCompletelyDirty, isDoubleBufferingEnabled, markCompletelyClean, markCompletelyDirty, paintDirtyRegions, removeInvalidComponent, setCurrentManager, setDoubleBufferingEnabled, setDoubleBufferMaximumSize, toString, validateInvalidComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZCanvas.ZBasicRepaintManager

public ZCanvas.ZBasicRepaintManager()
Method Detail

lockRepaint

public void lockRepaint(javax.swing.JComponent c)
Locks repaint for a particular (Swing) component displayed by ZCanvas

Parameters:
c - The component for which the repaint is to be locked

unlockRepaint

public void unlockRepaint(javax.swing.JComponent c)
Unlocks repaint for a particular (Swing) component displayed by ZCanvas

Parameters:
c - The component for which the repaint is to be unlocked

isPainting

public boolean isPainting(javax.swing.JComponent c)
Returns true if repaint is currently locked for a component and false otherwise

Parameters:
c - The component for which the repaint status is desired
Returns:
Whether the component is currently painting

addDirtyRegion

public void addDirtyRegion(javax.swing.JComponent c,
                           int x,
                           int y,
                           int w,
                           int h)
This is the method "repaint" now calls in the Swing components. Overridden to capture repaint calls from those Swing components which are being used as Jazz visual components and to call the Jazz repaint mechanism rather than the traditional Component hierarchy repaint mechanism. Otherwise, behaves like the superclass.

Overrides:
addDirtyRegion in class javax.swing.RepaintManager
Parameters:
c - Component to be repainted
x - X coordinate of the dirty region in the component
y - Y coordinate of the dirty region in the component
w - Width of the dirty region in the component
h - Height of the dirty region in the component

addInvalidComponent

public void addInvalidComponent(javax.swing.JComponent invalidComponent)
This is the method "revalidate" calls in the Swing components. Overridden to capture revalidate calls from those Swing components being used as Jazz visual components and to update Jazz's visual component wrapper bounds (these are stored separately from the Swing component). Otherwise, behaves like the superclass.

Overrides:
addInvalidComponent in class javax.swing.RepaintManager
Parameters:
invalidComponent - The Swing component that needs validation


Copyright 2003 by University of Maryland, College Park, MD 20742, USA All rights reserved.