Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] separator

Hi Gili, Rich,

Kindly follow through the conversation below to get the full context:

1. Suppressing generation of var and instanciation stmt for a bean:

>>> GM >>>
Off hand, my first approach would be to treat this (in codegen) as a special
property that is set on the toolbar.  CodeGen will treat is as a "special"
property settings on the tool bar, but the decoder helper that is associated
with this new feature will create a Separator instance with the proper
allocation tree.

>>>>>

I created a feature "separator" on ULCMenu which takes  ULCSeparator as
value:

<event:Add  featureName="eStructuralFeatures">
  <addedEObjects xsi:type="ecore:EReference" name="separator"
    eType="ecore:EClass  java:/com.ulcjava.base.application#ULCSeparator"
    upperBound="-1" changeable="true" unsettable="false"
    containment="false">
   <eAnnotations
xsi:type="org.eclipse.ve.internal.cde.decorators:PropertyDescriptorDecorator
"  hidden="true"/>
    <eAnnotations
xsi:type="org.eclipse.ve.internal.jcm:BeanFeatureDecorator" linkType="CHILD"
beanLocation="LOCAL"/>
  </addedEObjects>


ULCSeparator has property called orientation.

In codegen, for ULCMenu, I generate addSepartor() when a ULCSeparator is
added to it and the SF=separator.

The code looks as follows:

      private ULCMenu ulcMenu = null;

      private ULCMenu getUlcMenu() {
              if (ulcMenu == null) {
                 ulcMenu = new ULCMenu();
                  ULCSeparator ulcMenuSeparator = new ULCSeparator();
                  ulcMenu.addSeparator();
              }
              return ulcMenu;
}

The question is:

How do I suppress the generation of: ULCSeparator ulcMenuSeparator = new
ULCSeparator();?

>>>> GM >>>>

If the PreSet commands places the instance of the separator as a *member*
(BeanSubClass, or Method), VE will generate an instance (global/local).  The
feature that you have created should not override the default, which is to
place an instance as a *property*.

>>>>

Could you please explain the last statement. What is meant by " should not
override default"?

See the above spec in overrride file for reference.

>>>> GM >>>

My assumption here is that the separators will not have any property set on
it.
In general, will be great if the instance of the separator from the
addSeparator() have not properties... so it is not promotable.

>>>>>

As I said, ULCSeparator has a property called "orientation".

Just for the sake of trying should I suppress/hide this property in
ULCSeparator override or in the ULCSeparatorBeanInfo? Will this work?

One crude trick I tried was to define a decoder for ULCSeparator which has a
helper that extends ConstructorDecoder. In the generate method I return an
empty stmt ";" instead of
 "ulcSeparator = new ULCSeparator();"  This worked albeit it through some
exceptions!

In general: Is there way to have BeanFactory NOT genearte any code?

Thanks and regards,

Janak



Back to the top