Unable to register multiple places with one Class

3 views
Skip to first unread message

Robert Munteanu

unread,
Jul 29, 2010, 10:10:54 AM7/29/10
to gwt-pr...@googlegroups.com
Hi,

I've been chasing a Place-related problem for at least one hour - and
I found that the DefaultPlaceManager disallows registering more than
one place per class. In my application, I have a parametrized Place
class which takes an entity class key to determine what presenter to
display.

The code in question is below.

public boolean registerPlace( Place place ) {
if ( !placeMap.containsKey( place.getClass() ) ) {
place.addHandlers( eventBus );
placeMap.put( place.getClass(), place );
return true;
}
return false;
}

My question is what is the purpose of this piece of code? If it is to
guard against multiple registrations, couldn't a HashSet simply
contain all presenters? By default, we can set the equals / hashCode
methods of Place to delete to the class instance, so we would gain
nothing.

Thanks,

Robert

Robert
--
Sent from my (old) computer

Robert Munteanu

unread,
Jul 29, 2010, 10:28:20 AM7/29/10
to gwt-pr...@googlegroups.com
Looking closer, the default Place equals / hashCode use getName() . So
it looks even more like the Class -> Presenter mapping in unneded.

Thoughts?

Robert

Reply all
Reply to author
Forward
0 new messages