Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] Need cron-like use-case help
[Databinding] Need cron-like use-case help [message #333025] Thu, 20 November 2008 09:56 Go to next message
Matthias Treitler is currently offline Matthias TreitlerFriend
Messages: 117
Registered: July 2009
Senior Member
Hello Eclipse developers!

Currently I am introducing Databinding in my project (to be concrete EMF
Databinding) and I have the following use-case, where it don't know if I
am on the right way...

Let me explain:
Use-case:
I have an editor where I can edit a Cron expression.

Model:
My model that stores a Cron expression has for every cron part (seconds,
minutes, hours, ... ) a String attribute.

UI:
For instance the month part of the cron expression has 12 SWT
Push-Buttons, labeled from "1" to "12". So when the user clicks the button
"2" then the databinder should add the value "2" to the month attribute of
my model instance. The same applies to every button. When the user
deselects a button than the value should be removed from the string.

To achieve this use case with databinding I would have to bind each of the
12 buttons to my "month" attribute string of my model. Then I would have
to somehow convert the values from a boolean (if the button has been
selected or not) to a string... with a IConverter... can you give me any
hints, if I am on the right way?!

Thank you very much,
Matthias
Re: [Databinding] Need cron-like use-case help [message #333059 is a reply to message #333025] Mon, 24 November 2008 01:06 Go to previous message
Boris Bokowski is currently offline Boris BokowskiFriend
Messages: 272
Registered: July 2009
Senior Member
You need a helper object that maps booleans to seconds/minutes/hours. For
an example, have a look at
org.eclipse.jface.examples.databinding.model.PriceModelObjec t in
org.eclipse.jface.tests.databinding, it does the same kind of thing for
"price" and "dollars"/"cents".

Boris

"Matthias Treitler" <matthias.treitler@gmail.com> wrote in message
news:8e0b988292988a193d8e13e47af8572c$1@www.eclipse.org...
> Hello Eclipse developers!
> Currently I am introducing Databinding in my project (to be concrete EMF
> Databinding) and I have the following use-case, where it don't know if I
> am on the right way...
>
> Let me explain:
> Use-case:
> I have an editor where I can edit a Cron expression.
> Model:
> My model that stores a Cron expression has for every cron part (seconds,
> minutes, hours, ... ) a String attribute.
>
> UI:
> For instance the month part of the cron expression has 12 SWT
> Push-Buttons, labeled from "1" to "12". So when the user clicks the button
> "2" then the databinder should add the value "2" to the month attribute of
> my model instance. The same applies to every button. When the user
> deselects a button than the value should be removed from the string.
>
> To achieve this use case with databinding I would have to bind each of the
> 12 buttons to my "month" attribute string of my model. Then I would have
> to somehow convert the values from a boolean (if the button has been
> selected or not) to a string... with a IConverter... can you give me any
> hints, if I am on the right way?!
> Thank you very much,
> Matthias
>
Previous Topic:Can a view be fast and sticky at the same time?
Next Topic:Databinding Access Restriction
Goto Forum:
  


Current Time: Fri Jul 05 03:22:12 GMT 2024

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

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

Back to the top