view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacagePanel.java @ 8443:df65f24af5bc

(issue1762) Use getValue to obtain dateRange values The getToValue was always the initial value regardless of what has been entered in the form. According to the documentation both getToValue and getFromValue should return the "initial value" of the form field. But wether this means the value before validation corrections or the value the field is initialized with (which is also not true in both cases as the field is set only after creation) It returned the real value for the from date but not for the to date. With an explicit getValue we workaround this issue.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 22 Oct 2014 17:33:43 +0200
parents ea9eef426962
children e3c2ae1887e8
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.client.client.ui;

import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.layout.VLayout;

import org.dive4elements.river.client.shared.model.Data;
import org.dive4elements.river.client.shared.model.DataList;
import org.dive4elements.river.client.shared.model.User;

import java.util.ArrayList;
import java.util.List;


/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public abstract class DatacagePanel extends TextProvider {

    private static final long serialVersionUID = 6937994648371673222L;

    protected String dataName;

    protected User user;

    protected DatacageWidget widget;


    public DatacagePanel() {
        super();
    }


    public DatacagePanel(User user) {
        super();
        this.user = user;
    }


    @Override
    public Canvas create(DataList dataList) {
        Data   data   = dataList.get(0);
        this.dataName = data.getLabel();

        createWidget();

        Canvas label   = new Label(data.getDescription());
        Canvas submit  = getNextButton();
        VLayout layout = new VLayout();
        label.setHeight(25);

        layout.addMember(label);
        layout.addMember(submit);
        layout.setMembersMargin(10);

        return layout;
    }


    protected void createWidget() {
        widget = new DatacageWidget(
            artifact,
            getUser(),
            getOuts(),
            getParameters(),
            false);

        widget.setHeight100();

        helperContainer.addMember(widget);
    }


    @Override
    public List<String> validate() {
        return new ArrayList<String>();
    }


    public User getUser() {
        return user;
    }


    public String getOuts() {
        return null;
    }


    public String getParameters() {
        return null;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org