List of usage examples for com.google.gwt.user.client.ui Widget addStyleName
public void addStyleName(String style)
From source file:com.google.code.p.gwtcsample.client.GWTCSample.java
License:Apache License
private Panel createPanelWithDescription(Widget widget, String description) { FlexTable panel = new FlexTable(); panel.addStyleName("descrPanel"); Label label = new Label(description); label.setStyleName("descrLabel"); panel.setWidget(0, 0, label);/* ww w . j a v a 2 s.c o m*/ panel.setWidget(0, 1, widget); panel.getCellFormatter().setWidth(0, 1, "100%"); panel.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); widget.addStyleName("descrWidget"); return panel; }
From source file:com.google.gerrit.client.ui.LinkMenuBar.java
License:Apache License
public void add(final Widget i) { if (body.getWidgetCount() > 0) { final Widget p = body.getWidget(body.getWidgetCount() - 1); p.addStyleName(Gerrit.RESOURCES.css().linkMenuItemNotLast()); }/*from w w w . j a va 2 s . c o m*/ body.add(i); }
From source file:com.google.livingstories.client.lsp.views.contentitems.LinkedViewFactory.java
License:Apache License
public static Widget createView(BaseContentItem contentItem, Set<Long> containerContributorIds) { Widget widget = null; switch (contentItem.getContentItemType()) { case BACKGROUND: case DATA:/*from w ww . j a v a2 s.c o m*/ case REACTION: widget = new ContentItemPreviewWithHeader(contentItem); break; case NARRATIVE: widget = new NarrativeContentItemView((NarrativeContentItem) contentItem, containerContributorIds); break; case QUOTE: widget = new QuoteContentItemView((QuoteContentItem) contentItem); break; case PLAYER: widget = new BasePlayerPreview((PlayerContentItem) contentItem); break; case ASSET: AssetContentItem asset = (AssetContentItem) contentItem; switch (asset.getAssetType()) { case LINK: widget = new LinkAssetPreview(asset); break; case DOCUMENT: widget = new DocumentAssetPreview(asset); break; case AUDIO: widget = new AudioAssetView(asset); break; case INTERACTIVE: widget = new GraphicAssetPreview(asset); break; case VIDEO: widget = new VideoAssetPreview(asset); break; case IMAGE: // getRelatedAssets() will return a list that includes the current asset. // So we only make a slideshow if there's more than 1 asset in the list. if (asset.getRelatedAssets() != null && asset.getRelatedAssets().size() > 1) { widget = new SlideshowPreview(asset); } else { widget = new ImageAssetPreview(asset); } break; default: throw new IllegalArgumentException( "Asset type " + asset.getAssetType() + " does not have a linked view defined."); } break; default: throw new IllegalArgumentException("Content item type " + contentItem.getContentItemType() + " does not have a linked view defined."); } widget.addStyleName(Resources.INSTANCE.css().linkedItemSpacing()); return widget; }
From source file:com.google.livingstories.client.ui.ButtonListWidget.java
License:Apache License
public void selectItem(int index) { for (int i = 0; i < container.getWidgetCount(); i++) { Widget widget = container.getWidget(i); if (i == index) { widget.addStyleName("selectedButtonListItem"); } else {/*from w ww.j av a 2s. c o m*/ widget.removeStyleName("selectedButtonListItem"); } } }
From source file:com.google.livingstories.client.ui.Filmstrip.java
License:Apache License
public void navigate(int newIndex) { if (currentIndex >= 0) { Widget currentWidget = contentPanel.getWidget(currentIndex); currentWidget.removeStyleName("filmstrip-current"); }/*from w ww . java2s . c o m*/ Widget newWidget = contentPanel.getWidget(newIndex); newWidget.addStyleName("filmstrip-current"); Range visibleItemRange = getVisibleItemRange(newIndex); clippingPane.setWidth(TOTAL_ITEM_WIDTH * (visibleItemRange.getExtent()) + CURRENT_ITEM_BORDER + "px"); StyleEffect slide = new StyleEffect(contentPanel, "left", -TOTAL_ITEM_WIDTH * visibleItemRange.start); slide.run(500); currentIndex = newIndex; if (currentIndex == 0) { previousArrow.setUrl(DISABLED_PREVIOUS_ARROW); } else { previousArrow.setUrl(ENABLED_PREVIOUS_ARROW); } if (currentIndex == contentPanel.getWidgetCount() - 1) { nextArrow.setUrl(DISABLED_NEXT_ARROW); } else { nextArrow.setUrl(ENABLED_NEXT_ARROW); } onNavigate(currentIndex); }
From source file:com.google.livingstories.client.ui.PartialDisclosurePanel.java
License:Apache License
/** * Sets the content widget which can be opened and closed by this panel. If * there is a preexisting content widget, it will be detached. * //www . ja v a2 s . co m * @param content the widget to be used as the content panel * @param toggledWidgets items that will be shown and hidden by this panel. */ public void setContent(Widget content, List<Widget> toggledWidgets) { final Widget currentContent = getContent(); // Remove existing content widget. if (currentContent != null) { contentWrapper.setWidget(null); this.toggledWidgets = null; currentContent.removeStyleName(STYLENAME_CONTENT); } // Add new content widget if != null. if (content != null) { contentWrapper.setWidget(content); this.toggledWidgets = toggledWidgets; content.addStyleName(STYLENAME_CONTENT); } }
From source file:com.google.livingstories.client.ui.richtexttoolbar.RichTextToolbar.java
License:Apache License
private void addControlToToolbar(HorizontalPanel toolbar, Widget w, String styleName) { w.addStyleName(styleName); toolbar.add(w); }
From source file:com.google.livingstories.client.ui.ToggleDisclosurePanel.java
License:Apache License
/** * Sets the content widget which can be opened and closed by this panel. If * there is a preexisting content widget, it will be detached. * //from w ww.j a v a2 s. co m * @param closedContent the widget to show in the closed state * @param openedContent the widget to show in the opened state */ public void setContent(Widget closedContent, Widget openedContent) { final Widget currentContent = getContent(); // Remove existing content widget. if (currentContent != null) { contentWrapper.setWidget(null); closedWidget = null; openedWidget = null; } // Add new content widget if != null. if (closedContent != null) { closedWidget = closedContent; openedWidget = openedContent; if (openedContent == null) { isOpen = false; } else { openedContent.addStyleName(STYLENAME_CONTENT); } closedContent.addStyleName(STYLENAME_CONTENT); contentWrapper.setWidget(isOpen ? openedContent : closedContent); } }
From source file:com.google.sampling.experiential.client.ExperimentDefinitionPanel.java
License:Open Source License
private void addErrorHighlight(Widget widget) { widget.addStyleName(Main.ERROR_HIGHLIGHT); }
From source file:com.google.testing.testify.risk.frontend.client.view.impl.ProjectDataViewImpl.java
License:Apache License
public void displayData(List<UploadedDatum> data) { if (data.size() == 0) { dataSummary.setText("No items have been uploaded."); return;//from w w w . jav a 2 s . c om } UploadedDatum firstItem = data.get(0); dataSummary .setText("Showing " + Integer.toString(data.size()) + " " + firstItem.getDatumType().getPlural()); dataGrid.clear(); // Header row + one for each bug x datum, Attribute, Component, Capability dataGrid.resize(data.size() + 1, 4); // Set grid headers. dataGrid.setWidget(0, 0, new Label(firstItem.getDatumType().getPlural())); dataGrid.setWidget(0, 1, new Label("Attribute")); dataGrid.setWidget(0, 2, new Label("Component")); dataGrid.setWidget(0, 3, new Label("Capability")); dataGrid.getWidget(0, 0).addStyleName(GRID_HEADER_CSS_STYLE); dataGrid.getWidget(0, 1).addStyleName(GRID_HEADER_CSS_STYLE); dataGrid.getWidget(0, 2).addStyleName(GRID_HEADER_CSS_STYLE); dataGrid.getWidget(0, 3).addStyleName(GRID_HEADER_CSS_STYLE); // Fill with data. for (int i = 0; i < data.size(); i++) { UploadedDatum datum = data.get(i); String host = LinkUtil.getLinkHost(datum.getLinkUrl()); Widget description; if (host != null) { HorizontalPanel panel = new HorizontalPanel(); Anchor anchor = new Anchor(datum.getLinkText(), datum.getLinkUrl()); anchor.setTarget("_blank"); Label hostLabel = new Label(host); panel.add(anchor); panel.add(hostLabel); description = panel; } else { description = new Label(datum.getLinkText() + " [" + datum.getLinkUrl() + "]"); } description.addStyleName(GRID_CELL_CSS_STYLE); description.setTitle(datum.getToolTip()); dataGrid.setWidget(i + 1, 0, description); // Display images indicating whether or not the datum is associated with project artifacts. // For example, a Bug may be associated with a Component or a Testcase might validate scenarios // for a given Attribute. The user can associate data with project artifacts using SuperLabels. dataGrid.setWidget(i + 1, 1, (datum.isAttachedToAttribute()) ? getX() : getCheckmark()); dataGrid.setWidget(i + 1, 2, (datum.isAttachedToComponent()) ? getX() : getCheckmark()); dataGrid.setWidget(i + 1, 3, (datum.isAttachedToCapability()) ? getX() : getCheckmark()); } }