Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Disable execution of initialize() in VE
Disable execution of initialize() in VE [message #617415] Fri, 04 September 2009 06:37
Kaspar  von Gunten is currently offline Kaspar von Gunten
Messages: 21
Registered: July 2009
Junior Member
Hi everybody

For reasons too long to explain here, we are required to use the VE to
define panels, that extend other panels which were already designed by the
VE.

At first sight, it does of course not make sense to extend a visual bean,
because the superclass would already paint/create a GUI. But we need this,
so that the resulting subclass has the same type as the superclass and can
be used in places where this one could (i.e. use B1 extends B, use visual
bean B1 in places where B is expected).

To resolve the problem with the "double GUI definition" we attempt to turn
off the execution of the "initialize()" method in the super class. We
detect during the execution of the (super) constructor, that we are
executing the initialization of an extending panel. This is fairly easy:

public class B extends GridBagPanel
{
public B()
{
super();
if (this.getClass() == B.class)
{
initialize();
}
}
...
}

public class B1 extends B
{
public B1()
{
super();
if (this.getClass() == B1.class)
{
initialize();
}
}
...
}

This works great in practice, too. If I execute this and show a B1
instance, then only initialize() of B1 will be executed, initialize() of B
will be skipped.

HOWEVER, if I open B1 in the VE, then I somehow get both GUIs painted on
top of each other, inspection shows that initialize() of B is executed?!
(During the execution of B's constructor this.getClass() is actually equal
to B.class as debugging shows).

See here: http://de.tinypic.com/r/rcqxqd/3 to get screenshots of the
behavior (sorry for the crappy site, it was the first hit in Google).

Can anyone explain this to me or suggest another way, how I can turn off
the execution/painting of initialize() in a visual bean super class?

Suggestions are greatly appreciated,
Kaspar
Previous Topic:Disable execution of initialize() in VE
Next Topic:VE Code Generation: Who generates global variable declarations?
Goto Forum:
  


Current Time: Thu Jul 31 05:36:20 EDT 2014

Powered by FUDForum. Page generated in 0.01431 seconds