Hi,

Have you listed LocationLookupService in your isis.properties?
As at
https://github.com/isisaddons/isis-wicket-gmap3/blob/2f6086ef29a239ea514bfdf24ad81819bb3e81d7/webapp/src/main/webapp/WEB-INF/isis.properties#L30

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 7, 2015 at 4:20 PM, German Vivero <
[email protected]> wrote:

> Hi all, yes I write a domain object and inject LoookUP services this is the
> code that I take from todoexample
>
> @javax.jdo.annotations.Unique(name="FISCAL_UNQ", members =
> {"tipodoc","nrodoc"})
> @DomainObject(objectType = "FISCAL")
> public class Fiscal implements Comparable<Fiscal>, Locatable {
>  ... some properties
>  ...
> //region > location (property), Locatable impl
> private Double locationLatitude;
> private Double locationLongitude;
> @Property(
> optionality = Optionality.OPTIONAL
> )
> @MemberOrder(sequence="3")
> public Location getLocation() {
> return locationLatitude != null && locationLongitude != null? new
> Location(locationLatitude, locationLongitude): null;
> }
> public void setLocation(final Location location) {
> locationLongitude = location != null ? location.getLongitude() : null;
> locationLatitude = location != null ? location.getLatitude() : null;
> }
> @MemberOrder(name="location", sequence="1")
> @ActionLayout(named = "Actualizar Localización")
> public Fiscal updateLocation(
> @ParameterLayout(named="Dirección")
> final String address) {
> final Location location = this.locationService.lookup(address);
> setLocation(location);
> return this;
> }
> //endregion
>
>  //Injections
> @javax.inject.Inject
> LocationLookupService locationService;
>
> }
>
>
> 2015-04-07 7:25 GMT-03:00 Martin Grigorov <[email protected]>:
>
> > On Tue, Apr 7, 2015 at 1:09 PM, Dan Haywood <
> [email protected]>
> > wrote:
> >
> > > Not sure.
> > >
> > > As you know, I would like to refactor and simplify Isis' support for
> DI,
> > > ideally to use JEE standards (CDI) which would unify our own home-grown
> > > support and our use of Guice internally within the framework.
> > >
> > > I'm not exactly certain what that will look like, but it's possible
> that
> > > Guice might disappear in that refactoring.
> > >
> > > I'd rather use your time (and anyone else's) to help figure out what
> > Isis'
> > > support for a CDI-based DI should look like, if possible?
> > >
> >
> > Actually I've spent some time on this recently and the problem I've hit
> was
> > that CDI (Weld) doesn't give me access to the ServletContext so I was not
> > able to read the context params during the start of the app.
> > I'll take a deeper look at it soon.
> >
> >
> > >
> > > On the other hand, if you think that a combined Injector will help
> > towards
> > > that objective, then by all means put something together to see we can
> > > learn something from it.
> > >
> >
> > I think such combined injector will make it easier for the applications
> to
> > migrate later.
> >
> > I'll keep you posted!
> >
> >
> > >
> > > cheers
> > > Dan
> > >
> > >
> > >
> > > On 7 April 2015 at 11:03, Martin Grigorov <[email protected]>
> wrote:
> > >
> > > > Hi Dan,
> > > >
> > > > On Tue, Apr 7, 2015 at 11:38 AM, Dan Haywood <
> > > [email protected]
> > > > >
> > > > wrote:
> > > >
> > > > > Martin's probably right... the LocationLookupService isn't injected
> > > > > properly.
> > > > >
> > > > > Just wanted to say that injecting into Wicket panels and pages is
> the
> > > > > exceptional case, rather than the norm.
> > > > >
> > > >
> > > > I was thinking about implementing a custom
> > > > org.apache.wicket.injection.Injector that will act as a composite for
> > > Guice
> > > > and Isis.
> > > > But reading your answer makes me think that this may be a bad
> practice.
> > > >
> > > >
> > > > >
> > > > > The more typical usage is injecting into domain objects (entities,
> > > > > services, view models) where injection happens automatically.  An
> > > example
> > > > > can be found in the ToDoItem class in the isis-app-todoapp [1].
> The
> > > only
> > > > > requirement is annotating with @javax.inject.Inject.
> > > > >
> > > > > But if your code looks like this already then post a code snippet
> and
> > > > we'll
> > > > > see if we can help debug.
> > > > >
> > > > > Cheers
> > > > > Dan
> > > > >
> > > > >
> > > > > [1]
> > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/isisaddons/isis-app-todoapp/blob/468592629545ba1c817a1544697fe81e7ab2e5e4/dom/src/main/java/todoapp/dom/module/todoitem/ToDoItem.java#L967-L968
> > > > >
> > > > >
> > > > > On 7 April 2015 at 07:57, Martin Grigorov <[email protected]>
> > > wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I seems LocationService isn't injected properly in your class,
> > that's
> > > > why
> > > > > > it is null when you attempt to use it.
> > > > > > In what class do you inject it? Is it a Wicket component like
> Panel
> > > or
> > > > > > Page? In this case you have to look it up "manually".
> > > > > > See
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/isis/blob/867188b865edaae77c4999c6059f79f0bc79b096/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java#L175
> > > > > >
> > > > > > Martin Grigorov
> > > > > > Freelancer, available for hire!
> > > > > > Wicket Training and Consulting
> > > > > > https://twitter.com/mtgrigorov
> > > > > >
> > > > > > On Mon, Apr 6, 2015 at 3:33 PM, German Vivero <
> > > > > > [email protected]> wrote:
> > > > > >
> > > > > > > Hi all, I have a problem runnign gmap addon.
> > > > > > >
> > > > > > > I write an entity following documentation, the app show me a
> map
> > > but
> > > > > when
> > > > > > > do a lookup to get a Location ocurrs a null point exception, on
> > > > > > > locationService.lookup(address), and if set a location as
> > > > > > -10.1111;10.1111
> > > > > > > isn't saved,I can modify and save all other propertiesof my
> > entity
> > > > > > >
> > > > > > > My app use securty module it can interfer with gmap??
> > > > > > >
> > > > > > > tnk
> > > > > > > German Vivero
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to