开发者

Trying to Add More tabs to tab panel upon clicking on a button

I would like to add more tabs to the tab panel upon receiving a reponse from a servelet.. the problem is that It only adds the last one and not the the others see part of the code below. It seems like it is only adding the last panel "Time Reports" but not the other two Thank you

        btnLogin.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                if(getLoginResult())
                   开发者_C百科                {
                            HorizontalPanel temp = new HorizontalPanel();
             panel.add(temp, "Add Hours");
             panel.add(temp, "Time Sheets");
             panel.add(temp, "Time Reports");

                                    }

            }

        });

        RootPanel.get().add(panel);
      }

    private boolean getLoginResult() {
        AsyncCallback callback = new AsyncCallback() {
            public void onSuccess(Object result) {

                isAuthenticated = true;

            }

            public void onFailure(Throwable caught) {
                Window.alert("Error when invoking the pageable data service :" + caught.getMessage());
                isAuthenticated = false;
            }
        };

        timesheetLoginServlet.isAuthenticated("1","rapidjava", callback);
        return isAuthenticated;

    }
}


You can add any widget to its parent only once. Change the temp to temp1, temp2 and temp3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜