Event overview mobile - Filled Quickfinder with data

This commit is contained in:
Benjamin Barth committed 2015-06-15 15:03:24 +02:00
1 parent 027b1122da
commit de3e54ee50
3 files changed
+38 -3

No files matched your search

@@ -3,12 +3,15 @@ package com.sap.sailing.gwt.home.mobile.places.event;
import java.util.UUID;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
import com.sap.sailing.gwt.home.client.place.event.AbstractEventPlace;
import com.sap.sailing.gwt.home.client.place.event.EventContext;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
import com.sap.sailing.gwt.home.mobile.places.event.EventView.Presenter;
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
@@ -18,8 +21,6 @@ import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
public class EventActivity extends AbstractActivity implements Presenter {
private final MobileApplicationClientFactory clientFactory;
private final AbstractEventPlace place;
public EventActivity(AbstractEventPlace place, MobileApplicationClientFactory clientFactory) {
this.clientFactory = clientFactory;
@@ -59,7 +60,8 @@ public class EventActivity extends AbstractActivity implements Presenter {
if (sailorInfoUrl != null && !sailorInfoUrl.isEmpty()) {
view.setSailorInfos(StringMessages.INSTANCE.sailorInfoLongText(), StringMessages.INSTANCE.sailorInfo(), sailorInfoUrl);
}
view.setQuickFinderValues(place.getCtx().getEventDTO().getRegattas());
view.getQuickfinder().addSelectionHandler(new QuickfinderSelectionHandler());
}
@Override
@@ -70,4 +72,12 @@ public class EventActivity extends AbstractActivity implements Presenter {
public DispatchSystem getDispatch() {
return clientFactory.getDispatch();
}
private class QuickfinderSelectionHandler implements SelectionHandler<String> {
@Override
public void onSelection(SelectionEvent<String> event) {
// TODO Link to correct places
clientFactory.getPlaceController().goTo(new StartPlace());
}
}
}
@@ -1,15 +1,23 @@
package com.sap.sailing.gwt.home.mobile.places.event;
import java.util.List;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.place.event.EventContext;
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
import com.sap.sailing.gwt.ui.shared.eventview.RegattaMetadataDTO;
public interface EventView {
Widget asWidget();
HasSelectionHandlers<String> getQuickfinder();
void setSailorInfos(String description, String buttonLabel, String url);
void setQuickFinderValues(List<RegattaMetadataDTO> regattaMetadatas);
public interface Presenter {
EventContext getCtx();
@@ -1,6 +1,9 @@
package com.sap.sailing.gwt.home.mobile.places.event;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
@@ -11,7 +14,9 @@ import com.sap.sailing.gwt.home.mobile.partials.eventheader.EventHeader;
import com.sap.sailing.gwt.home.mobile.partials.quickfinder.Quickfinder;
import com.sap.sailing.gwt.home.mobile.partials.simpleinfoblock.SimpleInfoBlock;
import com.sap.sailing.gwt.home.mobile.places.event.overview.EventOverviewStage;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventOverviewStageAction;
import com.sap.sailing.gwt.ui.shared.eventview.RegattaMetadataDTO;
public class EventViewImpl extends Composite implements EventView {
private static StartPageViewUiBinder uiBinder = GWT.create(StartPageViewUiBinder.class);
@@ -42,6 +47,18 @@ public class EventViewImpl extends Composite implements EventView {
sailorInfoUi.setDescription(SafeHtmlUtils.fromString(description.replace("\n", " ")));
sailorInfoUi.setAction(buttonLabel, url);
}
@Override
public void setQuickFinderValues(List<RegattaMetadataDTO> regattaMetadatas) {
quickFinderUi.addPlaceholderItem(StringMessages.INSTANCE.resultsQuickfinder(), null);
for (RegattaMetadataDTO regattaMetadata : regattaMetadatas) {
quickFinderUi.addItemToGroup(regattaMetadata.getBoatCategory(), regattaMetadata.getDisplayName(), regattaMetadata.getId());
}
}
@Override
public HasSelectionHandlers<String> getQuickfinder() {
return quickFinderUi;
}
}