view flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java @ 5462:f2371f3aaf03

Show top level folder icons only if node has no factory If you have an empty folder the folder icon is still shown. This makes it possible to add functional "Top Level" entries in the Datacage
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 26 Mar 2013 18:29:13 +0100
parents 6f6461e07854
children
line wrap: on
line source
package de.intevation.flys.client.client.ui.stationinfo;

import com.google.gwt.core.client.GWT;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.layout.VLayout;

import de.intevation.flys.client.client.FLYS;
import de.intevation.flys.client.client.FLYSConstants;
import de.intevation.flys.client.shared.model.Data;
import de.intevation.flys.client.shared.model.DataList;
import de.intevation.flys.client.shared.model.RiverInfo;

/**
 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
 */
public abstract class InfoListGrid extends ListGrid {

    protected FLYS flys;
    protected DataList[] data;
    /** The message class that provides i18n strings.*/
    protected FLYSConstants MSG = GWT.create(FLYSConstants.class);


    public InfoListGrid(FLYS flys) {
        super();
        this.flys = flys;
        this.setCanExpandRecords(true);
        this.setCanExpandMultipleRecords(true);
    }

    public void openAll() {
        GWT.log("InfoListGrid - openAll");
        for (ListGridRecord record: this.getRecords()) {
            expandRecord(record);
        }
    }

    public void setData(DataList[] data) {
        GWT.log("InfoListGrid - setData");
        this.data = data;
        this.open();
    }

    protected Double getDoubleValue(Data d) {
        String tmp = d.getStringValue();
        if (tmp != null) {
            return Double.valueOf(tmp);
        }
        return null;
    }

    @Override
    protected Canvas getExpansionComponent(ListGridRecord record) {
        VLayout layout = new VLayout();
        layout.setPadding(5);
        layout.addMember(this.getExpandPanel(record));
        return layout;
    }

    public abstract void open();

    public abstract void setRiverInfo(RiverInfo riverinfo);

    protected abstract Canvas getExpandPanel(ListGridRecord record);
}

http://dive4elements.wald.intevation.org