List of usage examples for com.google.gwt.user.client.ui HTMLPanel add
@Override public void add(Widget widget)
From source file:org.ednovo.gooru.client.uc.StandardsPopupVc.java
License:Open Source License
/** * /*from www . ja v a 2s .c o m*/ * @function setStandards * * @created_date : Aug 2, 2013 * * @description * * * @parm(s) : {Will be used standards} * * @return : void * * @throws : <Mentioned if any exceptions> * * * * */ private void setStandards() { int count = 0; if (iterator != null) { while (this.iterator.hasNext()) { Map<String, String> standard = this.iterator.next(); String stdCode = standard.get(STANDARD_CODE); String stdDec = standard.get(STANDARD_DESCRIPTION); final HTMLPanel standardsPanel = new HTMLPanel(""); standardsPanel.setStyleName(UcCBundle.INSTANCE.css().divContainer()); standardsPanel.getElement().getStyle().setMarginBottom(5, Unit.PX); final Label standardsLabel = new Label(stdCode); standardsLabel.setStyleName(UcCBundle.INSTANCE.css().searchStandard()); final Label standardsDescLabel = new Label(stdDec); standardsDescLabel.setStyleName(UcCBundle.INSTANCE.css().standardsDesc()); standardsPanel.add(standardsLabel); standardsPanel.add(standardsDescLabel); mainHtmlPanel.add(standardsPanel); count++; } } else { } }
From source file:org.eurekastreams.web.client.ui.pages.discover.DiscoverListItemPanel.java
License:Apache License
/** * Constructor.//from w w w . j a va 2 s . c o m * * @param inStreamDTO * the streamDTO to represent * @param inListItemType * list item type * @param showBlockSuggestion * show block suggestion controls. */ public DiscoverListItemPanel(final StreamDTO inStreamDTO, final ListItemType inListItemType, final boolean showBlockSuggestion) { coreCss = StaticResourceBundle.INSTANCE.coreCss(); HTMLPanel main = (HTMLPanel) binder.createAndBindUi(this); initWidget(main); // set text and link for name; assume group if not person Page linkPage = (inStreamDTO.getEntityType() == EntityType.PERSON) ? Page.PEOPLE : Page.GROUPS; String nameUrl = Session.getInstance().generateUrl(// new CreateUrlRequest(linkPage, inStreamDTO.getUniqueId())); streamNameLink.setTargetHistoryToken(nameUrl); streamNameLink.setText(inStreamDTO.getDisplayName()); streamNameLink.setTitle(inStreamDTO.getDisplayName()); // set info text switch (inListItemType) { case MUTUAL_FOLLOWERS: if (inStreamDTO.getFollowersCount() == 1) { streamInfoText.setInnerText("1 Mutual Follower"); } else { streamInfoText .setInnerText(Integer.toString(inStreamDTO.getFollowersCount()) + " Mutual Followers"); } break; case DAILY_VIEWERS: if (inStreamDTO.getFollowersCount() == 1) { streamInfoText.setInnerText("1 Daily Viewer"); } else { streamInfoText.setInnerText(Integer.toString(inStreamDTO.getFollowersCount()) + " Daily Viewers"); } break; case FOLLOWERS: if (inStreamDTO.getFollowersCount() == 1) { streamInfoText.setInnerText("1 Follower"); } else { streamInfoText.setInnerText(Integer.toString(inStreamDTO.getFollowersCount()) + " Followers"); } break; case TIME_AGO: DateFormatter dateFormatter = new DateFormatter(new Date()); streamInfoText.setInnerText(dateFormatter.timeAgo(inStreamDTO.getDateAdded(), true)); break; default: break; } // add following controls if not the current person if (inStreamDTO.getEntityType() != EntityType.PERSON || inStreamDTO.getEntityId() != Session.getInstance().getCurrentPerson().getEntityId()) { final FollowPanel followPanel; ClickHandler clickHandler = null; if (showBlockSuggestion) { // NOTE: this is a hack - this doesn't have anything to do with blocking suggestions, it just happens // that the only list that removes streams after joining them happens to be the one that allows streams // to be blocked clickHandler = new ClickHandler() { public void onClick(final ClickEvent event) { removeFromParent(); } }; } // it's not the current user - see if it's a private group, and if we're not admin if (inStreamDTO.getEntityType() == EntityType.GROUP && inStreamDTO instanceof DomainGroupModelView && ((DomainGroupModelView) inStreamDTO).isPublic() != null && !((DomainGroupModelView) inStreamDTO).isPublic() && !Session.getInstance().getCurrentPerson().getRoles().contains(Role.SYSTEM_ADMIN)) { // this is a private group and we're not an admin, so we gotta request access // note: no click handler since you can't join this group - just show it as pending followPanel = new FollowPanel(inStreamDTO, style.requestButton(), style.unfollowButton(), coreCss.buttonLabel(), true, style.pendingButton()); } else { // either not a private group, or we're admin and it doesn't matter - just show join/unjoin followPanel = new FollowPanel(inStreamDTO, style.followButton(), style.unfollowButton(), coreCss.buttonLabel(), true, clickHandler, null); } if (!showBlockSuggestion) { followPanel.addStyleName(style.followControlsPanel()); main.add(followPanel); } else { Panel panel = new FlowPanel(); panel.addStyleName(style.followControlsPanel()); panel.addStyleName(style.multi()); panel.add(followPanel); final Label block = new Label(); block.addStyleName(style.blockButton()); block.setTitle("Block this suggestion"); block.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent arg0) { if (jsniFacade.confirm("Are you sure you want to block this suggestion?")) { BlockedSuggestionModel.getInstance().insert(inStreamDTO.getStreamScopeId()); removeFromParent(); } } }); panel.add(block); main.add(panel); } } }
From source file:org.geomajas.quickstart.gwt2.client.widget.info.InfoPanel.java
License:Open Source License
/** * Init the info panel./*w w w .j a v a 2 s .c om*/ */ private void initInfoPanel() { infoPopupPanel.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanel()); HTMLPanel infoPopupPanelWrapper = new HTMLPanel(""); closeInfoPopupPanelButton.addStyleName(ApplicationResource.INSTANCE.css().closePopupPanelButton()); closeInfoPopupPanelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { infoPopupPanel.hide(); ApplicationService.getInstance().setTooltipShowingAllowed(true); } }); HTMLPanel closeInfoButtonContainer = new HTMLPanel(""); closeInfoButtonContainer.addStyleName(ApplicationResource.INSTANCE.css().popupPanelHeader()); Label infoTitle = new Label(msg.infoPanelTitle()); closeInfoButtonContainer.add(infoTitle); closeInfoButtonContainer.add(closeInfoPopupPanelButton); infoPopupPanelWrapper.add(closeInfoButtonContainer); infoPopupPanelContent = new HTMLPanel(""); infoPopupPanelContent.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanelContent()); ScrollPanel infoPopupPanelScroll = new ScrollPanel(); infoPopupPanelScroll.addStyleName(ApplicationResource.INSTANCE.css().infoPopupPanelScroll()); infoPopupPanelScroll.add(infoPopupPanelContent); infoPopupPanelWrapper.add(infoPopupPanelScroll); infoPopupPanel.add(infoPopupPanelWrapper); infoPopupPanel.hide(); }
From source file:org.geomajas.quickstart.gwt2.client.widget.layer.LayerLegend.java
License:Open Source License
/** * Get a fully build layer legend for a LayersModel. * * @param layerPopupPanelContent Original HTMLPanel * @param layersModel LayersModel of the map * @return HTMLPanel fully build legend. *///w w w .j a v a2 s. c o m private HTMLPanel getLayersLegend(HTMLPanel layerPopupPanelContent, LayersModel layersModel) { for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) { HTMLPanel layer = new HTMLPanel(""); CheckBox visible = new CheckBox(); final int finalI = i; visible.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (mapPresenter.getLayersModel().getLayer(finalI).isMarkedAsVisible()) { mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(false); } else { mapPresenter.getLayersModel().getLayer(finalI).setMarkedAsVisible(true); } } }); if (mapPresenter.getLayersModel().getLayer(i).isMarkedAsVisible()) { visible.setValue(true); } InlineLabel layerName = new InlineLabel(mapPresenter.getLayersModel().getLayer(i).getTitle()); layer.add(visible); layer.add(layerName); layerPopupPanelContent.add(layer); //////////////////////////////// // Add legend items //////////////////////////////// Layer legendLayer = mapPresenter.getLayersModel().getLayer(i); if (legendLayer instanceof VectorServerLayerImpl) { VectorServerLayerImpl serverLayer = (VectorServerLayerImpl) legendLayer; String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl(); NamedStyleInfo styleInfo = serverLayer.getLayerInfo().getNamedStyleInfo(); String name = serverLayer.getLayerInfo().getNamedStyleInfo().getName(); int x = 0; for (FeatureTypeStyleInfo sfi : styleInfo.getUserStyle().getFeatureTypeStyleList()) { for (RuleInfo rInfo : sfi.getRuleList()) { UrlBuilder url = new UrlBuilder(legendUrl); url.addPath(serverLayer.getServerLayerId()); url.addPath(name); url.addPath(x + ".png"); x++; HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); layout.add(new Image(url.toString())); Label labelUi = new Label(rInfo.getName()); labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX); layout.add(labelUi); layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX); layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX); layerPopupPanelContent.add(layout); } } } else if (legendLayer instanceof RasterServerLayerImpl) { RasterServerLayerImpl serverLayer = (RasterServerLayerImpl) legendLayer; String legendUrl = GeomajasServerExtension.getInstance().getEndPointService().getLegendServiceUrl(); UrlBuilder url = new UrlBuilder(legendUrl); url.addPath(serverLayer.getServerLayerId() + ".png"); HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); layout.add(new Image(url.toString())); Label labelUi = new Label(""); labelUi.getElement().getStyle().setMarginLeft(5, Style.Unit.PX); layout.add(labelUi); layout.getElement().getStyle().setMarginLeft(20, Style.Unit.PX); layout.getElement().getStyle().setMarginTop(3, Style.Unit.PX); layerPopupPanelContent.add(layout); } } return layerPopupPanelContent; }
From source file:org.geomajas.quickstart.gwt2.client.widget.layer.LayerLegend.java
License:Open Source License
/** * Init the layer legend panel./* ww w . jav a2s. c om*/ */ private void initLayerLegend() { HTMLPanel layerPopupPanelWrapper = new HTMLPanel(""); closeLayerPopupPanelButton.addStyleName(ApplicationResource.INSTANCE.css().closePopupPanelButton()); closeLayerPopupPanelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { layerLegendPanel.hide(); ApplicationService.getInstance().setTooltipShowingAllowed(true); } }); HTMLPanel closeLayerButtonContainer = new HTMLPanel(""); closeLayerButtonContainer.addStyleName(ApplicationResource.INSTANCE.css().popupPanelHeader()); Label layerTitle = new Label(msg.layerLegendPanelTitle()); closeLayerButtonContainer.add(layerTitle); closeLayerButtonContainer.add(closeLayerPopupPanelButton); layerPopupPanelWrapper.add(closeLayerButtonContainer); HTMLPanel layerPopupPanelContent = new HTMLPanel(""); layerPopupPanelContent.addStyleName(ApplicationResource.INSTANCE.css().layerPopupPanelContent()); // Add a generated layers legend. layerPopupPanelWrapper.add(getLayersLegend(layerPopupPanelContent, mapPresenter.getLayersModel())); layerLegendPanel.add(layerPopupPanelWrapper); }
From source file:org.geosdi.geoplatform.gui.client.widget.NotifyListPanel.java
License:Open Source License
public NotifyListPanel(final List<SingleNotify> listComponent, final DeckLayoutPanel deckLayoutPanel) { this.listComponent = listComponent; initWidget(uiBinder.createAndBindUi(this)); ScrollPanel scrollPanel = new ScrollPanel(); HTMLPanel newsPanel = new HTMLPanel(""); newsPanel.setWidth("100%"); newsPanel.setHeight("100%"); scrollPanel.setSize("400px", "250px"); for (int i = 0; i < listComponent.size(); i++) { final int j = i + 1; SingleNotify singleNotify = listComponent.get(i); singleNotify.setIndex(j);/*from w ww . j a v a 2 s . c o m*/ singleNotify.setStyleName(style.singleNews(), true); deckLayoutPanel.insert(new NotifyMessagePanel(listComponent.get(i)), j); singleNotify.addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deckLayoutPanel.setAnimationDuration(300); deckLayoutPanel.showWidget((j)); } }, ClickEvent.getType()); newsPanel.add(singleNotify); } scrollPanel.add(newsPanel); centerPanel.add(scrollPanel); }
From source file:org.nsesa.editor.gwt.an.drafting.client.ui.main.document.outline.OutlineController.java
License:EUPL
public void setRootOverlayWidget(OverlayWidget rootOverlayWidget) { this.rootOverlayWidget = rootOverlayWidget; final VerticalPanel outlinePanel = new VerticalPanel(); rootOverlayWidget.walk(new OverlayWidgetWalker.DefaultOverlayWidgetVisitor() { @Override//from ww w . j a v a2 s. c o m public boolean visit(final OverlayWidget visited) { if (visited instanceof BasehierarchyComplexType) { String unformattedIndex = visited.getUnformattedIndex(); if (unformattedIndex == null) unformattedIndex = Integer.toString(visited.getTypeIndex() + 1); final String repeat = TextUtils.repeat(visited.getParentOverlayWidgets().size() * 2, " "); String heading = ""; // see if there's a heading for (final OverlayWidget child : visited.getChildOverlayWidgets()) { if ("heading".equalsIgnoreCase(child.getType())) { heading = " <i>" + child.asWidget().getElement().getInnerText() + "</i>"; break; } } final InlineHTML index = new InlineHTML( repeat + TextUtils.capitalize(visited.getType()) + " " + unformattedIndex); final InlineHTML description = new InlineHTML(heading); description.getElement().getStyle().setTextOverflow(Style.TextOverflow.ELLIPSIS); description.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN); description.getElement().getStyle().setFontStyle(Style.FontStyle.ITALIC); // description.getElement().getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP); HTMLPanel both = new HTMLPanel(""); both.add(index); both.add(description); final FocusPanel w = new FocusPanel(both); w.getElement().getStyle().setPadding(5, Style.Unit.PX); outlinePanel.add(w); w.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (documentController != null) { documentController.getSourceFileController().scrollTo(visited.asWidget()); } } }); return !(visited.getParentOverlayWidget() instanceof HierarchyComplexType); } return true; } }); outlinePanel.getElement().getStyle().setTableLayout(Style.TableLayout.FIXED); outlinePanel.getElement().getStyle().setTextOverflow(Style.TextOverflow.ELLIPSIS); this.view.setOutlinePanel(outlinePanel); }
From source file:org.nsesa.editor.gwt.core.client.ui.overlay.document.OverlayWidgetImpl.java
License:EUPL
@Override public void addOverlayWidgetAware(final OverlayWidgetAware amendment) { if (amendment == null) throw new NullPointerException("Cannot add null amendment controller!"); boolean vetoed = false; if (listener != null) vetoed = listener.beforeOverlayWidgetAwareAdded(this, amendment); if (!vetoed) { if (overlayWidgetAwareList.contains(amendment)) { throw new RuntimeException("Amendment already exists: " + amendment); }/*from w ww .ja v a 2 s . co m*/ if (!overlayWidgetAwareList.add(amendment)) { throw new RuntimeException("Could not add amendment controller: " + amendment); } amendment.setOverlayWidget(this); // physical attach final HTMLPanel holderElement = getAmendmentControllersHolderElement(); if (holderElement != null) { holderElement.add(amendment.getView()); // inform the listener if (listener != null) listener.afterOverlayWidgetAwareAdded(this, amendment); } else { LOG.severe("No amendment holder panel could be added for this widget " + this); } } else { LOG.info("OverlayWidget listener veto'ed the adding of the amendment controller."); } }
From source file:org.opendatakit.aggregate.client.popups.AuditCSVPopup.java
License:Apache License
public AuditCSVPopup(String keyString) { super();//from www . j a va 2 s. c o m String[] parts = keyString.split("\\?"); if (parts.length != 2) throw new RuntimeException("blobKey missing in keyString"); String blobKey = parts[1].split("=")[1]; setTitle("Audit CSV"); int width = Window.getClientWidth() / 2; int height = Window.getClientHeight() / 2; final HTMLPanel panel = new HTMLPanel(""); panel.add(new SimplePanel(new ClosePopupButton(this))); panel.add(new HTML("<h2>Audit CSV contents</h2>")); panel.setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME); panel.getElement().getStyle().setProperty("overflow", "scroll"); panel.setPixelSize(width + 6, height + 30); setWidget(panel); AsyncCallback<String> callback = new AsyncCallback<String>() { public void onFailure(Throwable caught) { AggregateUI.getUI().reportError(caught); } public void onSuccess(String csvContents) { String[] allLines = csvContents.split("\n"); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant("<table class=\"dataTable\">") .appendHtmlConstant("<tr class=\"titleBar\">") .appendHtmlConstant("<td>Event</td><td>Node</td><td>Start</td><td>End</td>") .appendHtmlConstant("</tr>"); for (int i = 1, max = allLines.length; i < max; i++) { builder.append(Row.from(allLines[i]).asTr()); } builder.appendHtmlConstant("</table>"); AggregateUI.getUI().clearError(); panel.add(new HTML(builder.toSafeHtml())); AggregateUI.resize(); } }; SecureGWT.getSubmissionService().getSubmissionAuditCSV(blobKey, callback); }
From source file:org.opendatakit.aggregate.client.popups.VisualizationPopup.java
License:Apache License
private MapWidget createMap() { int latIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LATITUDE_ORDINAL_NUMBER); int lonIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LONGITUDE_ORDINAL_NUMBER); // check to see if we have lat & long, if not display erro if (latIndex < 0 || lonIndex < 0) { String error = "ERROR:"; if (latIndex < 0) { error = error + " The Latitude Coordinate is NOT included in the Filter."; }/*from w ww . j av a 2 s . c om*/ if (lonIndex < 0) { error = error + " The Longitude Coordinate is NOT included in the Filter."; } Window.alert(error); return null; } // create a center point, stop at the first gps point found LatLng center = new LatLng(0.0, 0.0); for (SubmissionUI sub : submissions) { LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub); if (gpsPoint != null) { center = gpsPoint; break; } } // create mapping area final MapOptions options = new MapOptions(); options.setCenter(center); MapTypeId id = new MapTypeId(); options.setMapTypeId(id.getRoadmap()); options.setZoom(6); options.setMapTypeControl(true); options.setNavigationControl(true); options.setScaleControl(true); final MapWidget mapWidget = new MapWidget(options); mapWidget.setSize("100%", "100%"); final HasMap map = mapWidget.getMap(); // create the markers for (SubmissionUI sub : submissions) { LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub); if (gpsPoint != null) { final Marker marker = new Marker(); marker.setPosition(gpsPoint); marker.setMap(map); // marker needs to be added to the map before calling // InfoWindow.open(marker, ...) final SubmissionUI tmpSub = sub; Event.addListener(marker, "mouseover", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { if (infoWindow != null) { infoWindow.close(); } infoWindow = new InfoWindow(); InfoContentSubmission w = createInfoWindowWidget(tmpSub); HTMLPanel container = new HTMLPanel("<div></div>"); container.add(w); infoWindow.setContent(container.getElement().getInnerHTML()); infoWindow.open(map, marker); } }); Event.addListener(marker, "mouseout", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { if (!mapMarkerClicked) { if (infoWindow != null) { infoWindow.close(); infoWindow = null; } } mapMarkerClicked = false; } }); Event.addListener(marker, "click", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { mapMarkerClicked = true; } }); } } return mapWidget; }