}
});
topBar.addMember(sgwtHomeButton);
topBar.addSpacer(6);
Label title = new Label("Smart GWT Showcase");
title.setStyleName("sgwtTitle");
title.setWidth(300);
topBar.addMember(title);
topBar.addFill();
ToolStripButton devConsoleButton = new ToolStripButton();
devConsoleButton.setTitle("Developer Console");
devConsoleButton.setIcon("silk/bug.png");
devConsoleButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent event) {
SC.showConsole();
}
});
topBar.addButton(devConsoleButton);
topBar.addSeparator();
ImgButton imgButton = new ImgButton();
imgButton.setWidth(18);
imgButton.setHeight(18);
imgButton.setSrc("silk/emoticon.png");
imgButton.setShowFocused(false);
imgButton.setShowFocusedIcon(false);
imgButton.setPrompt("I'm feeling lucky");
imgButton.setHoverWidth(110);
imgButton.setHoverStyle("interactImageHover");
imgButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent event) {
ExplorerTreeNode[] data = sideNav.getShowcaseData();
int size = data.length;
for (int i = 0; i < 15; i++) {
int sampleIndex = (int) (size * java.lang.Math.random());
ExplorerTreeNode sample = data[sampleIndex];
if (sample.getFactory() != null && !(sample instanceof CommandTreeNode)) {
showSample(sample);
break;
}
}
}
});
topBar.addMember(imgButton);
topBar.addSpacer(6);
main.addMember(topBar);
main.setWidth100();
main.setHeight100();
main.setStyleName("tabSetContainer");
HLayout hLayout = new HLayout();
hLayout.setLayoutMargin(5);
hLayout.setWidth100();
hLayout.setHeight100();
VLayout sideNavLayout = new VLayout();
sideNavLayout.setHeight100();
sideNavLayout.setWidth(185);
sideNavLayout.setShowResizeBar(true);
sideNav = new SideNavTree();
sideNav.addLeafClickHandler(new LeafClickHandler() {
public void onLeafClick(LeafClickEvent event) {
TreeNode node = event.getLeaf();
showSample(node);
}
});
sideNavLayout.addMember(sideNav);
hLayout.addMember(sideNavLayout);
mainTabSet = new TabSet();
Layout paneContainerProperties = new Layout();
paneContainerProperties.setLayoutMargin(0);
paneContainerProperties.setLayoutTopMargin(1);
mainTabSet.setPaneContainerProperties(paneContainerProperties);
mainTabSet.setWidth100();
mainTabSet.setHeight100();
mainTabSet.addTabSelectedHandler(new TabSelectedHandler() {
public void onTabSelected(TabSelectedEvent event) {
Tab selectedTab = event.getTab();
String historyToken = selectedTab.getAttribute("historyToken");
if (historyToken != null) {
History.newItem(historyToken, false);
} else {
History.newItem("main", false);
}
}
});
LayoutSpacer layoutSpacer = new LayoutSpacer();
layoutSpacer.setWidth(5);
SelectItem selectItem = new SelectItem();
selectItem.setHeight(21);
selectItem.setWidth(130);
LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
valueMap.put("EnterpriseBlue", "Enterprise Blue");
valueMap.put("Enterprise", "Enterprise Gray");
valueMap.put("Graphite", "Graphite");
valueMap.put("Simplicity", "Simplicity");
selectItem.setValueMap(valueMap);
final String skinCookieName = "skin_name_2_4";
String currentSkin = Cookies.getCookie(skinCookieName);
if (currentSkin == null) {
currentSkin = "Enterprise";
}
selectItem.setDefaultValue(currentSkin);
selectItem.setShowTitle(false);
selectItem.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
Cookies.setCookie(skinCookieName, (String) event.getValue());
com.google.gwt.user.client.Window.Location.reload();
}
});
DynamicForm form = new DynamicForm();
form.setPadding(0);
form.setMargin(0);
form.setCellPadding(1);
form.setNumCols(1);
form.setFields(selectItem);
mainTabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, layoutSpacer, form);
contextMenu = createContextMenu();
Tab tab = new Tab();
tab.setTitle("Home ");
tab.setIcon("pieces/16/cube_green.png", 16);
tab.setWidth(80);
HLayout mainPanel = new HLayout();
mainPanel.setHeight100();
mainPanel.setWidth100();
TileView tileView = new TileView(mainPanel);
mainPanel.addMember(tileView);
tab.setPane(mainPanel);
mainTabSet.addTab(tab);
Canvas canvas = new Canvas();
canvas.setBackgroundImage("[SKIN]/shared/background.gif");
canvas.setWidth100();
canvas.setHeight100();
canvas.addChild(mainTabSet);
hLayout.addMember(canvas);
main.addMember(hLayout);
if (SC.hasFirebug()) {
Label label = new Label();
label.setWidth100();
label.setHeight(50);
label.setValign(VerticalAlignment.CENTER);
label.setAlign(Alignment.CENTER);
label.setContents("Firebug can make the Showcase run slow. For the best performance, we suggest disabling Firebug for this site.");
Window fbWindow = new Window();
fbWindow.setTitle("Firebug Detected");
fbWindow.setWidth100();
fbWindow.setHeight(80);