GMF on RAP [message #658096] |
Sun, 06 March 2011 11:27 |
Sudesh Bulathsinhala Messages: 193 Registered: October 2010 |
Senior Member |
|
|
Hello,
We're developing RAP product which gives flexibility for the end-users to extend / create new forms(editors) at RUN-TIME, using designers.
All the editors are created at DESIGN-TIME using the following code snippet.
@Override
public void createPartControl(final Composite parent) {
parent.setBackgroundMode(SWT.INHERIT_DEFAULT);
final FormLayout layout = new FormLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.marginLeft = 5;
layout.marginRight = 5;
layout.marginTop = 5;
layout.marginBottom = 5;
parent.setLayout(layout);
CustomDecoratorPropertyProvider.getInstance()
.setCompositeBackgroundGradient(parent);
try {
PlatformUI
.getWorkbench()
.getProgressService()
.runInUI(PlatformUI.getWorkbench().getProgressService(),
new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) {
monitor.beginTask(
"Opening Editor in progress, please wait..",
IProgressMonitor.UNKNOWN);
DatasetCompositeFactory
.getInstance()
.initComposite(
parent,
_userInterfaceRender
.getCompositePanelModel(),
_datasetControllerArray);
monitor.done();
}
}, null);
} catch (final InvocationTargetException e) {
e.printStackTrace();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
As you can see from the above snippet, the createPartControl method does not implement the actual SWT logic, but rather a factory method called DatasetCompositeFactory.getInstance().initComposite(parent, _userInterfaceRender.getCompositePanelModel(), _datasetControllerArray). This method indeed delegates it's corresponding Java object (_userInterfaceRender.getCompositePanelModel - POJO) at runtime to the factory and hence will render the necessary SWT code from the factory methods at RUN-TIME.
The concept works 100% and the _userInferfaceRender object can be manipulated at RUN-TIME and hence the UI of the corresponding editor gets updated accordingly when loaded.
My question is, what would be the ideal MODELING TOOL to integrate with this, instead of using POJO's ?
Ex. GMF/EMF ?
My requirement is at RUN-TIME load the designer for a specific editor, and hence that loading instance's corresponding EditorInput will provide the dataset's, data-widgets and their relations that gets exposed to the designer. (ex. What components are visible from the underling table and their relations). I would prefer to use the palette to drag 'n drop objects to the designer. (currently i've implemented a custom palette designer which is part of the designer editor, but not using standard eclipse pallet API, i.e we're using palette like containers with labels and images representing widgets and other controls that can be dragged to the designer editor - tree viewer). I would prefer to standardize this approach using eclipse modeling framework and using pallets.
How should we approach this ?
Thanks in advance.
Regards,
sudesh
[Updated on: Sun, 06 March 2011 11:44] Report message to a moderator
|
|
|
Re: GMF on RAP [message #658468 is a reply to message #658096] |
Tue, 08 March 2011 15:13 |
Ed Merks Messages: 33139 Registered: July 2009 |
Senior Member |
|
|
Sudesh,
Commet
Sudesh Bulathsinhala wrote:
> Hello,
>
> We're developing RAP product which gives flexibility for the end-users
> to extend / create new forms(editors) at RUN-TIME, using designers.
>
> All the editors are created at DESIGN-TIME using the following code
> snippet.
>
>
> @Override
> public void createPartControl(final Composite parent) {
> parent.setBackgroundMode(SWT.INHERIT_DEFAULT);
> final FormLayout layout = new FormLayout();
> layout.marginWidth = 0;
> layout.marginHeight = 0;
> layout.marginLeft = 5;
> layout.marginRight = 5;
> layout.marginTop = 5;
> layout.marginBottom = 5;
> parent.setLayout(layout);
> CustomDecoratorPropertyProvider.getInstance()
> .setCompositeBackgroundGradient(parent);
> try {
> PlatformUI
> .getWorkbench()
> .getProgressService()
>
> .runInUI(PlatformUI.getWorkbench().getProgressService(),
> new IRunnableWithProgress() {
> @Override
> public void run(final IProgressMonitor
> monitor) {
> monitor.beginTask(
> "Opening Editor in
> progress, please wait..",
> IProgressMonitor.UNKNOWN);
>
> DatasetCompositeFactory
> .getInstance()
> .initComposite(
> parent,
> _userInterfaceRender
>
> .getCompositePanelModel(),
>
> _datasetControllerArray);
>
> monitor.done();
> }
> }, null);
> } catch (final InvocationTargetException e) {
> e.printStackTrace();
> } catch (final InterruptedException e) {
> e.printStackTrace();
> }
> }
>
> As you can see from the above snippet, the createPartControl method
> does not implement the actual SWT logic, but rather a factory method
> called DatasetCompositeFactory.getInstance().initComposite(parent,
> _userInterfaceRender.getCompositePanelModel(),
> _datasetControllerArray). This method indeed delegates it's
> corresponding Java object (_userInterfaceRender.getCompositePanelModel
> - POJO) at runtime which was designed using designer to the method and
> hence the factory will render the necessary SWT code from the factory
> methods at RUN-TIME.
>
> The concept works 100% and hence the _userInferfaceRender object can
> be manipulated at RUN-TIME and hence the UI of the corresponding
> editor gets updated accordingly when loaded.
>
> My question is, what would be the ideal MODELING TOOL to integrate
> with this, instead of using POJO's ? Ex. GMF/EMF ?
EMF provides support for RAP. You can even generate a RAP editor
starting with only a model. GMF depends on GEF and that doesn't yet
support RAP...
>
> My requirement is at RUN-TIME load the designer for a specific editor,
> and hence that loading instance's corresponding EditorInput will
> provide the dataset's, data-widgets and their relations that gets
> exposed to the designer. (ex. What components are visible from the
> underling table and their relations). I would prefer to use the
> palette to drag 'n drop objects to the designer. (currently i've
> implemented a custom palette designer which is part of the designer
> editor, but not using eclipse pallet, ie palette like containers with
> labels with images representing widgets and tables that can be dragged
> to the designer editor's tree viewer). I would prefer to standardize
> this approach using eclipse modeling framework and using pallets.
>
> How should we approach this ?
I think there were previous discussions about porting draw2d to RAP
(something GEF needs), but I'm not sure anyone has done that...
> Thanks in advance.
>
> Regards,
> sudesh
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: GMF on RAP [message #658548 is a reply to message #658468] |
Tue, 08 March 2011 21:33 |
|
Hi,
> I think there were previous discussions about porting draw2d to RAP
> (something GEF needs), but I'm not sure anyone has done that...
Austin Riddle created an experimental port in the RAP Incubator, but
that's not yet productive. We have some ideas for improvements, chances
are that this port will evolve over time, but currently there is no
working Draw2D or GEF for RAP - sorry.
Regards, Ralf
--
Ralf Sternberg
Twitter: @ralfstx
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04420 seconds