javax.swing
Class JComponent.ReadObjectCallback

java.lang.Object
  extended byjavax.swing.JComponent.ReadObjectCallback
All Implemented Interfaces:
ObjectInputValidation
Enclosing class:
JComponent

private class JComponent.ReadObjectCallback
extends Object
implements ObjectInputValidation

This object is the ObjectInputStream callback that's called after a complete graph of objects (including at least one JComponent) has been read. It sets the UI property of each Swing component that was read to the current default with updateUI.

As each component is read in we keep track of the current set of root components here, in the roots vector. Note that there's only one ReadObjectCallback per ObjectInputStream, they're stored in the static readObjectCallbacks hashtable.

See Also:
ObjectInputStream.registerValidation(java.io.ObjectInputValidation, int), SwingUtilities.updateComponentTreeUI(java.awt.Component)

Field Summary
private  ObjectInputStream inputStream
           
private  Vector roots
           
 
Constructor Summary
(package private) JComponent.ReadObjectCallback(ObjectInputStream s)
           
 
Method Summary
private  void registerComponent(JComponent c)
          If c isn't a descendant of a component we've already seen, then add it to the roots Vector.
 void validateObject()
          This is the method that's called after the entire graph of objects has been read in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

roots

private final Vector roots

inputStream

private final ObjectInputStream inputStream
Constructor Detail

JComponent.ReadObjectCallback

JComponent.ReadObjectCallback(ObjectInputStream s)
                        throws Exception
Method Detail

validateObject

public void validateObject()
                    throws InvalidObjectException
This is the method that's called after the entire graph of objects has been read in. It initializes the UI property of all of the copmonents with SwingUtilities.updateComponentTreeUI.

Specified by:
validateObject in interface ObjectInputValidation
Throws:
InvalidObjectException - If the object cannot validate itself.

registerComponent

private void registerComponent(JComponent c)
If c isn't a descendant of a component we've already seen, then add it to the roots Vector.

Parameters:
c - the JComponent to add