Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Are factory methods supported by Visual Editor?

Hi Gili,

Thanks for your help. But as always I need some more!

Please see my questions below:

>>>>> Janak >>>
1. So this means that, when I drop a ULCLabel from the palette on the
canvas, there is no way to generate:

private ULCLabel ulcLabel = null;  // declaration for global


ULCLabel getUlcLabel() {
    if (ulcLabel == null) {
      ulcLabel = ComponentFactory.createLabel();
    }
    return ulcLabel;
}

>>>>> Gili >>>>>>>>

The ConstructorDecoderHelper will generate what ever the
javaInstance.getAllocation() is.  it is up to the commands to set the proper
ParseTree

>>>>>>>>>>>>

Janak: Could you please outline how to do this?

Do I specify a decoder in the override file for ULCLabel and then in that
decoder I set a decoderHelper that extends ConstructorDeocderHelper where I
override some  of the methods?


>>>>>>>>>>> Janak >>>>>>>>>>

2. Moreover, we have a class ULCFiller. When a filler dropped from the
palette into a container say ULCBoxPane on canvas, I would like to generate

       box.add(ULCFiller.createHorizontalStrut(150));

>>>>>>>>>>>> Gili >>>>>>>>>>>
>  ha... A different decoder is used here..  I beleive that at this time, it
will only deal with a new FooBar()...
> This is support we need to add (please open a defect)... for now you will
have to create your own decoder.

>>>>>


Janak: Again how do I go about this?

In the override file for ULCFiller, I specify a decoder and set a
decoderHelper. Then in the decode method I can handle this expression. But
what about generation and how do I suppress instance var for ULCFiller? This
is not clear. If you can point me to some code or describe steps to achieve
this it will help a lot.

>>>>>>>>>>>>> Janak >>>>>>>>>>>

3. Then there is Separator.

When I drop a separator from palette on a Menu or ToolBar on the canvas, I
would like to generate:

    menu.addSeparator();

>>>>>>>>> Gili >>>>>>>>

> This is a method invocation... which is on the queue for us to support :-(

Is it possible to generate this kind of code?


> Not in a "nice" way. ... the ugly harcoded way could be (and I am
embarrased to say this out loud :-(
> is to fluff up a addSeperator feature, and create the propert
decoder/proxy for it.

>>>>>>>>>

Janak: It will help if you can elaborate a bit.

I struggled a lot with this couple of months back but did not get anywhere.


>>> Janak >>>>>>>>

4. In general how does one:

1. Customize code gen for a bean instantiation

>>>> Gili
> The only support is via the Constructor, and the GLOBAL/LOCAL mechanism.


2. Suppress generation of instance / local var for a bean
> We are working now on implicit beans (like a ContentPane for a JFrame)....
but it will go into 1.2

>>>>>

Janak: Customization of code patterns is quite important because expert
users have their own patterns which they want generated.

Thanks and regards,

Janak



Back to the top