Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] How to extend VE in the following situation:


There are a few options to do this with VE.

The main inhibition in your example is the "this" part.  VE can not instantiate the "this" part, as it is the class that you are working on.   The target VM works with (saved) compiled files.
If you will use a "this" in the constructor or setting, VE will give you "too complicated to evaluate".

... so you have two options.  Let me start with a high level description for now, and we can dive into detail as we go along:

1.         ivjActSend = new sample.vep.SendAction(this); // The "this" must be in the constructor for all
                                                                            //classes derived from MyGenericAction after I put action to Panel


The constructor statement is typically generated by a method template.   You can use the VE override files to specify a different method generation template that will use the proper constructor for the sample.vep.SendAction class hierarchy.  ... but you will also have to change the BeanProxyAdapter classes so that on the target VM a new sample.vep.SendAction(this)  will be invoked as new sample.vep.SendAction(); null constructor. This will enable the target VM to instantiate the SendAction bean, and still generate the proper run time code (WYSIWYG issues here)


2.   ivjActSend = new sample.vep.SendAction();
       ivjActSend.setOwner(this);  // this code must be inserted automatically
                                                  //for all classes derived from MyGenericAction after I put action to Panel


You can extend VE to generate the setOwner setting as you drop the component .... but as noted above if you use a "this" for the setting, VE will generate an error.
 

Rather than this, VE can work with static element within your "this" class; if this is an option for you can avoid the "this" problems.



------------
Dr. Gili Mendel
IBM
Software Development
RTP Raleigh, NC
(919)543 6408, tie: 441 6408



"Max" <max@xxxxxxxx>
Sent by: ve-dev-admin@xxxxxxxxxxx

07/05/2004 09:40 AM

Please respond to
ve-dev

To
<ve-dev@xxxxxxxxxxx>
cc
Subject
Re: [ve-dev] How to extend VE in the following situation:





Dear VE developers,
 
I've asked the question (see below) two times and unfortunately have no
any response. Probably this is not the right place for asking such questions?
Please, give me any feedback. Where I should ask such questions? Or give any
information source I could figure out answer from.
Sorry, if this is not the right place for such questions.
 
Thanks,
Maxim
 
----- Original Message -----
From: Max
To: ve-dev@xxxxxxxxxxx
Sent: Friday, July 02, 2004 5:31 PM
Subject: [ve-dev] How to extend VE in the following situation:

Hi,
 
I'd like to change/extend VE to generate a slightly different code in getter method
for a particular class. (SWING based)
 
1. In my application I have class:
 
class MyGenericAction extends javax.swing.AbstractAction {
    public void setOwner(Jpanel owner) {
        ....
    }
}
 
And I have different particular implementations of MyGenericAction e.g:
 
class SendAction extends MyGenericAction {
}
 
2. I create JPanel in VE and put my SendAction into the panel and set
properties Enabled and Name. VE generates the following code:
private sample.vep.SendAction getIvjActSend() {
    if (ivjActSend == null) {
       ivjActSend = new sample.vep.SendAction();
       ivjActSend.setEnabled(true);
       ivjActSend.setName("Hello");
  }
   return ivjActSend;
}
3. The issue is that I know that any MyGenericAction instance always requires
also Owner property to be specified and the user can forget to specify it explicitly.
So I need to override code generation for all classes extending MyGenericAction
in the following way:
 
1st option
private sample.vep.SendAction getIvjActSend() {
    if (ivjActSend == null) {
       ivjActSend = new sample.vep.SendAction(this); // The "this" must be in the constructor for all
                                                                            //classes derived from MyGenericAction after I put action to Panel
       ivjActSend.setEnabled(true);
       ivjActSend.setName("Hello");
  }
   return ivjActSend;
}
 
2nd option
private sample.vep.SendAction getIvjActSend() {
    if (ivjActSend == null) {
       ivjActSend = new sample.vep.SendAction();
       ivjActSend.setOwner(this);  // this code must be inserted automatically
                                                  //for all classes derived from MyGenericAction after I put action to Panel
       ivjActSend.setEnabled(true);
       ivjActSend.setName("Hello");
  }
   return ivjActSend;
}

Questions
Could you please provide some recommendations for implementig such or similar functionality?
Which extension points I need to implement to add the functionality?
 
Thanks in advance,
Maxim

Back to the top