It was suggested I post this here instead of the main forum.
I have an EntryPoint class that does nothing else but load this PanelA class onto the root panel. Does this look like a good starting point for my app. I have a dropdown, a couple of buttons and an image. The onClick configures some fields in the next Panel and then loads it. My question is does this look like something that I could work with now and expand into a more complex UI or have I got the GWT basics all wrong.?
public class PanelA extends HTMLPanel
{
private static PanelA panel;
private static ListBox list;
private static Image image = new Image("images/GB-wp1.jpg");
private PanelA()
{
super("Panel A");
final RootPanel rootPanel = RootPanel.get();
list = getListBox();
add(image);
image.setSize("100px", "100px");
SimpleRadioButton simpleRadioButton = new SimpleRadioButton("new name");
add(simpleRadioButton);
simpleRadioButton.setSize("51px", "35px");
NavigationButtonsPanel btnPanel = new NavigationButtonsPanel();
btnPanel.setForwardHandler(new ClickHandler() {
public void onClick(ClickEvent event)
{
rootPanel.clear();
PanelB.setMessageFromPreviousPage("Selected item " + list.getItemText( list.getSelectedIndex() ) + " in Panel A");
rootPanel.add( PanelB.getInstance() );
}
});
add( list );
add( btnPanel );
}
public static PanelA getInstance()
{
if (panel == null)
{
panel = new PanelA();
}
return panel;
}
public static ListBox getListBox()
{
ListBox widget = new ListBox();
widget.addStyleName("demo-ListBox");
widget.addItem("Quiz 1");
widget.addItem("Quiz 2");
widget.addItem("Quiz 3");
return widget;
}
}
I should add this app works fine, loads the next panel without any problem. Just want to know is this a correct application of GWT design?