(Answer) (Category) FAQ-O-Matic : (Category) General : (Category) Designer :
How do I write my own proxy classes for the Designer?
Here's a working example:

com.aravox.jwizard.WizardPanel is an abstract class which extends JPanel. This class is abstract because child classes must reimplement two methods which deal with the focus policy.
If I attempt to model a component which extends this class, Designer will display my component as the infamous 'red bean' because the parent of my component is abstract. There's no way Designer can know about the two abstract methods child classes must implement, so its attempt to instantiate the model using the abstract parent class fails miserably.

To solve this problem, I must create a concrete version of the abstract parent class which will serve as the Designer's proxy for the abstract class.

  public class WizardPanelProxy extends WizardPanel {
public WizardPanelProxy() { try { jbInit(); catch (Exception ex) { ex.printStackTrace(); } } private jbInit() throws Exception { ... } // implement any abstract methods here ... }

Once this builds and compiles, place it and everything it depends upon into a jar of its own. Copy this jar into jbuilder4/lib/ext. (Or, place a symlink there which points to the jar file, which is what I actually did.) Note that the code must only compile, it need not actually do anything useful!

Edit your .jbuilder4/user.properties file and find the proxy section. I added the following line to mine:

  designer;proxy.com.aravox.JWizard.WizardPanel=
     com.aravox.unpackwizard.jbproxies.WizardPanelProxy

(This is all one line in the user.properties file, I split it here manually.)

Now, bounce JBuilder. IE, exit, and restart. You must do this because JBuilder does not adjust its own classpath once it has launched, and jar files in lib/ext are discovered only at launch time. Placing the jar in jbuilder4/lib/ext is required because the Designer is running in JBuilder's JVM, not your project's JVM, so adding the proxy jar to your project's classpath is woefully insufficient.

Now, whenever I use Designer to build something which extends WizardPanel, Designer will stealthily substitute the proxy class for the abstract class. What I'll see in the designer is whatever the proxy class builds for me.

2001-Mar-06 8:28pm gyles19@visi.com

See Also:
(Xref) I wish to create a class which extends PropertyPage, but it's a red bean in the Designer!
2001-Jul-08 10:13am gyles19@visi.com
Gillmer Derge (TeamB) writes:

I've added my RedBeans OpenTool to CodeCentral at

    http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=17595

Instructions are included with the tool, but you basically need to package your class as an OpenTool by adding an entry to the jar's manifest file and add the following method to the proxy class.

    // import com.gillmerderge.jbuilder.designer.DesignerProxyPropertyGroup
    public void initOpenTools(int majorVersion, int minorVersion) {
      if (majorVersion >= 4)
        DesignerProxyPropertyGroup.registerProxyClass(
          RFMPanel.class, RFMPanelProxie.class);
    }

At that point the rest should happen automatically when you restart JBuilder. Note that the tool includes a proxy class for PropertyPage, so the example you downloaded from Joi's FAQ-O-Matic still might not work, since it also deals with PropertyPage.

2002-Mar-03 1:48pm gyles19@visi.com

[Append to This Answer]
2002-Mar-03 1:48pm
Previous: (Answer) How does the Designer work?
Next: (Answer) I want to set an icon on a button within the Designer. How do I make the icon available in the Property Editor?
This document is: http://www.visi.com/~gyles19/cgi-bin/fom.cgi?file=97
[Search] [Appearance]
This is a Faq-O-Matic 2.709.
This FAQ administered by gyles19@visi.com.

Other JBuilder Links

Java Community
Java Tools
Code Central
JB OpenTools
Community
Recent
Threads
Borland Chat
Chat FAQ
Feature Matrices
3.0 |  3.5 |  4.0
5.0 |  6.0 |  7.0
Shop for
JBuilder
JBuilder
Downloads
and reg keys
Report Piracy
Online Manuals
4.0 |  5.0 |  6.0
7.0
Borland
DevSupport's
Bug/RFE Form

Quality Central Client
JB Patches &
Updates
JBuilder FAQs TIs
JBuilder
Newsgroups
Tamaracka's
News Archive
Mr. Haki's
JBuilder Machine
JGuru's
JBuilder FAQ
Sun's Bug
Parade
Netring Home - About - Privacy
The
JBuilder Netring Logo
The Borland JBuilder Netring by JBuilder FAQ-O-Matic
[ Join Now | List Sites | Random | << Prev | Next >> ]
[ Previous 5 Sites | Skip Previous | Skip Next | Next 5 Sites ]