Commit ea899eff by Roman Kennke Committed by Michael Koch

CellRendererPane.java: implemented all methods of this class.

2005-04-19  Roman Kennke  <roman@ontographics.com>

	* javax/swing/CellRendererPane.java:
	implemented all methods of this class.
	reformatted all wrong formatted code.

From-SVN: r98379
parent f8bf4f42
2005-04-19 Roman Kennke <roman@ontographics.com>
* javax/swing/CellRendererPane.java:
implemented all methods of this class.
reformatted all wrong formatted code.
2005-04-19 Roman Kennke <roman@kennke.org> 2005-04-19 Roman Kennke <roman@kennke.org>
* javax/swing/BoxLayout.java: * javax/swing/BoxLayout.java:
......
...@@ -50,11 +50,16 @@ import javax.accessibility.AccessibleContext; ...@@ -50,11 +50,16 @@ import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole; import javax.accessibility.AccessibleRole;
/** /**
* CellRendererPane * The CellRendererPane's purpose is to paint the cells of JList, JTable and
* JTree. It intercepts the usual paint tree, so that we don't walk up and
* repaint everything.
*
* @author Andrew Selkirk * @author Andrew Selkirk
* @version 1.0 * @version 1.0
*/ */
public class CellRendererPane extends Container implements Accessible public class CellRendererPane
extends Container
implements Accessible
{ {
private static final long serialVersionUID = -7642183829532984273L; private static final long serialVersionUID = -7642183829532984273L;
...@@ -94,10 +99,10 @@ public class CellRendererPane extends Container implements Accessible ...@@ -94,10 +99,10 @@ public class CellRendererPane extends Container implements Accessible
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* Constructor CellRendererPane * Constructs a new CellRendererPane.
*/ */
public CellRendererPane() { public CellRendererPane()
// TODO {
} // CellRendererPane() } // CellRendererPane()
...@@ -106,93 +111,139 @@ public class CellRendererPane extends Container implements Accessible ...@@ -106,93 +111,139 @@ public class CellRendererPane extends Container implements Accessible
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* writeObject * Should not be called.
* @param stream TODO *
* @exception IOException TODO * @param graphics not used here
*/
private void writeObject(ObjectOutputStream stream) throws IOException {
// TODO
} // writeObject()
/**
* update
* @param graphics TODO
*/ */
public void update(Graphics graphics) { public void update(Graphics graphics)
// TODO {
} // update() } // update()
/** /**
* invalidate * Despite normal behaviour this does <em>not</em> cause the container
* to be invalidated. This prevents propagating up the paint tree.
*/ */
public void invalidate() { public void invalidate()
// TODO {
} // invalidate() } // invalidate()
/** /**
* paint * Should not be called.
* @param graphics TODO *
* @param graphics not used here
*/ */
public void paint(Graphics graphics) { public void paint(Graphics graphics)
// TODO {
} // paint() }
/** /**
* addImpl * Overridden to check if a component is already a child of this Container.
* @param c TODO * If it's already a child, nothing is done. Otherwise we pass this to
* @param constraints TODO * <code>super.addImpl()</code>.
* @param index TODO *
* @param c the component to add
* @param constraints not used here
* @param index not used here
*/ */
protected void addImpl(Component c, Object constraints, int index) { protected void addImpl(Component c, Object constraints, int index)
// TODO {
if (!isAncestorOf(c))
{
super.addImpl(c, constraints, index);
}
} // addImpl() } // addImpl()
/** /**
* paintComponent * Paints the specified component <code>c</code> on the {@link Graphics}
* @param graphics TODO * context <code>graphics</code>. The Graphics context is tranlated to
* @param c TODO * (x,y) and the components bounds are set to (w,h). If
* @param p TODO * <code>shouldValidate</code>
* @param x TODO * is set to true, then the component is validated before painting.
* @param y TODO *
* @param w TODO * @param graphics the graphics context to paint on
* @param h TODO * @param c the component to be painted
* @param shouldValidate TODO * @param p the parent of the component
* @param x the X coordinate of the upper left corner where c should
be painted
* @param y the Y coordinate of the upper left corner where c should
be painted
* @param w the width of the components drawing area
* @param h the height of the components drawing area
* @param shouldValidate if <code>c</code> should be validated before
* painting
*/ */
public void paintComponent(Graphics graphics, Component c, public void paintComponent(Graphics graphics, Component c,
Container p, int x, int y, int w, int h, Container p, int x, int y, int w, int h,
boolean shouldValidate) { boolean shouldValidate)
// TODO {
// reparent c
addImpl(c, null, 0);
// translate to (x,y)
graphics.translate(x, y);
// set bounds of c
c.setBounds(0, 0, w, h);
// validate if necessary
if (shouldValidate)
{
c.validate();
}
// paint component
c.paint(graphics);
// untranslate g
graphics.translate(-x, -y);
} // paintComponent() } // paintComponent()
/** /**
* paintComponent * Paints the specified component <code>c</code> on the {@link Graphics}
* @param graphics TODO * context <code>graphics</code>. The Graphics context is tranlated to (x,y)
* @param c TODO * and the components bounds are set to (w,h). The component is <em>not</em>
* @param p TODO * validated before painting.
* @param x TODO *
* @param y TODO * @param graphics the graphics context to paint on
* @param w TODO * @param c the component to be painted
* @param h TODO * @param p the parent of the component
* @param x the X coordinate of the upper left corner where c should
be painted
* @param y the Y coordinate of the upper left corner where c should
be painted
* @param w the width of the components drawing area
* @param h the height of the components drawing area
*/ */
public void paintComponent(Graphics graphics, Component c, public void paintComponent(Graphics graphics, Component c,
Container p, int x, int y, int w, int h) { Container p, int x, int y, int w, int h) {
// TODO
paintComponent(graphics, c, p, x, y, w, h, false);
} // paintComponent() } // paintComponent()
/** /**
* paintComponent * Paints the specified component <code>c</code> on the {@link Graphics}
* @param graphics TODO * context <code>g</code>. The Graphics context is tranlated to (r.x,r.y) and
* @param c TODO * the components bounds are set to (r.width,r.height).
* @param p TODO * The component is <em>not</em>
* @param r TODO * validated before painting.
*
* @param graphics the graphics context to paint on
* @param c the component to be painted
* @param p the component on which we paint
* @param r the bounding rectangle of c
*/ */
public void paintComponent(Graphics graphics, Component c, public void paintComponent(Graphics graphics, Component c,
Container p, Rectangle r) { Container p, Rectangle r)
// TODO {
paintComponent(graphics, c, p, r.x, r.y, r.width, r.height);
} // paintComponent() } // paintComponent()
/** /**
* getAccessibleContext * getAccessibleContext <em>TODO</em>
* @return AccessibleContext * @return AccessibleContext
*/ */
public AccessibleContext getAccessibleContext() public AccessibleContext getAccessibleContext()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment