Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Use JGoodies-Formslayout with VE
Use JGoodies-Formslayout with VE [message #64520] Mon, 04 October 2004 20:21 Go to next message
Eclipse UserFriend
Originally posted by: daniel.dniklas.de

Hi,

is it possible to use the Forms-Layoutmanager from JGoodies with VE?

This is a very powerful Layoutmanager and easy to use (see
http://www.jgoodies.com).

Thanks and best regards

Daniel Niklas
Re: Use JGoodies-Formslayout with VE [message #64546 is a reply to message #64520] Mon, 04 October 2004 21:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: myersj.nospam.gmail.com

news.eclipse.org wrote:
> Hi,
>
> is it possible to use the Forms-Layoutmanager from JGoodies with VE?
>
> This is a very powerful Layoutmanager and easy to use (see
> http://www.jgoodies.com).
>
> Thanks and best regards
>
> Daniel Niklas
>
>
>
No, the VE does not currently support using this layout. However the
layout managers supported by the VE can be contributed to via extension
points, so someone could choose to write support for this or any other
layout and contribute the addition as open source. There will be an
article at some point in the future on how to go about extending the VE
to add additional layout managers.

- Jeff
Re: Use JGoodies-Formslayout with VE [message #64926 is a reply to message #64546] Tue, 05 October 2004 18:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.dniklas.de

Hi,

are these extension-points already planned? When can i estimate this
article?
Where can i make a "feature-request"?
I think the Form-Layout from jgoodies.com is very powerful and many people
want to use something like this!

Btw the LookAndFeel from jgoodies are very nice too, and Freeware too!

Daniel
Re: Use JGoodies-Formslayout with VE [message #65090 is a reply to message #64926] Tue, 05 October 2004 20:27 Go to previous message
Eclipse UserFriend
Originally posted by: myersj.nospam.gmail.com

Daniel Niklas wrote:
> Hi,
>
> are these extension-points already planned? When can i estimate this
> article?
> Where can i make a "feature-request"?
> I think the Form-Layout from jgoodies.com is very powerful and many people
> want to use something like this!
>
> Btw the LookAndFeel from jgoodies are very nice too, and Freeware too!
>
> Daniel
>
>
A request for this feature has already been made:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=71494

The extension points necessary to add a layout to the VE are already
present. I don't have an estimate of when the article will be ready...
I need to get some time to work on it :) Briefly here are instructions
on how to add a custom layout to the VE:

---

Note: right now we only support adding layout managers with no agument
constructors. Layout managers with constructors requiring arguments,
such as BoxLayout are still handled as special cases requiring more code.

0) Create an Eclipse plug-in that requires the following plug-ins:
org.eclipse.jem.beaninfo
org.eclipse.ve.java.core
org.eclipse.ve.jfc
org.eclipse.jdt.launching

1)
Assuming you want to add a Swing/AWT layout manager, in your plugin,
create a file overrides/java/awt/LayoutManager.override (for SWT this
would be overrides/org/eclipse/swt/widgets/Layout.override)

2)
Look at the existing LayoutManager.override in the same place in the
org.eclipse.ve.jfc plugin as a guide.
Copy the top of that override's file, the xmi tag declaration into your
file:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"

xmlns:org.eclipse.ve.internal.cde.decorators="http:///org/eclipse/ve/internal/cde/decorators.ecore"
xmlns:org.eclipse.jem.java="java.xmi"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:event="event.xmi">

Now add an eAnnotation tag to your override:
<event:AddMany featureName="eAnnotations">

3)
For each layout you want to add, put in this block of xmi:
<addedEObjects xsi:type="ecore:EAnnotation"
source="org.eclipse.ve.LayoutInfo">
<details
key="org.eclipse.ve.internal.jfc.core.layoutManagerClass"
value="java.awt.BorderLayout"/>
<details
key="org.eclipse.ve.internal.jfc.core.layoutManagerDisplayName "
value="BorderLayout"/>
</addedEObjects>

Replace the "java.awt.BorderLayout" value with your own custom layout
class (fully qualified class name).
Replace the "BorderLayout" value with the display name you wish to see
in the property sheet's cell editor.

4)
Add the closing tags to the end of your file:
</event:AddMany>
</xmi:XMI>

Save your override file.

5)
Next we need to register with beaninfo to notify it that you've written
an override
Open the plugin.xml for your plugin.
Add the following extension within your plugin.xml:
<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration
container="org.eclipse.jdt.launching.JRE_CONTAINER">
<override
package="java.awt"
path="overrides/java/awt">
</override>
</registration>
</extension>

Save your plugin.xml.
Launching the VE with your plugin active should now show your custom
layout on the layout property editor for Swing/AWT. Selecting it should
drop an instance of that class with a no argument constructor.

6)
To provide visual feedback and the ability to edit the layout
graphically requires quite a lot more work.

First, create an override for your custom layout class. If your class
is called org.foo.layouts.MyCustomLayout, you'll need to create the file
overrides/org/foo/layouts/MyCustomLayout.override in your plugin.

In this file add the following xmi:
<?xml version="1.0" encoding="UTF-8"?>
<event:AddMany xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:codeGenHelpers=" platform:/plugin/org.eclipse.ve.java.core/overrides/codegenH elpers.ecore "
xmlns:event="event.xmi"
featureName="eAnnotations">
<addedEObjects xsi:type="org.eclipse.ve.internal.jcm:BeanDecorator">
<keyedValues xsi:type="ecore:EStringToStringMapEntry"
key=" org.eclipse.ve.internal.jfc.core.layoutpolicyfactoryclassnam ekey "

value=" org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.BorderLa youtPolicyFactory "/>
</addedEObjects>
<addedEObjects xsi:type="codeGenHelpers:CodeGenHelperClass"
source="codegen.CodeGenHelperClass"
modelled="true"/>
</event:AddMany>

Change the value of
" org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.BorderLa youtPolicyFactory "
to
"my.plugin/my.plugin.MyCustomLayoutPolicyFactory" (replacing with real
plugin/layout names of course)

7)
Now create the MyCustomLayoutPolicyFactory class, extending the
org.eclipse.ve.internal.java.visual.ILayoutPolicyFactory interface.

8)
Back in your plugin.xml, add an override tag pointing to your custom
layout's package.
Look for where you entered:
<override
package="java.awt"
path="overrides/java/awt">
</override>
And below that, add:
<override
package="org.foo.layouts"
path="overrides/org/foo/layouts">
</override>
(same package and path used in step 6)

9)
Now to actually implement your desired graphical behavior, you'll need
to implement the methods in MyCustomLayoutPolicyFactory. Your best bet
for getting up to speed on how to accomplish this is reading through the
existing layout edit policies included with the VE in Swing/AWT and SWT.
The class org.eclipse.ve.internal.jfc.core.FlowLayoutPolicyFactory
would be a good place to start looking.

---
Step 9 is really the tricky part. Designing good graphical feedback for
the manipulation of FormLayout is a significant task.

Good luck!

- Jeff
Re: Use JGoodies-Formslayout with VE [message #600719 is a reply to message #64520] Mon, 04 October 2004 21:10 Go to previous message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 396
Registered: July 2009
Senior Member
news.eclipse.org wrote:
> Hi,
>
> is it possible to use the Forms-Layoutmanager from JGoodies with VE?
>
> This is a very powerful Layoutmanager and easy to use (see
> http://www.jgoodies.com).
>
> Thanks and best regards
>
> Daniel Niklas
>
>
>
No, the VE does not currently support using this layout. However the
layout managers supported by the VE can be contributed to via extension
points, so someone could choose to write support for this or any other
layout and contribute the addition as open source. There will be an
article at some point in the future on how to go about extending the VE
to add additional layout managers.

- Jeff
Re: Use JGoodies-Formslayout with VE [message #600872 is a reply to message #64546] Tue, 05 October 2004 18:32 Go to previous message
Eclipse UserFriend
Originally posted by: daniel.dniklas.de

Hi,

are these extension-points already planned? When can i estimate this
article?
Where can i make a "feature-request"?
I think the Form-Layout from jgoodies.com is very powerful and many people
want to use something like this!

Btw the LookAndFeel from jgoodies are very nice too, and Freeware too!

Daniel
Re: Use JGoodies-Formslayout with VE [message #600899 is a reply to message #64926] Tue, 05 October 2004 20:27 Go to previous message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 396
Registered: July 2009
Senior Member
Daniel Niklas wrote:
> Hi,
>
> are these extension-points already planned? When can i estimate this
> article?
> Where can i make a "feature-request"?
> I think the Form-Layout from jgoodies.com is very powerful and many people
> want to use something like this!
>
> Btw the LookAndFeel from jgoodies are very nice too, and Freeware too!
>
> Daniel
>
>
A request for this feature has already been made:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=71494

The extension points necessary to add a layout to the VE are already
present. I don't have an estimate of when the article will be ready...
I need to get some time to work on it :) Briefly here are instructions
on how to add a custom layout to the VE:

---

Note: right now we only support adding layout managers with no agument
constructors. Layout managers with constructors requiring arguments,
such as BoxLayout are still handled as special cases requiring more code.

0) Create an Eclipse plug-in that requires the following plug-ins:
org.eclipse.jem.beaninfo
org.eclipse.ve.java.core
org.eclipse.ve.jfc
org.eclipse.jdt.launching

1)
Assuming you want to add a Swing/AWT layout manager, in your plugin,
create a file overrides/java/awt/LayoutManager.override (for SWT this
would be overrides/org/eclipse/swt/widgets/Layout.override)

2)
Look at the existing LayoutManager.override in the same place in the
org.eclipse.ve.jfc plugin as a guide.
Copy the top of that override's file, the xmi tag declaration into your
file:

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"

xmlns:org.eclipse.ve.internal.cde.decorators="http:///org/eclipse/ve/internal/cde/decorators.ecore"
xmlns:org.eclipse.jem.java="java.xmi"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:event="event.xmi">

Now add an eAnnotation tag to your override:
<event:AddMany featureName="eAnnotations">

3)
For each layout you want to add, put in this block of xmi:
<addedEObjects xsi:type="ecore:EAnnotation"
source="org.eclipse.ve.LayoutInfo">
<details
key="org.eclipse.ve.internal.jfc.core.layoutManagerClass"
value="java.awt.BorderLayout"/>
<details
key="org.eclipse.ve.internal.jfc.core.layoutManagerDisplayName "
value="BorderLayout"/>
</addedEObjects>

Replace the "java.awt.BorderLayout" value with your own custom layout
class (fully qualified class name).
Replace the "BorderLayout" value with the display name you wish to see
in the property sheet's cell editor.

4)
Add the closing tags to the end of your file:
</event:AddMany>
</xmi:XMI>

Save your override file.

5)
Next we need to register with beaninfo to notify it that you've written
an override
Open the plugin.xml for your plugin.
Add the following extension within your plugin.xml:
<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration
container="org.eclipse.jdt.launching.JRE_CONTAINER">
<override
package="java.awt"
path="overrides/java/awt">
</override>
</registration>
</extension>

Save your plugin.xml.
Launching the VE with your plugin active should now show your custom
layout on the layout property editor for Swing/AWT. Selecting it should
drop an instance of that class with a no argument constructor.

6)
To provide visual feedback and the ability to edit the layout
graphically requires quite a lot more work.

First, create an override for your custom layout class. If your class
is called org.foo.layouts.MyCustomLayout, you'll need to create the file
overrides/org/foo/layouts/MyCustomLayout.override in your plugin.

In this file add the following xmi:
<?xml version="1.0" encoding="UTF-8"?>
<event:AddMany xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:org.eclipse.ve.internal.jcm="http:///org/eclipse/ve/internal/jcm.ecore"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"

xmlns:codeGenHelpers=" platform:/plugin/org.eclipse.ve.java.core/overrides/codegenH elpers.ecore "
xmlns:event="event.xmi"
featureName="eAnnotations">
<addedEObjects xsi:type="org.eclipse.ve.internal.jcm:BeanDecorator">
<keyedValues xsi:type="ecore:EStringToStringMapEntry"
key=" org.eclipse.ve.internal.jfc.core.layoutpolicyfactoryclassnam ekey "

value=" org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.BorderLa youtPolicyFactory "/>
</addedEObjects>
<addedEObjects xsi:type="codeGenHelpers:CodeGenHelperClass"
source="codegen.CodeGenHelperClass"
modelled="true"/>
</event:AddMany>

Change the value of
" org.eclipse.ve.jfc/org.eclipse.ve.internal.jfc.core.BorderLa youtPolicyFactory "
to
"my.plugin/my.plugin.MyCustomLayoutPolicyFactory" (replacing with real
plugin/layout names of course)

7)
Now create the MyCustomLayoutPolicyFactory class, extending the
org.eclipse.ve.internal.java.visual.ILayoutPolicyFactory interface.

8)
Back in your plugin.xml, add an override tag pointing to your custom
layout's package.
Look for where you entered:
<override
package="java.awt"
path="overrides/java/awt">
</override>
And below that, add:
<override
package="org.foo.layouts"
path="overrides/org/foo/layouts">
</override>
(same package and path used in step 6)

9)
Now to actually implement your desired graphical behavior, you'll need
to implement the methods in MyCustomLayoutPolicyFactory. Your best bet
for getting up to speed on how to accomplish this is reading through the
existing layout edit policies included with the VE in Swing/AWT and SWT.
The class org.eclipse.ve.internal.jfc.core.FlowLayoutPolicyFactory
would be a good place to start looking.

---
Step 9 is really the tricky part. Designing good graphical feedback for
the manipulation of FormLayout is a significant task.

Good luck!

- Jeff
Previous Topic:Upgrading to Eclipse 3.01 SDK from vanilla 3.01?
Next Topic:New Look & Feel
Goto Forum:
  


Current Time: Sat Oct 19 12:25:58 GMT 2024

Powered by FUDForum. Page generated in 0.04752 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top