List of usage examples for com.google.gwt.user.client.ui HTMLPanel wrap
public static HTMLPanel wrap(Element element)
From source file:bz.davide.dmweb.shared.view.DMGwtWidgetHostAttachHandler.java
License:Open Source License
@Override public void onAttachOrDetach(AttachEvent event) { if (event.isAttached()) { if (this.gwtWidget == null) { this.gwtWidget = this.factory.create(); }/* w w w. j av a 2 s . co m*/ (this.htmlPanel = HTMLPanel.wrap(this.widget.getElement())).add(this.gwtWidget); } else { RootPanel.detachNow(this.htmlPanel); this.htmlPanel = null; } }
From source file:cc.kune.common.client.ui.WrappedFlowPanel.java
License:GNU Affero Public License
public static WrappedFlowPanel wrap(final Element element) { final HTMLPanel parent = HTMLPanel.wrap(element); final WrappedFlowPanel child = new WrappedFlowPanel(); parent.add(child);/*from w w w . j ava 2s . c o m*/ return child; }
From source file:cc.kune.polymer.client.actions.ui.PoToolbarGui.java
License:GNU Affero Public License
@Override public AbstractGuiItem create(final GuiActionDescrip descriptor) { super.descriptor = descriptor; final String id = descriptor.getId(); if ("undefined".equals(id) || TextUtils.empty(id)) { shouldBeAdded = true;//w w w .j a v a2 s .c o m toolbar = new HTMLPanel(""); toolbar.getElement().setAttribute("horizontal", ""); toolbar.getElement().setAttribute("layout", ""); } else { // Already created (polymer) element shouldBeAdded = false; toolbar = HTMLPanel.wrap(DOM.getElementById(id)); } initWidget(toolbar); configureItemFromProperties(); descriptor.putValue(ParentWidget.PARENT_UI, this); return this; }
From source file:com.google.gwt.site.demo.AbstractDemos.java
License:Apache License
@Override public void onContentLoaded() { GQuery demos = $("//div[@id='content']//div[starts-with(@id, '" + prefix + "')]"); NodeList<Element> nodeList = demos.get(); for (int i = 0; i < nodeList.getLength(); i++) { Element item = nodeList.getItem(i); Widget demo = getDemoToLoad(item.getId().replace(prefix, "")); if (demo != null) { HTMLPanel panel = HTMLPanel.wrap(item); panel.add(demo);/*from w ww . j ava 2s . c o m*/ } } }
From source file:com.tasktop.c2c.server.profile.web.ui.client.place.HudsonHeaderPlace.java
License:Open Source License
@Override protected void handleBatchResults() { super.handleBatchResults(); project = getResult(GetProjectResult.class).get(); createBreadcrumbs(project);/*from w w w. j a v a 2s .com*/ HeaderPresenter headerPresenter = new HeaderPresenter((Header) GWT.create(Header.class)); headerPresenter.setPlace(this); Header header = headerPresenter.getView(); HTMLPanel container = HTMLPanel.wrap(Document.get().getElementById(elementId)); container.add(header); }
From source file:de.gmino.geobase.client.map.OpenLayersSmartLayer.java
public void selectedPoi(long poiId) { if (currentZoomLevel <= zoomThreshold) return;/*from w w w . j a v a 2 s .co m*/ PoiInterface poi = pois.get(poiId); if (poiTooltipDivs.containsKey(poi)) { System.out.println("Tooltip already there"); return; } Entity oAsEntity = (Entity) poi; GwtPopupCreator<PoiInterface> creator = popupCreatorMap.get(oAsEntity.getType()); if (creator == null) throw new RuntimeException("No PopupCreator for tyoe " + oAsEntity.getType().toString()); Widget widget = creator.createTooltip(poi); DivElement div = mapView.createPopup(poi.getLocation(), poi.getId() + "", 1, 1); poiTooltipDivs.put(poi, div); HTMLPanel.wrap(div).add(widget); }
From source file:de.gmino.geobase.client.map.OpenLayersSmartLayer.java
public void clickedPoi(long poiId) { System.out.println("Clicked POI, entering try-block."); try {//from w w w .j a v a 2s .c o m final PoiInterface poi = pois.get(poiId); Entity oAsEntity = (Entity) poi; GwtPopupCreator<PoiInterface> creator = popupCreatorMap.get(oAsEntity.getType()); if (creator == null) throw new RuntimeException("No PopupCreator for tyoe " + oAsEntity.getType().toString()); final Widget widget = creator.createPopup(poi); if (currentPopup != null) { currentPopup.removeFromParent(); currentPopup = null; } // TODO: This div will never be removed, but because of its size it // doesn't really matter. DivElement div = mapView.createPopup(poi.getLocation(), poi.getId() + "", 1, 1); HTMLPanel.wrap(div).add(widget); currentPopup = widget; // the popup width is not always computeted correctly the first time and simple deferring doesn't help. Therefore, we ask for the width until it seems about right before using ist. Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { int offsetWidth = widget.getOffsetWidth(); int offsetHeight = widget.getOffsetHeight(); if (offsetWidth < 160) return true; mapView.panRectIntoMap(poi.getLocation(), offsetWidth, offsetHeight, 22, 38, true); return false; } }, 100); System.out.println("Clicked POI, finished try-block."); } catch (Throwable e) { Log.exception("Handling clickedPoi", e); System.err.println("#####"); e.printStackTrace(); } }
From source file:net.scran24.user.client.Scran24.java
License:Apache License
public void initPage(final UserInfo userInfo) { final RootPanel links = RootPanel.get("navigation-bar"); Anchor watchTutorial = new Anchor(surveyMessages.navBar_tutorialVideo(), TutorialVideo.url, "_blank"); Anchor logOut = new Anchor(surveyMessages.navBar_logOut(), "../../common/logout" + Location.getQueryString()); // These divs are no longer used for content, but this code is left here // to handle legacy survey files Element se = Document.get().getElementById("suspended"); if (se != null) se.removeFromParent();/* w w w. j a v a2 s . c om*/ Element ae = Document.get().getElementById("active"); if (ae != null) ae.removeFromParent(); Element fe = Document.get().getElementById("finished"); if (fe != null) fe.removeFromParent(); Element ee = Document.get().getElementById("serverError"); if (ee != null) ee.removeFromParent(); Element fpe = Document.get().getElementById("finalPage"); if (fpe != null) fpe.removeFromParent(); mainContent = Document.get().getElementById("main-content"); mainContent.setInnerHTML(""); HTMLPanel mainContentPanel = HTMLPanel.wrap(mainContent); switch (userInfo.surveyParameters.state) { case NOT_INITIALISED: mainContentPanel .add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(surveyMessages.survey_notInitialised()))); links.add(new NavigationBar(watchTutorial, logOut)); break; case SUSPENDED: mainContentPanel.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(surveyMessages .survey_suspended(SafeHtmlUtils.htmlEscape(userInfo.surveyParameters.suspensionReason))))); links.add(new NavigationBar(watchTutorial, logOut)); break; case ACTIVE: Date now = new Date(); if (now.getTime() > userInfo.surveyParameters.endDate) { mainContentPanel .add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(surveyMessages.survey_finished()))); } else { SurveyInterfaceManager surveyInterfaceManager = new SurveyInterfaceManager(mainContentPanel); SurveyScheme scheme = SurveySchemeMap.initScheme( SurveySchemes.schemeForId(userInfo.surveyParameters.schemeName), LocaleInfo.getCurrentLocale().getLocaleName(), surveyInterfaceManager); links.add(new NavigationBar(scheme.navBarLinks(), watchTutorial, logOut)); scheme.showNextPage(); } break; } RootPanel.get("loading").getElement().removeFromParent(); initComplete(); }
From source file:net.scran24.user.client.Scran24.java
License:Apache License
public void onModuleLoad() { GWT.setUncaughtExceptionHandler(new Intake24UncaughtExceptionHandler()); // These divs are no longer used for content, but this code is left here // to handle legacy survey files final Element serverError = Document.get().getElementById("serverError"); if (serverError != null) serverError.removeFromParent();//w w w .j a v a2 s.com log.info("Fetching user information"); // This page should not be accessed unless the user is authenticated // as a respondent (see net.scran24.common.server.auth.ScranAuthFilter) loginService.getUserInfo(new AsyncCallback<Option<UserInfo>>() { @Override public void onSuccess(Option<UserInfo> result) { result.accept(new Option.SideEffectVisitor<UserInfo>() { @Override public void visitSome(final UserInfo userInfo) { CurrentUser.setUserInfo(userInfo); // Singleton portion size method for weight type-in // Inserted dynamically by client runtime but depends on // server-side configuration parameters (base image url) // so still has to be loaded once FoodLookupPrompt.preloadWeightPortionSizeMethod(new Callback() { @Override public void call() { initPage(userInfo); } }, new Callback() { @Override public void call() { HTMLPanel mainContentPanel = HTMLPanel.wrap(mainContent); mainContentPanel .add(new HTMLPanel(SafeHtmlUtils.fromString(commonMessages.serverError()))); } }); } @Override public void visitNone() { // this should never happen as any unauthenticated user // should be // redirected to the log in page, but still may happen // in some weird // case where the authentication token is lost between // the // authentication and opening this page LoginForm.showPopup(new Callback1<UserInfo>() { @Override public void call(final UserInfo userInfo) { initPage(userInfo); } }); } }); } @Override public void onFailure(Throwable caught) { HTMLPanel mainContentPanel = HTMLPanel.wrap(mainContent); mainContentPanel.add(new HTMLPanel(SafeHtmlUtils.fromString(commonMessages.serverError()))); } }); }
From source file:org.artificer.ui.client.local.pages.artifacts.CommentsPanel.java
License:Apache License
private void createComment(ArtifactCommentBean commentBean) { ParagraphElement pElement = Document.get().createPElement(); pElement.setInnerHTML(commentBean.toString()); add(HTMLPanel.wrap(pElement)); }