GWT Interview Questions and Answers
Ques 16. What are the GWT Panels?
RootPanel is the top level panel.
For layout the page, we could use following layout panels, finally we need to add all those layout panels in RootPanel.
DockLayoutPanel
SplitLayoutPanel
StackLayoutPanel
TabLayoutPanel
Use below panels inside the Layout panels for holding the widgets.
HorizontalPanel
VerticalPanel ( Prefer using FlowPanel )
Ques 17. How to create custom widgets in GWT?
Create a class that should extends Composite class of GWT.
Inside the constructor you can write you logic to create a widget and call the initWidget method().
Then you can use this class in anywhere in the application and add this widget in any panels.
private static class OptionalTextBox extends Composite implements
ClickHandler {
private TextBox textBox = new TextBox();
private CheckBox checkBox = new CheckBox();
--------
initWidget(panel);
-------
}
Ques 18. Code of entry point with onModuleLoad where split out is working.
To split your code, simply insert calls to the method GWT.runAsync at the places where you want the program to be able to pause for downloading more code. These locations are called split points. For this you should use runAsync.
public class Hello implements EntryPoint {
public void onModuleLoad() {
Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert("Code download failed");
}
public void onSuccess() {
Window.alert("Hello, AJAX");
}
});
}
});
RootPanel.get().add(b);
}
}
Ques 19. What is AsyncDataProvider in GWT cell widgets?
When you want to display dynamic data or a range of data, not just a static list, then we should use AsyncDataProvider.
Ques 20. What is GWT ClientBundle?
In GWT we can use ClientBundle to load all the images and CSS files in one single file and use it anywhere in the application. It provides flexible way to get the resources.
1. It creates a single image from the collection of images at compile time to reduce the image size.
2. Enable more aggressive caching headers for program resources. It will go to server for every-time to get the images.
3.Eliminate mismatches between physical file names and constants in Java code by performing consistency checks during the compile.
Most helpful rated by users:
- What is Google Web Toolkit (GWT)?
- How many modes are provided by GWT to execute application?
- What are Modules, Entry Points and HTML Pages in GWT?
- How can you set Browser targeted Compilation in GWT?
- How can we run GWT application?