BoundVariableExpression activation

Hello,

I am configuring my property adapter (binding expression) through code, and I have no issues at all with any kind of FunctionExpression except BoundVariableExpression.

It does not activate, if I have any BoundVariableExpression in my expression then I must open the binding windows of the property and click save . Then the whole expression is working properly, I didn’t even need to touch the expression at all.

I am creating and adding the properties adapter in the onStartup() method of the components.

Do you have any idea how to do this?

Thank you,

Please re-read my comment in this other thread--I believe you've misunderstood:

**************************

You are struggling because components are not intended to be making their own bindings. For built-in functionality, your components should be doing the equivalent with runtime listeners. Your component classes should have nested classes implementing the appropriate listener types and overriding the event message methods to distribute the arriving data. This is how internal bindings are constructed.

Property Adapters and related bindings are how the designer adds user-supplied functionality at configuration time.

Thank you for your reply!

I have read and checked carefully but without success, it still doesn’t bind immediately without opening the binding windows and clicking save . Here is my piece of code that run during the onStartup()

...
String path = GetComponentPath(c, n);
...
BoundVariableExpression bve1 = new BoundVariableExpression();
bve1.setType(Boolean.class);
bve1.setPath(MessageFormat.format("{0}.Highlight", path));
bve1.setPropertyListener(new PropertyListenerDescriptor(
		c, epa, "Highlight", new BasicQualifiedValue(c.getPropertyValue("Highlight"))));
c.addPropertyChangeListener(bve1.getPropertyListener());
...
...

Should I create the BoundVariableExpression differently?

When the property Highlight is changed, it should the FunctionExpression in which it is used, for example new NotExpression(bve1)

Of course it is inside a var epa = new ExpressionPropertyAdapter(); which is then added to the main setPropertyAdapter(c, "BorderState", epa);

As long as I don’t use any BoundVariableExpression in my FunctionExpression, then it works immediately without issues.

Thank you,

You should not be using FunctionExpression or BoundVariableExpression or any form of PropertyAdapter. You should be implementing PropertyChangeListener in your receiving components and attaching them to your source components. Along with any other low-level listeners you might need.

If you are using setPropertyAdapater() in your code, you are screwing up.

I will try to see how I can do it, I am using the xml generated by the FPMIWindow and the components to figure out what code to write. At the end my code generated exactly the same XML as if I was doing the changes manually via the designer, and it was working well, so I thought it was the proper way to go…

But yes with BoundVariableExpression then it stopped working as expected…

Well I am bit confused now to be honest, I have to figure things out

Thank you,