Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Questions about decoder

Hi Rich,

Thanks for the reply.

>>>> RK >>>

I think the big question is what are you relying on from the
settingsAdapter. The proxy adapters should get everything they need from the
model itself. If there is some info that is required, it should be added to
the model. This is so that we can bring up the proxy model separate from the
code gen. This is a performance issue so that we can start showing things
before it is completely parsed.

>>>>>>>>>>

For a ULCBoxPnae and ULCButton in it, the code looks as follows:

private ULCBoxPane getUlcBoxPane() {
		if (ulcBoxPane == null) {
			ulcBoxPane = new ULCBoxPane();
			ulcBoxPane.setPreferredSize(new
com.ulcjava.base.application.util.Dimension(110,52));
			ulcBoxPane.set(0, 0, 1, 1,
com.ulcjava.base.shared.IDefaults.BOX_LEFT_CENTER, getUlcButton());
		}
		return ulcBoxPane;
	}

BoxPane's "components" SF has Button. And Button's "containment" SF has a
Java object BoxPaneContainment on which are set attributes
like row, col, hspan, vspan and alignment (0, 0, 1, 1,
com.ulcjava.base.shared.IDefaults.BOX_LEFT_CENTER).

When we add button to boxpane:

1. We create an ExpressionDecoderAdapter call it expAdapter

2. On BoxPane's BeanDecoderAdpater (JVE_CODEGEN_BEAN_PART_ADAPTER) we do
addSettingAdapter("components",   expAdapter).

3. On Button's BeanDecoderAdapter, we do addSettingAdapter("containment",
expAdapter).

4. Also set the same expAdapter on the BoxPaneContainemt object. This is so
because if any of the attrs of BoxPaneContainment changes in the code or in
property sheet, we want to modify the above expression. And this we do in
the applySetting method when we are applying the BoxPaneContainment object
to "conatinment" SF of Button.

In VE 1.1: The following call, whic is trying to get the BeanDecoderAdapter
for the button is returning null.

BeanDecoderAdapter b = (BeanDecoderAdapter)
EcoreUtil.getExistingAdapter(child,
ICodeGenAdapter.JVE_CODEGEN_BEAN_PART_ADAPTER);

>>>> RK >>>>
PS: By the way, did you have any success getting the images of your
ULCButton on the first start of an editor?
>>>>

No. Not yet. It is behaving randomly. Sometime I see, most times I don't. I
did try the ComponentMangerExtension but to no effect.
But what I don't understand is why when the drop works, the open of Visual
class doesn't work. If drop is showing the button, then open should also
show because the code executed during initProxy is the same.

Rich could you please ask someone in CodeGen to answer the following: What
code should be wriiten in restore() method?

>>> Gili >>>
What is the significance of restore() method of IExpressionDecoderHelper?
What should this method do?
> See AbstractExpressionDecoder.decode(),  If there is no cache, a regular
decode will be driven.
> This implies that the decoder will create/update EMF model elements, as
well as all the BDM meta information.
> If a cache exists, this implies that the EMF model is already online;
decoders will not change it.
> In this case a restore() is called.  A decoder is responsible to *restore*
its meta information
> to the existing model (e.g., use the IJavaObject already in the model,
attache adapters etc.)

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

So the restore() is not supposed to touch the EMF model.

Then for a parent child relation, e.g. panel.add(getULCButton()), should the
restore() method do the following:

                                 // get the child bean part from the
arguments in the above expression
                                 fChildBeanPart =
decodeArguments((MethodInvocation)getExpression(decodingContent), false);

                                 if (fChildBeanPart == null) {
                                                  throw new
CodeGenException("No Child Bean Part");
                                 }

                                 fChildBeanPart.addBackRef(fbeanPart,
(EReference)fFmapper.getFeature(null));
                                 fbeanPart.addChild(fChildBeanPart);
                                 if(!getExpressionReferences().contains(fChi
ldBeanPart.getEObject()))
                                       getExpressionReferences().add(fChildB
eanPart.getEObject());

                                 return true;

This is what you do in the AbstractContainerAddDecoderHelper.restore()?

Thanks and regards,

Janak


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



Back to the top