List of usage examples for com.google.gwt.dom.client UListElement setId
@Override
public void setId(String id)
From source file:io.reinert.requestor.examples.showcase.Showcase.java
License:Apache License
@Override public void onModuleLoad() { // Populate the menu final Element menu = Document.get().getElementById("menu-list"); for (MenuOption o : MenuOption.values()) { if (o != MenuOption.HOME) { if (o.isGroup()) { AnchorElement a = Document.get().createAnchorElement(); a.getStyle().setCursor(Style.Cursor.POINTER); a.setClassName("dropdown-toggle"); a.setAttribute("role", "button"); a.setAttribute("data-toggle", "dropdown"); a.setInnerHTML(o.getLabel() + " <span class=\"caret\"></span>"); UListElement ul = Document.get().createULElement(); ul.setClassName("dropdown-menu"); ul.setAttribute("role", "menu"); ul.setId(getMenuGroupId(o)); LIElement li = Document.get().createLIElement(); li.setClassName("dropdown"); li.appendChild(a);//from w w w . ja va 2 s . c o m li.appendChild(ul); menu.appendChild(li); } else { AnchorElement a = Document.get().createAnchorElement(); a.setInnerText(o.getLabel()); a.setHref("#" + o.getToken()); LIElement li = Document.get().createLIElement(); li.appendChild(a); if (o.hasParent()) { MenuOption parent = o.getParent(); UListElement ul = (UListElement) Document.get().getElementById(getMenuGroupId(parent)); ul.appendChild(li); } else { menu.appendChild(li); } } } } final SimplePanel container = new SimplePanel(); container.setStyleName("container requestor-showcase-container"); RootPanel.get().add(container); // Main Factory (Dependency Injector) ShowcaseClientFactory clientFactory = CLIENT_FACTORY; EventBus eventBus = clientFactory.getEventBus(); PlaceController placeController = clientFactory.getPlaceController(); // Activity-Place binding ActivityMapper activityMapper = new ShowcaseActivityMapper(); ActivityManager activityManager = new ActivityManager(activityMapper, eventBus); activityManager.setDisplay(container); // Place-History binding PlaceHistoryMapper historyMapper = new ShowcasePlaceHistoryMapper(); PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); historyHandler.register(placeController, eventBus, defaultPlace); // Add Loading widget RootPanel.get().add(new Loading(eventBus)); // Goes to place represented on URL or default place historyHandler.handleCurrentHistory(); }