Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Getting Parent's Proxy Host


Hi Janak,

My answers below are all assuming VE 1.1.0.1 at least.

The main reason we got rid of it was because it was not consistent in being set. It was not always set when it should of been and was being set when it should not of been. So we got rid of it and instituted more reliable mechanisms that don't depend on this being set correctly.



"Janak Mulani" <janak.mulani@xxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

10/11/2005 08:36 PM

Please respond to
Discussions people developing code for the Visual Editor project

To
"Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc
Subject
RE: [ve-dev] Getting  Parent's Proxy Host





Hi Rich,

I need it at several places:

1. I override BeanProxyAdapter.validateBeanProxy. -
  -  I want to call pack() on the root container of a component on the
target VM


--- This is done through the use of the ComponentManager. Take jfc.WindowProxyAdapter as an example. When it creates the ComponentManager it also creates a WindowManagerExtension at the same time. There is one of these on the IDE and a corresponding one on the remote vm. The method getExtensionClassname() returns the name of the WindowManagerExtension on the remote vm. This method will be called automatically and will create the remote vm window manager extension for you.

Now the WindowManagerExtension on the remote vm is told whenever any child component of the Window (Frame) has been invalidated, including nested children, not direct children. When that happens the invalidated() message is called on the WindowManagerExtension. The WindowManagerExtension then does a pack on the Window.

  - I am traversing the parent hierarchy to find out the image listeners
and then firing refreshImage() on each parentBean.


--- You don't need to do that. The ComponentManager does that for you. Over on the remote vm side it walks the parents and signals that the image is invalid for each parent. Now if that parent has a ComponentManager active on it it will be told that a new image is needed and the ComponentManager will then request one at the end of the transaction.

2. I had a some resize() problem for InternalFrame when it is on canvas. So
if it is directly on canvas, to be able to resize it, in the tgt vm I place
it in a panel and resize the panel. So I need to know the parent of
InternalFrame whether it is canvasas (BeanSubClassComp) or some other
container.


--- Do you mean Freeform? If so, then that is what the addToFreeForm/removeFromFreeForm call on the proxy adapter is for. It tells you that you are on the freeform. We use the addToFreeForm to let the child get the freeform parent to be placed into.

The way the freeform stuff works is this:
  1. The CompositionProxyAdapter will call addToFreeForm on the proxyAdapter when the bean is added to the freeform.
  2. ComponentProxyAdapter in addToFreeForm will ask the CompositionProxyAdapter for the freeForm host of type jfc.FreeFormComponentsHost.class. If there isn't one, then the ComponentProxyAdapter will create one. The constructor for the FreeFormComponentsHost will then register itself with the CompositionProxyAdapter so that there is only one of that type. (Note: We currently have two freeformHost types, one for AWT/Swing and one for SWT, there is no restriction on how many types there can be, so you can add your own type if you want).
  3. Then in the ComponentProxyAdapter.preInstantiateStuff(), if we have a ffHost we override visibility to be on and we override the location to be (0,0). This is so that it will show and we will later control the location inside the ffHost.
  4. In ComponentProxyAdapter.postInstantiateStuff(), if we have a ffHost we add our component to the ffhost and get back a proxy to the true host (ffProxy) on the remote vm. (We have a special dialog on the remote vm to host all AWT/Swing components since they must have a parent to be able to get an image of them). We then tell the ffProxy whether we want to use the setSize() to control the size of the component or do we want it to always be at the preferred size.

So the ffHost is the IDE controller of the freeForm dialog we use to host the components on the freeform. It controls the ffProxy, which is the real dialog on the remote vm. The real dialog has a CardLayout and each component is added to a special panel and that panel is then added to the ffProxy as another card. This special panel is used to handle the size of the component (whether preferred size or explicit size).

Then when the ComponentProxy is released it tells the ffProxy to remove the component from the ffProxy's list of children.

And finally removeFromFreeForm is called whenever the component is removed from the freeform and added to some other parent.

---
3. In PropertySourceAdapter for a component, we want to include the
containment SF  in property sheet based on the type of container it is
contained in. So I need to access the container parent.


--- We do this by letting the parent handle adding the containment feature
descriptor to it since it knows what kind to use and not the child. Take jfc.ContainerGraphicalEditPart and jfc.ContainerTreeEditPart. They have a method called setupComponent which creates a property source adapter which
merges the constraint feature in from the parent with the child's properties. It then gives that property source adapter
over to the child editpart to use instead of the child's own one. It is done this way because there is no way for the
child to know all possible combinations of properties that the parent might want to merge in, so we drive it in the other
direction, from the parent down.

In this case we have an intermediate object (the ConstraintComponent) which has the constraint and the child component. We let
its (the ConstraintComponent's) propertysource adapter handle the merge. But you can create your own property source (just a property source, not an adapter) which you give to it the child and the constainment SF and let it do the merge. You can use
ComponentConstraintPropertySourceAdapter as an example.

4. In ULCBorderLayoutPaneConstraintPropertyEditor which is similar to
corresponding class from JFC VE, in getOccupiedTags() there is a need to
access the parent container to find out which regions are occupied.


--- This would be done the same way as above.

Thanks and regards,

Janak

-----Original Message-----
From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx]On
Behalf Of Rich Kulp
Sent: Tuesday, October 11, 2005 10:55 PM
To: Discussions people developing code for the Visual Editor project
Subject: Re: [ve-dev] Getting Parent's Proxy Host



Hi,

We got rid of it because we didn't need it anymore. Why do you need it? I
could then point you to the alternatives.

Rich


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

To"ve-Dev@Eclipse. Org" <ve-dev@xxxxxxxxxxx>
cc
Subject[ve-dev] Getting  Parent's Proxy Host







Dear VE Team,

Given a component proxy, how do I get the proxy host of the parent
(container)?

Since ComponentProxyAdapter no longer has getParentComponentProxyHost() from
IComponetProxyHost, what is the alternative?

Should one go through the model object and traverse structural feature for
parent-child relation through InverseMaintenanceAdapter?

Thanks and regards,

Janak

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

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


Back to the top