日期:2014-05-17 浏览次数:20823 次
/**
* This is a demonstration of all stand alone widgets in the cobogw framework.
* Each widget demo is accessible via the history token.
*/
public class WidgetsDemo implements EntryPoint {
private VerticalTabPanel panel;
private HashMap tabMap = new HashMap();
private HashMap mapTab = new HashMap();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
panel = new VerticalTabPanel();
RootPanel.get("content").add(panel);
panel.add(RoundedPanelDemo.getLazy(), rt("RoundedPanel"));
panel.add(ButtonDemo.getLazy(), rt("Button"));
panel.add(ButtonConfigurator.getLazy(), rt("Button CSS generator", "ButtonConfigurator"));
panel.add(RatingDemo.getLazy(), rt("Rating"));
panel.add(VerticalTabPanelDemo.getLazy(), rt("VerticalTabPanel"));
panel.add(MiscDemo.getLazy(), rt("Misc"));
panel.addSelectionHandler(new SelectionHandler() {
public void onSelection(SelectionEvent event) {
History.newItem(mapTab.get(event.getSelectedItem()), false);
}
});
History.addValueChangeHandler(new ValueChangeHandler() {
public void onValueChange(ValueChangeEvent event) {
onHistoryChange(event.getValue());
}
});
String initToken = History.getToken();
if (initToken.length() > 0) {
onHistoryChange(initToken);
} else {
onHistoryChange("RoundedPanel");
}
}
private Widget rt(String tab) {
return rt(tab, tab);
}
private Widget rt(String tab, String token) {
tabMap.put(token, panel.getWidgetCount());
mapTab.put(panel.getWidgetCount(), token);
return new RoundedPanel(new Label(tab), RoundedPanel.LEFT);
}
private void onHi