Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT_AWT in commercial projects?
| |
Re: SWT_AWT in commercial projects? [message #448536 is a reply to message #448527] |
Tue, 11 January 2005 18:31 |
Ravi Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Thanks Philip for the response.
Here's an example: I have a Swing component in my main View. When the user
types in data in a text field or selects an item in the como box of the
Swing component, i would like to update 1 or more views (like property
sheets etc.) containing SWT controls with the same data. This update has
to be done in the SWT UI thread. It is easier to imagine the data going in
the other direction too, in this case we have to update the swing
components in the Swing thread.
This will be a common pattern whenever we need to keep swing and SWT
controls in Sync. I was wondering if it makes sense for SWT to have some
helper classes to update swing components transparently and vice-versa
(i.e. deal with the UI thread issues)
thanks,
-Ravi
Philip Borlin wrote:
> 1. We are experimenting with SWT_AWT right now in our app right now. We
> are writing credit union software so this is definately a large scope
> complex rich client. I am currently having a focus problem, but I will
> try to keep you up to date on what is happening.
> 2.3. These are pretty broad questions. Can you give me a specific
> scenario we can work through?
> -Phil
> Ravi wrote:
>> Hi,
>> I have a few questions on mixing SWT and Swing controls:
>> 1. Are there commercial products (or projects) which use Swing and SWT
>> together, using the SWT_AWT bridge ?
>> 2. Is there any recommendation for synchronizing data between SWT and
>> Swing controls (components), since they run in different threads?
>> 3. Shouldn't we (eclipse) come up with a framework which allows easy
>> mixing of Swing and SWT components, so that the framework handles in a
>> transparent way the threading issues involved (i.e. updating SWT controls
>> in SWT thread and Swing components in Swing thread). If we don't do this,
>> then every user will have to build his/her own synchronization framework
>> leading to bugs and high maintanence costs.
>> thanks,
>> -Ravi
|
|
|
Re: SWT_AWT in commercial projects? [message #448606 is a reply to message #448536] |
Tue, 11 January 2005 21:27 |
Jim Adams Messages: 160 Registered: July 2009 |
Senior Member |
|
|
I would do this with listeners if you need to keep the Swing and SWT stuff
separate. Have things that need to be kept in sync set themselves as
listeners to some central repository. Then the Swing stuff can fire changes
into that repository.
"Ravi" <rshankark@hotmail.com> wrote in message
news:cs161t$37e$1@www.eclipse.org...
> Thanks Philip for the response.
>
> Here's an example: I have a Swing component in my main View. When the user
> types in data in a text field or selects an item in the como box of the
> Swing component, i would like to update 1 or more views (like property
> sheets etc.) containing SWT controls with the same data. This update has
> to be done in the SWT UI thread. It is easier to imagine the data going in
> the other direction too, in this case we have to update the swing
> components in the Swing thread.
>
> This will be a common pattern whenever we need to keep swing and SWT
> controls in Sync. I was wondering if it makes sense for SWT to have some
> helper classes to update swing components transparently and vice-versa
> (i.e. deal with the UI thread issues)
>
> thanks,
> -Ravi
>
> Philip Borlin wrote:
>
> > 1. We are experimenting with SWT_AWT right now in our app right now. We
> > are writing credit union software so this is definately a large scope
> > complex rich client. I am currently having a focus problem, but I will
> > try to keep you up to date on what is happening.
>
> > 2.3. These are pretty broad questions. Can you give me a specific
> > scenario we can work through?
>
> > -Phil
>
>
> > Ravi wrote:
>
> >> Hi,
>
> >> I have a few questions on mixing SWT and Swing controls:
> >> 1. Are there commercial products (or projects) which use Swing and SWT
> >> together, using the SWT_AWT bridge ?
> >> 2. Is there any recommendation for synchronizing data between SWT and
> >> Swing controls (components), since they run in different threads?
> >> 3. Shouldn't we (eclipse) come up with a framework which allows easy
> >> mixing of Swing and SWT components, so that the framework handles in a
> >> transparent way the threading issues involved (i.e. updating SWT
controls
> >> in SWT thread and Swing components in Swing thread). If we don't do
this,
> >> then every user will have to build his/her own synchronization
framework
> >> leading to bugs and high maintanence costs.
>
> >> thanks,
> >> -Ravi
>
>
|
|
|
Re: SWT_AWT in commercial projects? [message #448630 is a reply to message #448536] |
Wed, 12 January 2005 15:44 |
Philip Borlin Messages: 17 Registered: July 2009 |
Junior Member |
|
|
I work on an open source business framework called core
(core-framework.dev.java.net) and in that framework we have business
objects that hold all of our logic/data which we bind to custom UI
components (by installing listeners in the background). Sounds exactly
like what you want to do. In our framework the business objects fire an
event everytime a setter is called and whomever is interested in those
events listens. Our UI components are one of the things we register to
listen to those events.
These events are general framework events and can come in from any thread
so we need to do something in order to get it on the UI event thread.
What we do is wrap all logic in our UI component listener within an
EventQueue.invokeLater() (We are mainly Swing right now). In your case
you would just have two components listen to your business object, one the
Swing component and one the SWT component. The Swing component would wrap
the logic in an EventQueue.invokeLater() and the SWT component would wrap
the logic in its version (my SWT is pretty weak).
-Phil
Ravi wrote:
> Thanks Philip for the response.
> Here's an example: I have a Swing component in my main View. When the user
> types in data in a text field or selects an item in the como box of the
> Swing component, i would like to update 1 or more views (like property
> sheets etc.) containing SWT controls with the same data. This update has
> to be done in the SWT UI thread. It is easier to imagine the data going in
> the other direction too, in this case we have to update the swing
> components in the Swing thread.
> This will be a common pattern whenever we need to keep swing and SWT
> controls in Sync. I was wondering if it makes sense for SWT to have some
> helper classes to update swing components transparently and vice-versa
> (i.e. deal with the UI thread issues)
> thanks,
> -Ravi
> Philip Borlin wrote:
>> 1. We are experimenting with SWT_AWT right now in our app right now. We
>> are writing credit union software so this is definately a large scope
>> complex rich client. I am currently having a focus problem, but I will
>> try to keep you up to date on what is happening.
>> 2.3. These are pretty broad questions. Can you give me a specific
>> scenario we can work through?
>> -Phil
>> Ravi wrote:
>>> Hi,
>>> I have a few questions on mixing SWT and Swing controls:
>>> 1. Are there commercial products (or projects) which use Swing and SWT
>>> together, using the SWT_AWT bridge ?
>>> 2. Is there any recommendation for synchronizing data between SWT and
>>> Swing controls (components), since they run in different threads?
>>> 3. Shouldn't we (eclipse) come up with a framework which allows easy
>>> mixing of Swing and SWT components, so that the framework handles in a
>>> transparent way the threading issues involved (i.e. updating SWT controls
>>> in SWT thread and Swing components in Swing thread). If we don't do this,
>>> then every user will have to build his/her own synchronization framework
>>> leading to bugs and high maintanence costs.
>>> thanks,
>>> -Ravi
|
|
|
Re: SWT_AWT in commercial projects? [message #448648 is a reply to message #448630] |
Wed, 12 January 2005 19:44 |
Ravi Messages: 19 Registered: July 2009 |
Junior Member |
|
|
Thanks. We have built a framework similar to what you have described. The
listener code will get executed in the appropriate UI thread. However we
need to be careful about 2 things: 1. Not to use a lot of aSyncExec
Runnables since they have the lowest priority compared to other UI events.
If there are many such runnables this may lead to unresponsive UI.(
although our tests have indicated that it's not so bad) 2. The data may
have changed before the runnables are executed. So, we may have to
synchronize the model and ensure that listeners are executed before
allowing to change the model data.
Looking at this link:
http://www.eclipse.org/org/councils/20041215EclipseTPFinalDr aft.pdf
There seems to be some work going on to allow Swing applications to
seemlessly work within SWT. I wonder about the specifics of this topic.
-Ravi
Philip Borlin wrote:
> I work on an open source business framework called core
> (core-framework.dev.java.net) and in that framework we have business
> objects that hold all of our logic/data which we bind to custom UI
> components (by installing listeners in the background). Sounds exactly
> like what you want to do. In our framework the business objects fire an
> event everytime a setter is called and whomever is interested in those
> events listens. Our UI components are one of the things we register to
> listen to those events.
> These events are general framework events and can come in from any thread
> so we need to do something in order to get it on the UI event thread.
> What we do is wrap all logic in our UI component listener within an
> EventQueue.invokeLater() (We are mainly Swing right now). In your case
> you would just have two components listen to your business object, one the
> Swing component and one the SWT component. The Swing component would wrap
> the logic in an EventQueue.invokeLater() and the SWT component would wrap
> the logic in its version (my SWT is pretty weak).
> -Phil
> Ravi wrote:
>> Thanks Philip for the response.
>> Here's an example: I have a Swing component in my main View. When the user
>> types in data in a text field or selects an item in the como box of the
>> Swing component, i would like to update 1 or more views (like property
>> sheets etc.) containing SWT controls with the same data. This update has
>> to be done in the SWT UI thread. It is easier to imagine the data going in
>> the other direction too, in this case we have to update the swing
>> components in the Swing thread.
>> This will be a common pattern whenever we need to keep swing and SWT
>> controls in Sync. I was wondering if it makes sense for SWT to have some
>> helper classes to update swing components transparently and vice-versa
>> (i.e. deal with the UI thread issues)
>> thanks,
>> -Ravi
>> Philip Borlin wrote:
>>> 1. We are experimenting with SWT_AWT right now in our app right now. We
>>> are writing credit union software so this is definately a large scope
>>> complex rich client. I am currently having a focus problem, but I will
>>> try to keep you up to date on what is happening.
>>> 2.3. These are pretty broad questions. Can you give me a specific
>>> scenario we can work through?
>>> -Phil
>>> Ravi wrote:
>>>> Hi,
>>>> I have a few questions on mixing SWT and Swing controls:
>>>> 1. Are there commercial products (or projects) which use Swing and SWT
>>>> together, using the SWT_AWT bridge ?
>>>> 2. Is there any recommendation for synchronizing data between SWT and
>>>> Swing controls (components), since they run in different threads?
>>>> 3. Shouldn't we (eclipse) come up with a framework which allows easy
>>>> mixing of Swing and SWT components, so that the framework handles in a
>>>> transparent way the threading issues involved (i.e. updating SWT controls
>>>> in SWT thread and Swing components in Swing thread). If we don't do this,
>>>> then every user will have to build his/her own synchronization framework
>>>> leading to bugs and high maintanence costs.
>>>> thanks,
>>>> -Ravi
|
|
| | | |
Goto Forum:
Current Time: Wed Sep 25 22:51:04 GMT 2024
Powered by FUDForum. Page generated in 0.03925 seconds
|