Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » How does VE render beans at design time?
How does VE render beans at design time? [message #608993] Thu, 07 July 2005 18:26
Eclipse UserFriend
Originally posted by: eclipse.downeyfarnsworth.com

I'm working on a math graphing application (webcompmath at sourceforge) and
am trying to get it to work with VE and have encountered some puzzling
issues with how/when VE renders images.

Background: The application has a class, DisplayCanvas, that extends JPanel.
All of the graph drawing is done on a DisplayCanvas by Drawable objects
(axes, graphs, points, etc). Drawable extends Object (not one of the AWT or
Swing classes). DisplayCanvas has an add method for adding these types, and
it's paintComponent method asks all its Drawable members to draw themselves
on the panel.

I created a new Swing applet as a visual class in Eclipse and dragged a
DisplayCanvas bean to it. I found that I then can't drag a Drawable bean to
the DisplayCanvas in VE, and it appears this is because Drawables are not
Components (and I assume that VE doesn't know about the overloaded add
method in my DisplayCanvas class). I can drag a Drawable bean to the top
level and it shows up as a non-visual bean. I assume I can fix this with a
plugin, once I understand the Orme/Mendel/Winchester tutorial on extending
VE.

If I manually insert a line of code to my visual class to add( ) the
Drawable bean to the DisplayCanvas, VE now shows the Drawable as a child of
the DisplayCanvas in the JavaBean view (presumably because it parsed the add
method call). But the Drawable doesn't get rendered in the design view (but
does when I run the applet). This is not surprising.

What surprised me was when, instead of calling add( ) to add the Drawable to
the DisplayCanvas, I used a setter. For example, to add an Axes object
(which extends Drawable), I used setAxes and getAxes in DisplayCanvas. The
setAxes method just calls add( ) to add the axes object to the
DisplayCanvas. I used the property editor in VE to point this property an
Axes object that I had dropped at the top level, which generates the
appropriate setAxes call in the code. Voila! The axes get displayed on the
design view (and when I run the applet).

In both cases, the applet when run shows the same graph with axes. It seems
that when the add( ) method is "hidden" from VE (in the setter case, the
add( ) call lives in the DisplayCanvas code), VE seems to cause to be called
DisplayCanvas.paintComponent, which has had its axes property set, which
caused the axes to get added to it, and hence get displayed. When the add( )
call instead resides in the visual applet being edited by VE, then for some
reason this add( ) doesn't seem to do anything (if it did, then the Axes
would have been added to the DisplayCanvas in the design VM and would have
displayed when the DsiplayCanvas is asked to paint itself).

Before I dive into the VE code, is there a simple explanation for what's
going on?
Previous Topic:How to retrieve the information displayed in "Java Beans"
Next Topic:SWT stuff not showing up on Palette
Goto Forum:
  


Current Time: Fri Apr 26 16:12:02 GMT 2024

Powered by FUDForum. Page generated in 0.02909 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top