Thursday, March 26, 2015

Re: How to filter some places in onPlaceChangeRequest in ActivityManager?


Why it's look like a design problem?

Can I create ActivityManager with CachingActivityMapper and FilteredActivityMapper?

Somthing like this:

public CachingHorizontalMasterActivityMapper(HorizontalMasterActivityMapper horizontalMasterActivityMapper) {

    FilteredActivityMapper.Filter filter = new FilteredActivityMapper.Filter() {
      @Override
      public Place filter(Place place) {
        return place instanceof MailDetailPlace ? new MailListPlace() : place;
      }
    };

    CachingActivityMapper cachingActivityMapper = new CachingActivityMapper(horizontalMasterActivityMapper);
    filteredActivityMapper = new FilteredActivityMapper(filter, cachingActivityMapper);
  }

  @Override
  public Activity getActivity(Place place) {
    return filteredActivityMapper.getActivity(place);
  }

This ActivityManager does not stop currently started activity MailListActivity if new place is MailDetailPlace, right?

If, so, why ActivityManager ask current MailListActivity mayStop, if it will not stop it?

Is there in my words any logic?

Or you mean that my ListEditActivity has design problem? 

ListEditActivity is responsible for saving all changed list items in one server call, each item has been changed by ItemDetailActivity (but not actually sended to server for save).
for this functionality there is ListEditView which implements IsEditor<ListEditor<T, E>>

and ListEditActivity.mayStop is performed then user go from one item to edit another item in list - trying to change ItemDetailPlace - this place stops current ItemDetailActivity and starts new ItemDetailActivity
this call of ListEditActivity.mayStop not need because ListEditActivity will not stopped. Only ItemDetailActivity will be stopped in ItemDetailActivity.mayStop needt to call.

And call ListEditActivity.mayStop need only when place ListEditPlace is changed, then ListEditActivity will be stopped

very kind of you to send me those links ))))


On Thursday, March 26, 2015 at 8:27:25 PM UTC+3, Eric Ponthiaux wrote:
It looks like a design problem .

But if you really want to continue in this way , start by reading :


Regards







Le jeudi 26 mars 2015 11:35:42 UTC+1, Anton Mityagin a écrit :

Hi

There is need to filter some places in onPlaceChangeRequest in ActivityManager to prevent call mayStop of currentActivity.

for example, I have ListEditActivity where I can edit list items. This activity managed by ActivityManager this CachingActivityMapper and FilteredActivityMapper.
Also I have ListSelectionItemPlace which indicates currently selected item in the list

After a list item has been edited and selected another item in the list, there is an attempt to change the place to ListSelectionItemPlace
and fired event PlaceChangeRequestEvent. Handler onPlaceChangeRequest in ActivityManager calls mayStop method of ListEditActivity it is returns some message
because item has been edited.

I need to ignore such places change, but I cannot to do it.

method mayStop has no any parameters.

Handle PlaceChangeRequestEvent in ListEditActivity gets no result because event handler is still called in ActivityManager before.

I can subclass ActivityManager for ListEditActivity and override onPlaceChangeRequest method, but I have no access to currentActivity to ask it ignor or not this call.


Have any ideas?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment