Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Codegen for GridBagConstraint

Hi Rich,

Unfortunately we don't use an intermediate object.

In our case, when we add ULCLabel to ULCGridBaglayoutPane (which is our own
component), we set GridBagConstraint as value of the structural feature
"containment" for ULCLabel. The "containment" SF is set for components which
are contained in a container using the "components" SF which is defined on a
container (it represents a Parent-Child relationship).

GridBagConstraints has properties like gridX, gridWidth, ... if that is what
you meant.

So I would ask this: In general, given a bean, is there a way I can directly
generate a local var and init it with a new class instance creation and make
that local var a member of the getter method of the container:

ULCGridBagLayoutPane getUlcGridBagLayoutPane() {
     ... // create ULCGridBagLayout instance and init global var

     gbc = new GridBagConstraints();

     add(getUlcLabel(), gbc);
}


Please see below too:

>>> RK >>>>
-----Original Message-----
From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx]On
Behalf Of Rich Kulp
Sent: Monday, July 11, 2005 3:54 PM
To: Discussions people developing code for the Visual Editor project
Subject: Re: [ve-dev] Codegen for GridBagConstraint



  <eStructuralFeatures xsi:type="ecore:EReference" name="constraint"
xmi:id="ConstraintComponent/constraint" eType="java:JavaClass
java:/java.lang#Object" unsettable="true">
      <eAnnotations
xsi:type="org.eclipse.ve.internal.jcm:BeanFeatureDecorator"
beanLocation="LOCAL"/>
    </eStructuralFeatures>

    <eAnnotations xsi:type="decorators:PropertySourceAdapterInformation"
      propertySourceAdapterClassname="org.eclipse.ve.jfc/org.eclipse.ve.inte
rnal.jfc.core.ConstraintComponentPropertySourceAdapter"/>
  </eClassifiers>

</ecore:EPackage>


The BeanFeatureDecorator is the addition to take notice of. It says that for
any setting of this feature, if that setting is not already located, then it
should make it LOCAL, which means a variable in the method.
>>> RK >>>

JMM:

So does this mean I add the BeadnFeatureDecorator to our "containment" SF
which is defined on all ULCComponents and is set when ULCComponent is added
to a container?

I will try this and let you know.


Thanks and regards,

Janak



"Janak Mulani" <janak.mulani@xxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx
07/11/2005 11:43 AM Please respond to
Discussions people developing code for the Visual Editor project

To"ve-Dev@Eclipse. Org" <ve-dev@xxxxxxxxxxx>
cc
Subject[ve-dev] Codegen for GridBagConstraint







Hello,

We have ULCGridBagLayoutPane container.

When we add a component, say ULCLabel, to that container, we would like to
generate:

                In the getUlcGridBagLayoutPane() method:

                   GridBagConstraints gbc1 = new GridBagConstraints();
                   add(getUlcLabel(), gbc1);

I am able to generate (like you do when a comp is added to container in Bean
Tree):

                 add(getUlcLabel(), new GridBagLayoutConstraints());

But how do I generate (like you do when a comp is added to container in
canvas):

  GridBagConstraints gbc1 = new GridBagConstraints();
  add(getUlcLabel(), gbc1);


Both GridBagConstraints and ULCGridBagLayoutPane are beans in ULC.

Do I need to specify something special in GridBagConstraints.override to be
able to generate a local variable in method?

----------------

I looked up Eclipse VE for swing.

It seems that when adding to a container with GridbagLayout, you are
generating commands to create:

   GridBagConstraints gbc1 = new GridBagConstraints();

in VCEPreset command.

It gets the GridBagConstraints object from ConstraintsComponent and somehow
creates commands that makes the container getter method (getJPanel())
initialiser  of GridBagConstraints and makes GridBagConstraints the member
of that method.

Could you please explain what is it that triggers GridBagConstraint to be
generated as local variable?

I checked overrides for GridBagLayout and GridBagConstraints but could not
find anything special.


Prompt reply will be appreciated.

Thanks and regards,

Janak

_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev



Back to the top