GWT Interview Questions and Answers For Freshers Part-3
21.What is the purpose of Host Page?
The most important public resource is host page which is used to invoke actual GWT application. A typical HTML host page for an application might not include any visible HTML body content at all but it is always expected to include GWT application via a <script…/> tag.
22.What is the default style name of any GWT widget?
By default, the class name for each component is gwt-<classname>. For example, the Button widget has a default style of gwt-Button and similar way TextBox widgest has a default style of gwt-TextBox.
23.Do GWT compiler creates default Id attribute for its Widget by default?
No! By default, neither the browser nor GWT creates default id attributes for widgets.
24.What is the purpose of setStyleName() function of a GWT widget?
This method will clear any existing styles and set the widget style to the new CSS class provided using style.
25.What is the purpose of addStyleName() function of a GWT widget?
This method will add a secondary or dependent style name to the widget. A secondary style name is an additional style name that is,so if there were any previous style names applied they are kept.
26.What is the purpose of removeStyleName() function of a GWT widget?
This method will remove given style from the widget and leaves any others associated with the widget.
27.What is the purpose of getStyleName() function of a GWT widget?
This method gets all of the object’s style names, as a space-separated list.
28.What is the purpose of setStylePrimaryName() function of a GWT widget?
This method sets the object’s primary style name and updates all dependent style names.
29.What is the difference between primary style and secondary styles of a GWT Widget?
By default, the primary style name of a widget will be the default style name for its widget class. For example, gwt-Button for Button widgets. When we add and remove style names using AddStyleName() method, those styles are called secondary styles.
The final appearance of a widget is determined by the sum of all the secondary styles added to it, plus its primary style. You set the primary style of a widget with the setStylePrimaryName(String) method.
30.How you can attach a CSS file with your GWT module?
There are multiple approaches for associating CSS files with your module. Modern GWT applications typically use a combination of CssResource and UiBinder.
Using a <link> tag in the host HTML page.
Using the <stylesheet> element in the module XML file.
Using a CssResource contained within a ClientBundle.
Using an inline <ui:style> element in a UiBinder template.