Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Customised Swing layout manager


Hi Rashmi,

The reason there isn't an entry in LayoutManager.override is because "null" isn't really a layout manager, more it's the absence of one.  It's sort of an existential problem - is nothing the presence of something, or the absence of anything ?  Is a hole something that exists, or the absence of something that used to exist ?

The processing of "no layout manager" is hard coded in the metod ContainerGraphicalEditPart.createLayoutEditorProxy() that when it realizes there is no explicit layout manager set goes to the target VM to get the actual one and calls BeanAwtUtilities.getLayoutPolicyFactoryFromLayoutManager(IBeanProxy layoutManagerProxy, EditDomain editDomain);  The first couple of lines of this see that the layoutManagerProxy is null (a proxy object represents a handle to a real object on the target VM) and it fluffs up an instance of NullLayoutPolicyFactory.  The ContainerTreeEditPart will have similar code.

The ApplyNullLayoutConstraintCommand class is used by the NullLayoutPolicyHelper which is created by the NullLayoutProxyFactory.  

Your first step should be to create your own LayoutManager.override file in your own plugin that defines your layoutManager.   Then create your own .override file for this, e.g. "MyXYLayout.override" that defines a factory - look at something like FlowLayout.override to see how to do this.  For your factory make this a copy of the NullLayoutPolicyFactory to start with and just debug the VE to make sure that your factory is being instantiated and called.  
I presume that your layout works by having a constraint object similar to, say BorderLayout, where when an object is dropped you want to generate code like

aJPanel.add(getJButton(),new Rectangle(10,10,50,50));

The first thing you want to do on your layout policy factory is look a how something like BorderLayoutEditPolicy works, which in a way is closer to what you want than NullLayoutEditPolicy.  NullLayoutEditPolicy (and the commands is uses) have a lot of smarts to deal with the fact that the constraints on the object get set in the bounds/size/location feature(s).  What you want is something closer to BorderLayout where they are arguments of the Container.add(Component,Object) method.
You will have your own LayoutEditPolicy (that your factory creates) and you need to start by looking at the method
protected Command getCreateCommand(CreateRequest request)
The argument will contain things like the XYPosition and what you want to do is return something that generates the constraint object (which in your case is a rectangle).

Best regards,

Joe Winchester

Please respond to Discussions people developing code for the Visual Editor project <ve-dev@xxxxxxxxxxx>

Sent by:        ve-dev-bounces@xxxxxxxxxxx

To:        "Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc:        
Subject:        RE: [ve-dev] Customised Swing layout manager


Hi All,
Hi All,
 
The layout that I am trying to implement in the Visual Editor is similar to the Null Layout(X-Y Layout like ). While investigating the jfc source code for Null Layout classes and implementation I observed that there is no entry for null Layout in the Layout Manager override, even though there is a NullLayout.override file and the support classes for nulllayout. And also I observed that there is one command class ApplyNullLayoutConstraintCommand.java, Which used to make the null layout recognized by the V.E. How would I extend the null layout to implement my own Layout? What is ApplyNullLayoutConstraintCommand class represent? Can any body give me some insight in to the Null Layout Manager?
 
Help is greatly appreciated.
 
Thanks in advance,
 Rashmi Ramchandra.

 
-----Original Message-----
From:
ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx]On Behalf Of Rich Kulp
Sent:
Tuesday, August 30, 2005 6:39 PM
To:
Discussions people developing code for the Visual Editor project
Subject:
NL:Re: [ve-dev] Customised Swing layout manager


Hi,

No we don't have documentation on this, and at this time it is not API. We will eventually API this but we have so many things to do. :-(

You're best bet is to find a layout manager that is closest to what your's does, and then look at what is implemented for it.

Rich

"Rashmi H. Ramachandra" <rashmi.ramchandra@xxxxxxxxxxxxxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

08/30/2005 08:04 AM

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] Customised Swing layout manager







Hi all,

 

   I was successful in creating a override for loading my LayoutManager on the the layout property list of the containers. When I started analysing the BorderLayout.override, I came across a number of classes that do not have any API support and that are part of jfc core internal package. I have also noticed other layout related class like LayoutSwitcher, LayoutPolicyHelper, LayoutEditPolicy and ConstraintPropertyDescriptor that may need to be implemented. Do we have turorial or any documented help that would tell me how to go about writing the edit policies for a custom layout manager and the required classes for implementing a custom constrained layout?

 

-Rashmi

-----Original Message-----
From:
ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx]On Behalf Of Joe Winchester
Sent:
Friday, August 26, 2005 5:55 PM
To:
Discussions people developing code for the Visual Editor project
Subject:
NL:Re: [ve-dev] Customised Swing layout manager



Hi Rashmi,


The best way is to look at how this is done for a layout manager like, say, BorderLayout.    There is a file BorderLayout.override and this defines the decorator for a factory, and the factory lets you control things like GEF edit policies (that you will need to build).  Look at the existing factories and you should get a feel for how to do this.


To get your layout manager to appear in the drop down list of available layout managers in the property sheet look at Container.override.  You could change the base file to add your own which would work OK for you, but better would be to have your own Container.override in your own plugin and defined your own layout manager.  


If you need help understanding how to create a plugin and get started with .override try the Visual Editor tutorial on eclipse corner and the VE homepage.


Best regards and please keep us informed of how you get on,


Joe Winchester

Please respond to Discussions people developing code for the Visual Editor project <ve-dev@xxxxxxxxxxx>

Sent by:        ve-dev-bounces@xxxxxxxxxxx

To:        <ve-dev@xxxxxxxxxxx>
cc:        
Subject:        
[ve-dev] Customised Swing layout manager


Hi all,

I have implemented a swing layout manager along with the constraints class. I loaded it to the eclipse enviroment as a bundle in the plugin. Now when i use this layout in a visual class I am able to arrange the components by changing the constraints values from the source view. But i am unable to move the component on the design view(changing the constraints from the properties and design view) .Can you help me out to solve my layout poblem. Do i need to implement some a layout assistant that will interface with my layout manager and the visualeditor.

Best Regards
-Rashmi
_______________________________________________
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
_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top