nice one, Adam. I had misunderstood that the problem was with an action
parameter drop down.

Sorry to be brief, sent from my phone
On Jan 7, 2013 12:01 AM, "Christian Steinebach" <
[email protected]> wrote:

> Hi Adam,
>
> that's it! :-)
> Thank you very much for helping!
>
>           Christian
>
> ________________________________________
> From: Adam Howard [[email protected]]
> Sent: Sunday, January 06, 2013 11:30 PM
> To: [email protected]
> Subject: Re: problem with choices for properties
>
> Christian,
>
> I think what you're looking for is a method in your TransportDemands
> factory like:
>
> public List<TransportDemand> choices0NewTransportDemand() {
>     return destinations.allDestinations();
> }
>
> and then choices1... for the second argument.
>
> This is how you tell an action where to get its choices as opposed to the
> choicesPickups method you have in the TransportDemand class which tells an
> "already created" instance where to get its choices.
>
> Hope that helps.
> --
> Adam Howard
>
>
> On Sun, Jan 6, 2013 at 3:57 PM, Dan Haywood <[email protected]
> >wrote:
>
> > Ah. You need to instantiate instances using
> > container.newTransientInstance(ClassName.class).
> >
> > Cheers, Dan
> >
> > Sorry to be brief, sent from my phone
> > On Jan 6, 2013 9:48 PM, "Christian Steinebach" <
> > [email protected]> wrote:
> >
> > > Hi Dan!
> > >
> > > Thank you very much again. It seems if you can make
> > > it to the point where you can 'Edit' an instance, the necessary
> services
> > > are injected
> > > and you will get a drop down list.
> > > The injections 'setDomainObjectContainer' and 'setToDoItems' etc.
> > > are called when you edit an existing object but not when you try to
> > > allocate a new one.
> > > That would mean, only if you make a property @Optional the
> > > choiceProperty() method will
> > > be called (but only when editing the instance afterwards).
> > > Maybe I'm completely on the wrong track here...?
> > > Anyway, thanks to your suggestion it now works as expected with the
> > > autoComplete annotation, so my problem
> > > is solved in a way. :-)
> > >
> > >                 So long
> > >                      Christian
> > >
> > > ________________________________________
> > > From: Dan Haywood [[email protected]]
> > > Sent: Sunday, January 06, 2013 7:02 PM
> > > To: [email protected]
> > > Subject: Re: problem with choices for properties
> > >
> > > Hi Christian,
> > >
> > > Just coming back to you on this...
> > >
> > > I added a new property to the quickstart archetype's ToDoItem [1], and
> it
> > > seems to be working ok [2], [3], [4].
> > >
> > > The only thing that might be a bit odd is the rendering of "(null)"
> when
> > no
> > > reference is set... perhaps that should simply be blank.  Otherwise,
> > seems
> > > ok...
> > >
> > > Dan
> > >
> > >
> > > [1] http://danhaywood.com/?attachment_id=1067
> > > [2] http://danhaywood.com/?attachment_id=1068
> > > [3] http://danhaywood.com/?attachment_id=1069
> > > [4] http://danhaywood.com/?attachment_id=1070
> > >
> > >
> > >
> > > On 6 January 2013 10:15, Dan Haywood <[email protected]>
> > wrote:
> > >
> > > > Hi Christian,
> > > > Welcome to the list, and thanks for trying out Isis.
> > > >
> > > > From a quick skim over your code, it doesn't look like there's
> anything
> > > > wrong, so you might have uncovered an issue with the Wicket viewer.
> > > >
> > > > I do know that the autocomplete functionality works [1], [2], and
> this
> > > may
> > > > be a better UI experience anyway... so try that out too.
> > > >
> > > > I'll take a look when I get a chance, but if you could also create a
> > very
> > > > simple example test case on github, that'd be really helpful.
> > > >
> > > > Cheers
> > > > Dan
> > > >
> > > > [1] http://isis.apache.org/core/guides/isis-applib.html#d5e779
> > > > [2] http://isis.apache.org/core/guides/isis-applib.html#d5e2277
> > > >
> > > >
> > > >
> > > > On 5 January 2013 19:24, Christian Steinebach <
> > > > [email protected]> wrote:
> > > >
> > > >> Hei everybody!
> > > >>
> > > >> I'm trying to learn isis and DDD, using the wicket viewer.
> > > >> I have a class TransportDemand which has as a property a pickup
> > > >> destination and a delivery destination.
> > > >>
> > > >> The Destination is again defined as a class.
> > > >> The TransportDemands 'factory and repository' has an action
> > > >> newTransportDemand();
> > > >>
> > > >> In order to give the user a choice for the pickup/delivery
> > destinations
> > > I
> > > >> created a method
> > > >> choicesPickup() in the class TransportDemand
> > > >>
> > > >> But, in the UI there are no choices presented when selecting 'New
> > > >> Transport Demand'. Only 'null' is written.
> > > >>
> > > >> When removing choicesPickup() and declaring the class Destination as
> > > >> @Bounded, the list of destinations is shown.
> > > >>
> > > >> What have I done wrong? Some code fragments below.
> > > >>
> > > >>           Thank your for any help
> > > >>                  Christian
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> ---- TransportDemand.java
> > > >> public class TransportDemand extends AbstractDomainObject implements
> > > >> Comparable<TransportDemand> {
> > > >>
> > > >>     private Destination pickup;
> > > >>     public Destination getPickup() {
> > > >>         return pickup;
> > > >>     }
> > > >>     public List<Destination> choicesPickup(){
> > > >>         return destinations.allDestinations();
> > > >>     }
> > > >> .....
> > > >>     private Destinations destinations;
> > > >>     public void setDestinations(final Destinations destinations) {
> > > >>         this.destinations = destinations;
> > > >>     }
> > > >> }
> > > >>
> > > >> ---- TransportDemands.java
> > > >> public class TransportDemands extends AbstractFactoryAndRepository{
> > > >> ...
> > > >>     public TransportDemand newTransportDemand(
> > > >>             @Named("Pickup") Destination pickup,
> > > >>             @Named("Delivery") Destination delivery
> > > >>             )
> > > >>             {
> > > >>         final TransportDemand transportDemand =
> > > >> newTransientInstance(TransportDemand.class);
> > > >>         transportDemand.setPickup(pickup);
> > > >>         transportDemand.setDelivery(delivery);
> > > >>         transportDemand.setOwnedBy(currentUserName());
> > > >>         persist(transportDemand);
> > > >>         return transportDemand;
> > > >>     }
> > > >>
> > > >>     public List<TransportDemand> allTransportDemands(){
> > > >>         final String currentUser = currentUserName();
> > > >>         final List<TransportDemand> items =
> > > >> allMatches(TransportDemand.class,
> > > >> TransportDemand.thoseOwnedBy(currentUser));
> > > >>         Collections.sort(items);
> > > >>         return items;
> > > >>     }
> > > >>
> > > >>
> > > >> ---- Destinations.java
> > > >> public class Destinations extends AbstractFactoryAndRepository{
> > > >> ....
> > > >>     public List<Destination> allDestinations() {
> > > >>         final List<Destination> items =
> > allInstances(Destination.class);
> > > >>         Collections.sort(items);
> > > >>         return items;
> > > >>     }
> > > >> }
> > > >
> > > >
> > > >
> > >
> >
>

Reply via email to