If your widgets are reusable, if you create new instances there are not
problem. Why you want to share instances?

2011/6/16 ricu <marko.c...@gmail.com>

> Yes, but I have new instances because they are not singletons :). So
> to solve this issue I must make them singletons? If I do that then I
> can't reuse them across the application. Or can I?
>
> On 16 lip, 12:50, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
> wrote:
> > No, I don't say that. I say your problem about multiple instance is
> becouse
> > in each @Inject you have a new instance.
> >
> > 2011/6/16 ricu <marko.c...@gmail.com>
> >
> >
> >
> >
> >
> >
> >
> > > Are you trying to say that I make those views as singletons? The
> > > problem is that I would like to reuse one widget on multiple places.
> > > If I go with singletons I must create classes for every widget I use
> > > (they will extend some class that has mutual functionality)?
> >
> > > On 16 lip, 02:27, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
> > > wrote:
> > > > "The problem is that we get two objects of the sub-widget class"
> becouse
> > > > this widgets aren't singletons.
> >
> > > > 2011/6/15 ricu <marko.c...@gmail.com>
> >
> > > > > Anybody? Maybe someone has the same architecture without GIN. What
> is
> > > > > your experience?
> >
> > > > > On 13 lip, 21:16, ricu <marko.c...@gmail.com> wrote:
> > > > > > Hi!
> >
> > > > > > We are usingGINin our application which is constructed in MVP
> style.
> > > > > > We tried to follow some best practices described in GWT pages and
> > > here
> > > > > > in GWT group so we design the application in the following
> manner:
> > > > > > 1) We have multiple main screens(pages) that have activities
> attached
> > > > > > to them. They are build in MVP  style where presenters are also
> > > > > > activities.
> > > > > > 2) Every main screen is a collection of some sub-widgets which
> can
> > > > > > also be created from some other sub-sub-widgets, so you can say
> that
> > > > > > we are nesting views and their presenters.
> > > > > > 3) The main views are singletons. Our sub-widgets are not
> singletons
> > > > > > because we are reusing them.
> > > > > > 4) All of our presenters aren't singletons.
> > > > > > 5) They are created usingGIN
> >
> > > > > > GINBinding example:
> > > > > > bind(SubWidgetView.class).to(SubWidget.class);
> > > > > >
> bind(MainWidgetView.class).to(MainWidget.class).in(Singleton.class);
> >
> > > > > > Injecting sub-widget into main widget through constructor
> example:
> > > > > > @Inject
> > > > > > public MainWidget(SubWidget widget1)
> >
> > > > > > Injecting sub-widget's interface into presenter through
> constructor
> > > > > > example:
> > > > > > @Inject
> > > > > > public SubWidgetPresenter(SubWidgetView widget1)
> >
> > > > > > The problem is that we get two objects of the sub-widget class,
> one
> > > > > > for injecting the into main widget and the other one for while
> > > > > > injecting into it's presenter. The first one is  shown on the
> screen
> > > > > > but the other one is bind to the presenter. When presenter
> changes
> > > its
> > > > > > view, it changes the view that was not bin to the main widget and
> we
> > > > > > can't see anything.
> >
> > > > > > So our solution would be to create one sub-widget per main-widget
> but
> > > > > > we don't know how to do it and if we do, we don't know how to
> inject
> > > > > > that object of the sub-widget into the recreating presenter.
> >
> > > > > > Marko
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Google Web Toolkit" group.
> > > > > To post to this group, send email to
> > > google-web-toolkit@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > google-web-toolkit+unsubscr...@googlegroups.com.
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-web-toolkit?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google Web Toolkit" group.
> > > To post to this group, send email to
> google-web-toolkit@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-web-toolkit+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to