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,

Thanks for the help.

>As for the second question you have three ways to set the instance location
in this order:

>Set it on the annotation of the instance. This is hard to do and it is on a
per-instance basis.

>Set it on the feature that is being set. Then it uses the location from the
BeanFeatureDecorator.

In our case, when we add a label to a GridBagLayoutPane: we create two
commands:

1. set components SF of GridBagLayoutPane with value label - this is done
with a ruled command)
2. set containment SF of label with a JavaInstance of GridBagConstraints
class (our own, not awt) - this is not done in a ruled command. I am not
sure if it should be.

>Set it on the JavaClass. This will then do it for all instances of the
class. (But if the
>GridBagConstraint you are using here is the AWT one, then you can't do this
because you would >then mess up everyone who is not ULC since it is a global
setting).

GridBagConstraints is our own class. And I would like to generate a local
variable always.

So this option is feasible.

Question is how and where do I set the instance location?

Is it to be done in the  GridBagConstraint.override? How?

I tried the following but it had no effect:

<?xml version="1.0" encoding="UTF-8"?>
<event:AddMany xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.e
core" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore";
  xmlns:codeGenHelpers="platform:/plugin/org.eclipse.ve.java.core/overrides/
codegenHelpers.ecore"
    xmlns:event="event.xmi"
    featureName="eAnnotations">

  <addedEObjects xsi:type="org.eclipse.ve.internal.jcm:BeanDecorator"
beanLocation="LOCAL"/>

  <addedEObjects xsi:type="codeGenHelpers:CodeGenHelperClass"
source="codegen.CodeGenHelperClass"
     modelled="true"/>
</event:AddMany>

>Default it. In this case it will do property setting (i.e. new XYZ() right
in the set method), or make it a variable if there is at least one
sub-property setting on it.

If I understood correctly, this is what is happening in VE for Swing, isn't
it?

If I add child in bean tree then new GridBagConstraints() is generated. Then
if I set a property on GridBagConstraint a variable is generated.

For a setting some property on GridBagConstraint, RuledPropertysetCommands
are generated which then create the local var by creating ApplyAttrSettings
command to set SFs initializes,  members, and properties.

The problem with my code is even though the RuledCommands are generated they
in turn do not generate the commands to create local var. I am trying to
figure out why?

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

As an aside:

1. I looked up your container.override.

2. The "components" SF has "containment = true"

3. This seems to be playing some role in handleValue of VCEPreset command.

In our container ULCContainer.override the "components" SF has "containment
= false" -
This was done after consultation with Joe. But I have not fully understood
the significance of this.

What is the significance of "containment" being true or false?

--------

Thanks and regards,

Janak






Back to the top