teichmann@5861: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5861: * Software engineering by Intevation GmbH teichmann@5861: * teichmann@5993: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5861: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5993: * documentation coming with Dive4Elements River for details. teichmann@5861: */ teichmann@5861: teichmann@5835: package org.dive4elements.river.client.client.ui; ingo@20: ingo@20: import com.google.gwt.core.client.GWT; ingo@20: ingo@20: import com.smartgwt.client.types.VerticalAlignment; ingo@20: import com.smartgwt.client.widgets.Canvas; ingo@20: import com.smartgwt.client.widgets.layout.HLayout; ingo@20: teichmann@5835: import org.dive4elements.river.client.shared.model.Data; teichmann@5835: import org.dive4elements.river.client.shared.model.DataList; ingo@20: ingo@20: ingo@20: /** ingo@20: * This UIProvider displays the DataItems contained in the Data object in a ingo@20: * combo box as SelectProvider does. Furthermore, there is a map displayed that ingo@20: * lets the user choose a river by selecting it on the map. ingo@20: * ingo@20: * @author Ingo Weinzierl ingo@20: */ ingo@20: public class MapSelection extends SelectProvider { ingo@20: christian@4064: private static final long serialVersionUID = 1261822454641198692L; christian@4064: gernotbelger@8870: private ModuleSelection moduleSelection; ingo@39: ingo@20: public MapSelection() { ingo@20: } ingo@20: ingo@20: ingo@20: /** ingo@20: * This method currently returns a ingo@20: * {@link com.smartgwt.client.widgets.form.DynamicForm} that contains all ingo@20: * data items in a combobox stored in data.
ingo@20: * ingo@20: * TODO: The map panel for the river selection needs to be ingo@20: * implemented! ingo@20: * ingo@51: * @param data The {@link DataList} object. ingo@20: * ingo@20: * @return a combobox. ingo@20: */ christian@4064: @Override ingo@51: protected Canvas createWidget(DataList data) { ingo@20: GWT.log("MapSelection - create()"); ingo@20: ingo@20: HLayout h = new HLayout(); ingo@20: h.setAlign(VerticalAlignment.TOP); raimund@282: h.setHeight(100); raimund@282: moduleSelection = new ModuleSelection(); ingo@20: raimund@282: Canvas form = moduleSelection.create(data); christian@4573: form.setWidth(400); ingo@53: form.setLayoutAlign(VerticalAlignment.TOP); ingo@20: tom@8856: // TODO implement event handling in the river map tom@8856: // (here? or in LinkSelection) ingo@20: ingo@20: h.addMember(form); ingo@20: ingo@20: return h; ingo@20: } raimund@282: christian@4064: @Override raimund@282: protected Data[] getData() { raimund@282: if (moduleSelection != null) { raimund@282: return moduleSelection.getData(); raimund@282: } raimund@282: else { raimund@282: return null; raimund@282: } raimund@282: } rrenkert@5928: rrenkert@5928: public ModuleSelection getModuleSelection() { rrenkert@5928: return this.moduleSelection; rrenkert@5928: } ingo@20: } ingo@20: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :