I am using persistence in a Wizard, and I am editing a specific entity
"Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
both are executed at the end of the main wizard. How can I bind a function
to the end of a chosen screen?
On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com> wrote:
> Hello,
> I am using persistence in a Wizard, and I am editing a specific entity
> "Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
> call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
> both are executed at the end of the main wizard. How can I bind a function
> to the end of a chosen screen?
Yes, there is. But from my observations, I believe it is not called before
the end of the wizard, is it? What if I want to save something in the
database between Screen1 and Screen2?
Thanks for your help,
Jones
On Thu, Oct 25, 2012 at 5:56 PM, David Pollak <feeder.of.the.be...@gmail.com
> wrote:
> THere's a finish() method on each screen as well.
> On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com> wrote:
>> Hello,
>> I am using persistence in a Wizard, and I am editing a specific entity
>> "Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
>> call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
>> both are executed at the end of the main wizard. How can I bind a function
>> to the end of a chosen screen?
> object complete extends WizardVar(false)
> val prodScreen = new Screen {
> object prod extends WizardVar(Product.find(1) openOr Product.create)
> addFields(() => prod.name)
> val customers = Customer.findAll.map(_.name.is) // TODO: more
> intelligent autocomplete...
> val customer_field = new Field {
> type ValueType = String
> override def name = "Customer"
> override implicit def manifest = buildIt[String]
> override def default = ""
> override def toForm: Box[NodeSeq] = AutoComplete("",
> (current:String, limit:Int) =>
> customers.filter(_.toLowerCase.startsWith(current.toLowerCase)), x =>
> println("done" + x))
> }
> override def nextScreen = {
> Customer.find(By(Customer.name, "test")) match {
> case Empty => println("empty")
> case Full(_) => println("full")
> }
> customerScreen
> }
> override def finish() {
> }
> }
The idea here is that before going to the next screen ("customerScreen"),
I would like to check if what the user has entered in the form is already
existing in the database or not. If it is not, then the user needs to enter
it and therefore the screen "customerScreen" will be required. But if it
already exists in the database, I don't want to go to this screen.
How can I achieve this? I cannot find a function that is executed after the
user has clicked on next but before the next screen...
Sorry for the inconvenience and thanks for your help!
Jones
On Thu, Oct 25, 2012 at 6:45 PM, Jones <mistic.warr...@gmail.com> wrote:
> Yes, there is. But from my observations, I believe it is not called before
> the end of the wizard, is it? What if I want to save something in the
> database between Screen1 and Screen2?
> Thanks for your help,
> Jones
> On Thu, Oct 25, 2012 at 5:56 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>> THere's a finish() method on each screen as well.
>> On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com> wrote:
>>> Hello,
>>> I am using persistence in a Wizard, and I am editing a specific entity
>>> "Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
>>> call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
>>> both are executed at the end of the main wizard. How can I bind a function
>>> to the end of a chosen screen?
But in my example my customer_field customized field cannot be accessed
with customer_field.is. Probably because of the autocomplete widget? Does
anybody know how I could deal with this?
Thanks for your help!
Jones
PS: moreover, even if I set "override def editable_? = false", my fields
always are editable...
On Sat, Oct 27, 2012 at 2:50 PM, Jones <mistic.warr...@gmail.com> wrote:
> Hello,
> sorry to come back on this, but I still cannot find a solution. Here is my
> code:
> object addEntryWizard extends Wizard {
>> object complete extends WizardVar(false)
>> val prodScreen = new Screen {
>> object prod extends WizardVar(Product.find(1) openOr Product.create)
>> addFields(() => prod.name)
>> val customers = Customer.findAll.map(_.name.is) // TODO: more
>> intelligent autocomplete...
>> val customer_field = new Field {
>> type ValueType = String
>> override def name = "Customer"
>> override implicit def manifest = buildIt[String]
>> override def default = ""
>> override def toForm: Box[NodeSeq] = AutoComplete("",
>> (current:String, limit:Int) =>
>> customers.filter(_.toLowerCase.startsWith(current.toLowerCase)), x =>
>> println("done" + x))
>> }
>> override def nextScreen = {
>> Customer.find(By(Customer.name, "test")) match {
>> case Empty => println("empty")
>> case Full(_) => println("full")
>> }
>> customerScreen
>> }
>> override def finish() {
>> }
>> }
> The idea here is that before going to the next screen ("customerScreen"),
> I would like to check if what the user has entered in the form is already
> existing in the database or not. If it is not, then the user needs to enter
> it and therefore the screen "customerScreen" will be required. But if it
> already exists in the database, I don't want to go to this screen.
> How can I achieve this? I cannot find a function that is executed after
> the user has clicked on next but before the next screen...
> Sorry for the inconvenience and thanks for your help!
> Jones
> On Thu, Oct 25, 2012 at 6:45 PM, Jones <mistic.warr...@gmail.com> wrote:
>> Yes, there is. But from my observations, I believe it is not called
>> before the end of the wizard, is it? What if I want to save something in
>> the database between Screen1 and Screen2?
>> Thanks for your help,
>> Jones
>> On Thu, Oct 25, 2012 at 5:56 PM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>> THere's a finish() method on each screen as well.
>>> On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com> wrote:
>>>> Hello,
>>>> I am using persistence in a Wizard, and I am editing a specific entity
>>>> "Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
>>>> call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
>>>> both are executed at the end of the main wizard. How can I bind a function
>>>> to the end of a chosen screen?
I read the implementation of wizard and eventually found some elements.
One can override those functions: transitionIntoFrom(from: Box[Screen]),
transitionOutOfTo(to: Box[Screen]), localSetup().
*When "Next" is pressed, localSetup() of the next screen is called first,
then transitionOutOfTo, then transitionIntoFrom.*
Sorry for the inconvenience then, I missed it in the API documentation (if
we don't "open" the full description of the transitionX functions, they
only speak about notifications and it was not clear to me).
I still could not lock a field (editable_? = false is simply ignored) and
my integration of Autocomplete doesn't work with the screens.
On Sun, Oct 28, 2012 at 2:32 PM, Jones <mistic.warr...@gmail.com> wrote:
> Okay, two things here. First of all, *I still cannot find a function that
> is called when "Next" is pressed. *
> Second, I realized that I could access a field in "override def
> nextScreen". Say I had an Int field called "age", I could do:
> But in my example my customer_field customized field cannot be accessed
> with customer_field.is. Probably because of the autocomplete widget? Does
> anybody know how I could deal with this?
> Thanks for your help!
> Jones
> PS: moreover, even if I set "override def editable_? = false", my fields
> always are editable...
> On Sat, Oct 27, 2012 at 2:50 PM, Jones <mistic.warr...@gmail.com> wrote:
>> Hello,
>> sorry to come back on this, but I still cannot find a solution. Here is
>> my code:
>> object addEntryWizard extends Wizard {
>>> object complete extends WizardVar(false)
>>> val prodScreen = new Screen {
>>> object prod extends WizardVar(Product.find(1) openOr Product.create)
>>> addFields(() => prod.name)
>>> val customers = Customer.findAll.map(_.name.is) // TODO: more
>>> intelligent autocomplete...
>>> val customer_field = new Field {
>>> type ValueType = String
>>> override def name = "Customer"
>>> override implicit def manifest = buildIt[String]
>>> override def default = ""
>>> override def toForm: Box[NodeSeq] = AutoComplete("",
>>> (current:String, limit:Int) =>
>>> customers.filter(_.toLowerCase.startsWith(current.toLowerCase)), x =>
>>> println("done" + x))
>>> }
>>> override def nextScreen = {
>>> Customer.find(By(Customer.name, "test")) match {
>>> case Empty => println("empty")
>>> case Full(_) => println("full")
>>> }
>>> customerScreen
>>> }
>>> override def finish() {
>>> }
>>> }
>> The idea here is that before going to the next screen
>> ("customerScreen"), I would like to check if what the user has entered in
>> the form is already existing in the database or not. If it is not, then the
>> user needs to enter it and therefore the screen "customerScreen" will be
>> required. But if it already exists in the database, I don't want to go to
>> this screen.
>> How can I achieve this? I cannot find a function that is executed after
>> the user has clicked on next but before the next screen...
>> Sorry for the inconvenience and thanks for your help!
>> Jones
>> On Thu, Oct 25, 2012 at 6:45 PM, Jones <mistic.warr...@gmail.com> wrote:
>>> Yes, there is. But from my observations, I believe it is not called
>>> before the end of the wizard, is it? What if I want to save something in
>>> the database between Screen1 and Screen2?
>>> Thanks for your help,
>>> Jones
>>> On Thu, Oct 25, 2012 at 5:56 PM, David Pollak <
>>> feeder.of.the.be...@gmail.com> wrote:
>>>> THere's a finish() method on each screen as well.
>>>> On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com>wrote:
>>>>> Hello,
>>>>> I am using persistence in a Wizard, and I am editing a specific entity
>>>>> "Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
>>>>> call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
>>>>> both are executed at the end of the main wizard. How can I bind a function
>>>>> to the end of a chosen screen?
I read the implementation of wizard and eventually found some elements.
One can override those functions: transitionIntoFrom(from: Box[Screen]),
transitionOutOfTo(to: Box[Screen]), localSetup().
*When "Next" is pressed, localSetup() of the next screen is called first,
then transitionOutOfTo, then transitionIntoFrom.*
Sorry for the inconvenience then, I missed it in the API documentation (if
we don't "open" the full description of the transitionX functions, they
only speak about notifications and it was not clear to me).
I still could not lock a field (editable_? = false is simply ignored) and
my integration of Autocomplete doesn't work with the screens (it is simply
ignored by the wizard actually).
On Sun, Oct 28, 2012 at 2:32 PM, Jones <mistic.warr...@gmail.com> wrote:
> Okay, two things here. First of all, *I still cannot find a function that
> is called when "Next" is pressed. *
> Second, I realized that I could access a field in "override def
> nextScreen". Say I had an Int field called "age", I could do:
> But in my example my customer_field customized field cannot be accessed
> with customer_field.is. Probably because of the autocomplete widget? Does
> anybody know how I could deal with this?
> Thanks for your help!
> Jones
> PS: moreover, even if I set "override def editable_? = false", my fields
> always are editable...
> On Sat, Oct 27, 2012 at 2:50 PM, Jones <mistic.warr...@gmail.com> wrote:
>> Hello,
>> sorry to come back on this, but I still cannot find a solution. Here is
>> my code:
>> object addEntryWizard extends Wizard {
>>> object complete extends WizardVar(false)
>>> val prodScreen = new Screen {
>>> object prod extends WizardVar(Product.find(1) openOr Product.create)
>>> addFields(() => prod.name)
>>> val customers = Customer.findAll.map(_.name.is) // TODO: more
>>> intelligent autocomplete...
>>> val customer_field = new Field {
>>> type ValueType = String
>>> override def name = "Customer"
>>> override implicit def manifest = buildIt[String]
>>> override def default = ""
>>> override def toForm: Box[NodeSeq] = AutoComplete("",
>>> (current:String, limit:Int) =>
>>> customers.filter(_.toLowerCase.startsWith(current.toLowerCase)), x =>
>>> println("done" + x))
>>> }
>>> override def nextScreen = {
>>> Customer.find(By(Customer.name, "test")) match {
>>> case Empty => println("empty")
>>> case Full(_) => println("full")
>>> }
>>> customerScreen
>>> }
>>> override def finish() {
>>> }
>>> }
>> The idea here is that before going to the next screen
>> ("customerScreen"), I would like to check if what the user has entered in
>> the form is already existing in the database or not. If it is not, then the
>> user needs to enter it and therefore the screen "customerScreen" will be
>> required. But if it already exists in the database, I don't want to go to
>> this screen.
>> How can I achieve this? I cannot find a function that is executed after
>> the user has clicked on next but before the next screen...
>> Sorry for the inconvenience and thanks for your help!
>> Jones
>> On Thu, Oct 25, 2012 at 6:45 PM, Jones <mistic.warr...@gmail.com> wrote:
>>> Yes, there is. But from my observations, I believe it is not called
>>> before the end of the wizard, is it? What if I want to save something in
>>> the database between Screen1 and Screen2?
>>> Thanks for your help,
>>> Jones
>>> On Thu, Oct 25, 2012 at 5:56 PM, David Pollak <
>>> feeder.of.the.be...@gmail.com> wrote:
>>>> THere's a finish() method on each screen as well.
>>>> On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com>wrote:
>>>>> Hello,
>>>>> I am using persistence in a Wizard, and I am editing a specific entity
>>>>> "Entity1" in a screen "Screen1". Before going to "Screen2", I would like to
>>>>> call "Entity1.save()" (I am using Mapper). But postFinish() and finish()
>>>>> both are executed at the end of the main wizard. How can I bind a function
>>>>> to the end of a chosen screen?
The following methods on the Screens can be overridden to detect entry/exit
from a screen:
/**
* A notification that we are transitioning into
* this screen. Override this method to perform
* some screen-specific actions
*
* @param from the screen we're coming from
*/
def transitionIntoFrom(from: Box[Screen]) {
}
/**
* A notification that we are transitioning out of
* this screen. Override this method to perform
* some screen-specific actions
*
* @param to the screen we're transitioning to
*/
def transitionOutOfTo(to: Box[Screen]) {
}
On Sun, Oct 28, 2012 at 9:03 AM, Jones <mistic.warr...@gmail.com> wrote:
> I read the implementation of wizard and eventually found some elements.
> One can override those functions: transitionIntoFrom(from: Box[Screen]),
> transitionOutOfTo(to: Box[Screen]), localSetup().
> *When "Next" is pressed, localSetup() of the next screen is called first,
> then transitionOutOfTo, then transitionIntoFrom.*
> Sorry for the inconvenience then, I missed it in the API documentation (if
> we don't "open" the full description of the transitionX functions, they
> only speak about notifications and it was not clear to me).
> I still could not lock a field (editable_? = false is simply ignored) and
> my integration of Autocomplete doesn't work with the screens (it is simply
> ignored by the wizard actually).
> Anyway, sorry for all those questions
> On Sun, Oct 28, 2012 at 2:32 PM, Jones <mistic.warr...@gmail.com> wrote:
>> Okay, two things here. First of all, *I still cannot find a function
>> that is called when "Next" is pressed. *
>> Second, I realized that I could access a field in "override def
>> nextScreen". Say I had an Int field called "age", I could do:
>> But in my example my customer_field customized field cannot be accessed
>> with customer_field.is. Probably because of the autocomplete widget?
>> Does anybody know how I could deal with this?
>> Thanks for your help!
>> Jones
>> PS: moreover, even if I set "override def editable_? = false", my fields
>> always are editable...
>> On Sat, Oct 27, 2012 at 2:50 PM, Jones <mistic.warr...@gmail.com> wrote:
>>> Hello,
>>> sorry to come back on this, but I still cannot find a solution. Here is
>>> my code:
>>> object addEntryWizard extends Wizard {
>>>> object complete extends WizardVar(false)
>>>> val prodScreen = new Screen {
>>>> object prod extends WizardVar(Product.find(1) openOr Product.create)
>>>> addFields(() => prod.name)
>>>> val customers = Customer.findAll.map(_.name.is) // TODO: more
>>>> intelligent autocomplete...
>>>> val customer_field = new Field {
>>>> type ValueType = String
>>>> override def name = "Customer"
>>>> override implicit def manifest = buildIt[String]
>>>> override def default = ""
>>>> override def toForm: Box[NodeSeq] = AutoComplete("",
>>>> (current:String, limit:Int) =>
>>>> customers.filter(_.toLowerCase.startsWith(current.toLowerCase)), x =>
>>>> println("done" + x))
>>>> }
>>>> override def nextScreen = {
>>>> Customer.find(By(Customer.name, "test")) match {
>>>> case Empty => println("empty")
>>>> case Full(_) => println("full")
>>>> }
>>>> customerScreen
>>>> }
>>>> override def finish() {
>>>> }
>>>> }
>>> The idea here is that before going to the next screen
>>> ("customerScreen"), I would like to check if what the user has entered in
>>> the form is already existing in the database or not. If it is not, then the
>>> user needs to enter it and therefore the screen "customerScreen" will be
>>> required. But if it already exists in the database, I don't want to go to
>>> this screen.
>>> How can I achieve this? I cannot find a function that is executed after
>>> the user has clicked on next but before the next screen...
>>> Sorry for the inconvenience and thanks for your help!
>>> Jones
>>> On Thu, Oct 25, 2012 at 6:45 PM, Jones <mistic.warr...@gmail.com> wrote:
>>>> Yes, there is. But from my observations, I believe it is not called
>>>> before the end of the wizard, is it? What if I want to save something in
>>>> the database between Screen1 and Screen2?
>>>> Thanks for your help,
>>>> Jones
>>>> On Thu, Oct 25, 2012 at 5:56 PM, David Pollak <
>>>> feeder.of.the.be...@gmail.com> wrote:
>>>>> THere's a finish() method on each screen as well.
>>>>> On Thu, Oct 25, 2012 at 8:52 AM, Jones <mistic.warr...@gmail.com>wrote:
>>>>>> Hello,
>>>>>> I am using persistence in a Wizard, and I am editing a specific
>>>>>> entity "Entity1" in a screen "Screen1". Before going to "Screen2", I would
>>>>>> like to call "Entity1.save()" (I am using Mapper). But postFinish() and
>>>>>> finish() both are executed at the end of the main wizard. How can I bind a
>>>>>> function to the end of a chosen screen?