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,


>>> RK >>
Yes, the "constraint" must not be containment="true". As I mentioned in my
just sent previous note IJavaInstances must always be containment="false"
while non-IJavaInstances (such as our intermediate object) must be
containment="true".

As for your constraint feature, you said it could be a String or
GridBagConstraint. It should be a IJavaInstance kind of String, not just a
plain string because you can't mix non-IJavaInstances and IJavaInstances on
the same feature.

I would also just set the constraint before setting the label into the
container and only use the ruled on the label being set into container.
Saves a little time so that the preset doesn't walk the same stuff twice.

>>>

I am doing what you suggested:

1. On ULCComponent override, for "containment" SF (you refered to it as
constraint above), set "containment=false".

2.  Create JavaObjectInsance for GriBagConstraints and set a feature gridX
to -1

  Command1: ApplyAttribute: Set "containment" SF on ULCLabel with the above
created
GridBagconstraints object
  Command2: Ruled command: set "components" SF on ULCGridBagLayoutPane with
ULCLabel.

Now while executing the VCEPreset command (command 2 above). It walks
starting with ULCGridBagContainer, ULCLabel, and GridBagConstrints.

It treats GridbagConstraint like a Property and tries to create a local var.
But while doing so it throws an exception (see log file in attachment). The
methodRef for the MemberDecoderAdapter is null.

I feel the problem is that it tries to create the init for GBConstraints in
ULCLabel's init method (getUlcLabel method) because parent of GBConstraint
is ULCLabel.

But is not what I want. I want the local var in the init method of
GridBagLayoutPane as shown below. How do I achieve this?

 ULCGridBagLayoutPane getUlcGBLP() {

	if (gblp == null) {
          gblp = new ULCGridBagLayoutPane();
          gbc = new GBConstraints();
          gbc.setGridX(-1);

          gblp.add(getUlcLabel(), gbc);
	}
      return gblp;
 }

---------
IN Swing:

It creates ConstComp (CC)  GBConstraints set to "constraint" SF.

Then it creates two commands:

  Command1: ApplyAttribute: Set "component" SF on CC with JLabel.

  Command2: Ruled command: set "components" SF on JPanel (with GBLayout)
with CC.

VCEPreset walks CC and then JLabel and GBConstraints and creates the local
var for GBConstraints in getJPanel method.

The parent for GBConstraint is CC.

------

Thanks and regards,

Janak

Attachment: .log
Description: Binary data


Back to the top