views:

25

answers:

0

Hi Guys

I am using GWT

If You look at my code , When I click on Hide button it clear the pieFlowPanel Panel but when I click on Show button it does not show my PieChart

final Panel panel = RootPanel.get(); final FlowPanel pieFlowPanel = new FlowPanel();

    final Runnable onLoadCallback = new Runnable() {

        public void run() {
            PieChart pie;
            // Create a pie chart visualization.
            pie = new PieChart(createTable(), createOptions());
            pie.addOnMouseOverHandler(createSelectHandler(pie));
            //                pie.addSelectHandler(createSelectHandler(pie));
            pieFlowPanel.add(pie);
            panel.add(pieFlowPanel);
        }
    };
    VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);
    Button button = new Button("Hide");
    Button button2 = new Button("Show");

    button.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pieFlowPanel.clear();

        }
    });

    button2.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final Runnable onLoadCallback1 = new Runnable() {

                public void run() {
                    Window.alert("RUN");
                    PieChart pie;
                    pie = new PieChart(createTable(), createOptions());
                    pie.addOnMouseOverHandler(createSelectHandler(pie));
                    pieFlowPanel.add(pie);
                    panel.add(pieFlowPanel);
                }
            };
            VisualizationUtils.loadVisualizationApi(onLoadCallback1, PieChart.PACKAGE);
        }
    });

    panel.add(button);
    panel.add(button2);

Please suggest me solution ...

Thanks