view flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/OverviewOutputTab.java @ 4198:1cdbd8a0c994

Added two new tables ClickableQDTable and ClickableWTable and made Ws and Qs clickable in historical discharge calculation. The new tables define listener interfaces (clicked lower or upper icon) to listen to user clicks. In addition to this, there is an enum ClickMode with NONE, SINGLE and RANGE options, which allows to specifiy, which icons are displayed in the tables. NONE means no icon for user clicks, SINGLE has 1 icon, RANGE 2 icons for lower and upper.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 22 Oct 2012 13:31:25 +0200
parents 27e455487d66
children
line wrap: on
line source
package de.intevation.flys.client.client.ui.chart;

import com.google.gwt.core.client.GWT;

import de.intevation.flys.client.client.event.OutputParameterChangeHandler;
import de.intevation.flys.client.client.event.RedrawRequestHandler;
import de.intevation.flys.client.client.ui.CollectionView;
import de.intevation.flys.client.client.ui.ImgLink;
import de.intevation.flys.client.shared.model.Collection;
import de.intevation.flys.client.shared.model.OutputMode;
import de.intevation.flys.client.shared.model.Theme;


public class OverviewOutputTab extends ChartOutputTab  {

    private class NoChartThemePanel extends ChartThemePanel {

        public NoChartThemePanel(OutputMode mode, CollectionView view) {
            super(mode, view);
        }

        @Override
        public void activateTheme(Theme theme, boolean active) { }

        @Override
        public void feedTellArea(
            final String artifact,
            Theme under,
            Theme over,
            boolean between
        ) { }

        @Override
        public void createAreaArtifact(
            final Theme   over,
            final Theme   under,
            final boolean between
        ) { }

        @Override
        public void addOutputParameterChangeHandler(OutputParameterChangeHandler h) { }

        @Override
        public void addRedrawRequestHandler(RedrawRequestHandler h){ }
    }



    private class MinimumChartToolbar extends ChartToolbar {

        public MinimumChartToolbar(ChartOutputTab tab) {
            super(tab);
        }

        @Override
        protected void initTools() {
            GWT.log("CREATE NEW MINIMALISTIC CHART TOOLBAR");
            ChartOutputTab chartTab = getChartOutputTab();

            String baseUrl = GWT.getHostPageBaseURL();

            downloadPNG = new ImgLink(
                baseUrl + MSG.downloadPNG(),
                chartTab.getExportUrl(-1, -1, "png"),
                20,
                20);
            downloadPNG.setTooltip(MSG.downloadPNGTooltip());

            initLayout();
        }


        @Override
        protected void initLayout() {
            setWidth100();
            setHeight(PANEL_HEIGHT);
            setMembersMargin(10);
            setPadding(5);
            setBorder("1px solid black");

            addMember(downloadPNG);
        }
    }



    public OverviewOutputTab(
        String         title,
        Collection     collection,
        OutputMode     mode,
        CollectionView collectionView
        ){
        super(title, collection, mode, collectionView);
        left.setVisible(false);
    }


    @Override
    public ChartThemePanel createThemePanel(
        OutputMode mode, CollectionView view
        ) {
        return new NoChartThemePanel(mode, view);
    }

    @Override
    public ChartToolbar createChartToolbar(ChartOutputTab tab) {
        return new MinimumChartToolbar(tab);
    }
}

http://dive4elements.wald.intevation.org