Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Parsley » DateTime Dialog(Calling a Date Picker Dialog)
DateTime Dialog [message #1713174] Mon, 02 November 2015 00:19 Go to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
I have some dateTime attributes that are displayed in a OnSelectionFormView that I wish to offer the user to set with a dialog. (I already have a standard dialog built that uses a Nebula Date Picker).

Right now I am using the DSL to generate my controls:
formControlFactory {
  control {
    .
    .
    .
    Entity : description ->{ 
	createText("",  SWT::MULTI, SWT::BORDER, SWT::WRAP, SWT::V_SCROLL,   
                        SWT::SCROLL_LINE)
	}target observeText(SWT::Modify)
    }
   .
   .
   .
 }


Can you give an example of how to add a text field for a date attribute that I can click on to invoke the dialog which could then set the attribute? (Or a textField with a button.)

thanks,
John
Re: DateTime Dialog [message #1713256 is a reply to message #1713174] Mon, 02 November 2015 19:54 Go to previous messageGo to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
I have partially met the requirement with a DateTime widget. Which gives users the ability to choose dates.
Package : expire -> {
	createDateTime(
			SWT::BORDER
	)
}target observeSelection()


So how can I add date and time controls for an attribute in a form? (Or add a dialog like I previously asked?)

thanks,
John
Re: DateTime Dialog [message #1713413 is a reply to message #1713256] Tue, 03 November 2015 21:21 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1814
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 02/11/2015 20:54, John Conlon wrote:
> I have partially met the requirement with a DateTime widget. Which
> gives users the ability to choose dates.
> Package : expire -> {
> createDateTime(
> SWT::BORDER
> )
> }target observeSelection()
>
> So how can I add date and time controls for an attribute in a form? (Or
> add a dialog like I previously asked?)
>
> thanks,
> John

Hi John

if I understand correctly, for a given feature you want to create both a
text (or a date control, which you've already managed to do) and a
button (e.g., beside that).

If that is the case, remember that in the DSL you can use Java
libraries, in particular, standard SWT API (plus, the nice syntax of
Xbase which reduces syntactic noise and provides lambdas).

Here's an example using the Library model for the Book:title:

formControlFactory {
control {
Book : title -> {
val c = new Composite(parent, SWT.NONE)
c.layout = new GridLayout(2, false)
val t = createText(c, SWT.BORDER)
val b = new Button(c, SWT.PUSH)
b.^text = "Push me"
b.addListener(SWT.MouseDown) [
MessageDialog.openInformation(c.shell, "Event", "You pushed me!")
]
return t
} target { observeText }
}
}

it puts a text and a button in a composite side by side and a listener
on the button showing the information dialog (as I said, it uses Xbase's
syntax for lambdas). Note that the databinding is setup for the text
control (not for the composite container)

Does that help?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: DateTime Dialog [message #1713544 is a reply to message #1713413] Wed, 04 November 2015 23:30 Go to previous message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Yes, I just needed a good example.

thanks Lorenzo
Previous Topic:AbstractSaveableTreeView 0.5.1
Next Topic:New versions available, Neon train & newsletter link
Goto Forum:
  


Current Time: Sat Nov 09 00:56:11 GMT 2024

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

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

Back to the top