|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.GroupLayout
bb.gui.GroupLayout2
public class GroupLayout2
Subclass of GroupLayout
that adds no new functionality except for implementing Externalizable
,
which is needed because its superclass does not implement Serializable
.
This class implements Externalizable with, essentially, empty methods which read and write no data. The sole purpose of these methods is to preempt calls to its superclass during serialization/deserialization, since those calls will fail.
Correct usage of these class in serialization/deserialization is tricky and usually requires some other class
to customise deserialization (e.g. to manually restore an equivalent GroupLayout instance).
See the source code of LinePanel
for one example.
Like typical Java GUI code, this class is not multithread safe:
it expects to only be called by EventQueue
's dispatch thread
.
This threading limitation is checked in every public method.
Nested Class Summary | |
---|---|
static class |
GroupLayout2.UnitTest
See the Overview page of the project's javadocs for a general description of this unit test class. |
Nested classes/interfaces inherited from class javax.swing.GroupLayout |
---|
GroupLayout.Alignment, GroupLayout.Group, GroupLayout.ParallelGroup, GroupLayout.SequentialGroup |
Field Summary | |
---|---|
private static Container |
hostDummy
The sole purpose of this method is to provide a host value for the public no-arg constructor . |
private static long |
serialVersionUID
|
Fields inherited from class javax.swing.GroupLayout |
---|
DEFAULT_SIZE, PREFERRED_SIZE |
Constructor Summary | |
---|---|
GroupLayout2()
Calls . |
|
GroupLayout2(Container host)
Calls . |
Method Summary | |
---|---|
void |
readExternal(ObjectInput oi)
Customizes deserialization. |
void |
writeExternal(ObjectOutput oo)
Customizes serialization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final Container hostDummy
public no-arg constructor
.
It is never used for any other purpose.
private static final long serialVersionUID
Constructor Detail |
---|
public GroupLayout2() throws IllegalStateException
this
(hostDummy
)
.
This constructor is needed solely because Externalizable
requires a public no-arg constructor.
Users should never use it.
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
public GroupLayout2(Container host) throws IllegalArgumentException, IllegalStateException
super
(host)
.
host
- the Container the GroupLayout2 is the LayoutManager for
IllegalArgumentException
- if host is null
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
Method Detail |
---|
public void readExternal(ObjectInput oi) throws IllegalStateException
This method does nothing beyond checking the calling thread. Its sole purpose is to keep its unserializable superclass from getting called.
Note that the public no-arg constructor
will have been called
prior to the deserialization process calling this method.
Therefore, after this method returns, this instance has hostDummy
as its host forever,
regardless of what value it had before serialization;
it will always be a worthless instance.
So, users of this class must manually restore a clean new instance when deserializing.
readExternal
in interface Externalizable
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
public void writeExternal(ObjectOutput oo) throws IllegalStateException
This method does nothing beyond checking the calling thread. Its sole purpose is to keep its unserializable superclass from getting called.
writeExternal
in interface Externalizable
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |