0

我有一个使用堆栈面板的类,然后在我的另一个类中调用它,然后在我的入口点类中调用。我的问题是如何让 GChart 在我的 Stackpanel 中显示(三个面板中只有一个)。

    package net.gui.client.content;

import net.gui.client.chart.ChartTuple;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.StackLayoutPanel;
import com.google.gwt.user.client.ui.Widget;

/*
 author Kenny Watts
 since July 10, 2012
 This class creates the stacked panels that 
 display the data in the main screen of the gui
 */

public class StackPanel extends StackLayoutPanel {
    static int index = 0;
    public static final String PANEL0NAME = "Critical Data:";
    public static final String PANEL1NAME = "Supporting Data:";
    public static final String PANEL2NAME = "Other Data:";
    ChartTuple chartTest = new ChartTuple();

    public StackPanel(int numTabs) {
        super(Unit.PX);
        // for (int i = 0; i < numTabs; i++) {
        add(stackContent(0), PANEL0NAME, 25);
        add(stackContent(1), PANEL1NAME, 25);
        add(stackContent(2), PANEL2NAME, 25);

        // }
        showWidget(numTabs - 1);
        addStyleName("body");
        setAnimationDuration(500);
    }

    private Widget stackContent(int index) {

//      String content = "This is data set numebr: " + index + ""
//              + PanelUtils.randomText() + PanelUtils.randomText();
        ScrollPanel p = new ScrollPanel(chartTest);
        return (p);
    }
}

那是我的堆栈面板,这是我的图表类。

    package net.gui.client.chart;

import com.googlecode.gchart.client.GChart;

/**
 * Defines a bar-chart of x*x vs. x, with gridlines.
 */

public class ChartTuple extends GChart {

    public ChartTuple() {
        setChartTitle("<b>x<sup>2</sup> vs x</b>");
        setChartSize(150, 150);
        addCurve();
        for (int i = 0; i < 10; i++)
            getCurve().addPoint(i, i * i);
        getCurve().setLegendLabel("x<sup>2</sup>");
        getCurve().getSymbol().setSymbolType(SymbolType.VBAR_SOUTH);
        getCurve().getSymbol().setBackgroundColor("red");
        getCurve().getSymbol().setBorderColor("black");
        getCurve().getSymbol().setModelWidth(1.0);
        getXAxis().setAxisLabel("<b>x</b>");
        getXAxis().setHasGridlines(true);
        getYAxis().setAxisLabel("<b>x<sup>2</sup></b>");
        getYAxis().setHasGridlines(true);
    }
}

最后是我的入口点类:

package net.gui.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootLayoutPanel;

/**
 * Main entry point class for the ISCI gui. this just add's the BasePanel to the
 * rootlayoutpanel so it can be put into the HTML file.
 */
public class ISCI implements EntryPoint {

    @Override
    public void onModuleLoad() {
        BasePanel basePanel = new BasePanel();
        RootLayoutPanel.get().add(basePanel);
    }
}

当我运行它时,我收到以下错误:“ [ERROR] [ISCI] - 第 16 行:没有源代码可用于类型 com.googlecode.gchart.client.GChart.SymbolType;您是否忘记继承所需的模块?”

4

1 回答 1

0

你是通过 GChart gwt 模块继承的吗?

<inherits name='com.googlecode.gchart.GChart' />
于 2012-07-17T18:59:07.950 回答