List of usage examples for com.google.gwt.user.client.ui Widget addStyleName
public void addStyleName(String style)
From source file:com.ephesoft.dcma.gwt.core.client.ui.widget.ImageLabel.java
License:Open Source License
/** * Adds the style class to the inner component using the <code>ImageLabelComponent</code> to define on which component style needs * to be added./*from www . j a v a2 s . com*/ * * @param imageLabelComponent {@link ImageLabelComponent} the image label inner component for which style needs to be added * @param style {@link String} name of style class */ public void addComponentStyle(final ImageLabelComponent imageLabelComponent, final String style) { final Widget widget = getComponent(imageLabelComponent); if (null != widget && !StringUtil.isNullOrEmpty(style)) { widget.addStyleName(style); } }
From source file:com.ephesoft.gxt.admin.client.view.plugin.PluginDetailView.java
License:Open Source License
public void addWidget(String labelText, Widget widget, boolean isMandatory) { HorizontalPanel cont = new HorizontalPanel(); cont.addStyleName("pluginPanel"); if (isMandatory) { MandatoryLabel label = new MandatoryLabel(); label.setLabelText(labelText);// www .ja v a 2s. com label.addStyleName("pluginLabel"); cont.add(label); } else { labelText = StringUtil.concatenate(labelText, AdminConstants.COLON); Label label = new Label(); label.setText(labelText); label.addStyleName("pluginLabel"); cont.add(label); } widget.addStyleName("widgetPluginLabel"); cont.add(widget); vlayoutContainer.add(cont); }
From source file:com.ephesoft.gxt.core.client.ui.widget.ScreenNavigatorWidget.java
License:Open Source License
private HorizontalPanel getInnerHorizontalPanel(Widget firstWidget, final Widget secondWidget) { final HorizontalPanel widgetHorizontalPanel = new HorizontalPanel(); widgetHorizontalPanel.add(firstWidget); widgetHorizontalPanel.getElement().setAttribute("cellPadding", "2"); widgetHorizontalPanel.setSpacing(1); widgetHorizontalPanel.setWidth("100px"); secondWidget.setVisible(true);// ww w.jav a 2s .c o m secondWidget.addStyleName("panelLabelStyle"); final MenuBar menuBar = (MenuBar) secondWidget; final MenuBarWidget menuBarWidget = new MenuBarWidget(true); menuBarWidget.addItem(new MenuItem(menuBar.getTitle(), menuBar)); widgetHorizontalPanel.add(menuBarWidget); menuBarWidget.setVisible(false); widgetHorizontalPanel.addDomHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { widgetHorizontalPanel.addStyleName("horizontalPanelMouseHover"); menuBarWidget.setAutoOpen(true); menuBarWidget.setSelectedMenu(false); if (null != previosMenuBar) { previosMenuBar.closeAllChildren(false); } } }, MouseOverEvent.getType()); widgetHorizontalPanel.addDomHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { widgetHorizontalPanel.removeStyleName("horizontalPanelMouseHover"); menuBarWidget.setSelectedMenu(true); previosMenuBar = menuBarWidget; } }, MouseOutEvent.getType()); return widgetHorizontalPanel; }
From source file:com.ephesoft.gxt.core.client.ui.widget.ScreenNavigatorWidget.java
License:Open Source License
private HorizontalPanel getPageMenuInnerHorizontalPanel(Widget firstWidget, final Widget secondWidget, final String url) { final HorizontalPanel widgetHorizontalPanel = new HorizontalPanel(); widgetHorizontalPanel.add(firstWidget); widgetHorizontalPanel.add(secondWidget); widgetHorizontalPanel.getElement().setAttribute("cellPadding", "2"); widgetHorizontalPanel.setSpacing(1); widgetHorizontalPanel.addStyleName("panelWidth"); secondWidget.setVisible(false);//from w w w .j a v a 2 s. c o m secondWidget.setWidth("100px"); secondWidget.addStyleName("panelLabelStyle"); if (!url.equalsIgnoreCase(CoreCommonConstant.EMPTY_STRING)) { String currentURL = Window.Location.getHref(); String baseUrl = currentURL.substring(0, currentURL.lastIndexOf('/')); StringBuffer newUrl = new StringBuffer(); newUrl.append(baseUrl).append(url); if (currentURL.equalsIgnoreCase(newUrl.toString())) { widgetHorizontalPanel.addStyleName("setSelectedPageStyle"); } } widgetHorizontalPanel.addDomHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { widgetHorizontalPanel.addStyleName("horizontalPanelMouseHover"); if (null != previosMenuBar) { previosMenuBar.closeAllChildren(false); } } }, MouseOverEvent.getType()); widgetHorizontalPanel.addDomHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { widgetHorizontalPanel.removeStyleName("horizontalPanelMouseHover"); } }, MouseOutEvent.getType()); widgetHorizontalPanel.addDomHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (!url.equalsIgnoreCase(CoreCommonConstant.EMPTY_STRING)) { String href = Window.Location.getHref(); String baseUrl = href.substring(0, href.lastIndexOf('/')); StringBuffer newUrl = new StringBuffer(); newUrl.append(baseUrl).append(url); Window.Location.assign(newUrl.toString()); } } }, ClickEvent.getType()); return widgetHorizontalPanel; }
From source file:com.goodow.wave.client.shell.WidgetContainer.java
License:Apache License
private void setStyle(final Widget widget, final String name) { if (widget == null) { return;/*from www . j a va 2 s. c o m*/ } for (String n : STYLE_NAMES) { widget.removeStyleName(n); } widget.addStyleName(name); }
From source file:com.google.api.explorer.client.embedded.EmbeddedParameterForm.java
License:Apache License
/** * Adds a row to the table containing the parameter name, whether it is * required, and an {@link Editor} to provide a value. */// www .ja va 2 s .co m private void addEditorRow(String paramName, Schema param, int row) { // First cell in row displays the parameter name and whether the parameter // is required. boolean required = param.isRequired(); table.setText(row, 0, paramName); if (required) { requiredDescription.setVisible(true); cellFormatter.addStyleName(row, 0, EmbeddedResources.INSTANCE.style().requiredParameter()); } // Second cell in row displays the editor for the parameter value. Editor editor = EditorFactory.forParameter(param); nameToEditor.put(paramName, editor); Widget editorWidget = editor.createAndSetView().asWidget(); editorWidget.addStyleName(style.parameterInput()); table.setWidget(row, 1, editorWidget); // Third cell in row displays the description. table.setText(row, 2, EmbeddedParameterFormPresenter.generateDescriptionString(param)); if (paramName.equals("alt")) { editor.setValue(ImmutableList.of("json")); } cellFormatter.addStyleName(row, 0, EmbeddedResources.INSTANCE.style().parameterFormNameCell()); cellFormatter.addStyleName(row, 1, EmbeddedResources.INSTANCE.style().parameterFormEditorCell()); cellFormatter.addStyleName(row, 2, EmbeddedResources.INSTANCE.style().parameterFormDescriptionCell()); }
From source file:com.google.api.explorer.client.embedded.EmbeddedParameterForm.java
License:Apache License
/** * Adds a row to the table to edit the partial fields mask. * * @param responseSchema Definition of the response object being described. * @param row Row index to begin adding rows to the parameter form table. */// w w w . j a v a 2 s .c o m private void addEmbeddedFieldsRow(ApiService service, @Nullable Schema responseSchema, int row) { fieldsPlaceholder.clear(); table.setText(row, 0, "fields"); // Reset the fields textbox's value to empty and add it to the table (with // appropriate styling) fieldsTextBox.setText(""); // All inputs must be wrapped in a container to simplify the CSS. Widget container = new SimplePanel(fieldsTextBox); container.addStyleName(style.parameterInput()); table.setWidget(row, 1, container); // Start adding the next cell which will have the description of this param, // and potentially a link to open the fields editor. HTMLPanel panel = new HTMLPanel(""); service.getParameters().get("fields").getDescription(); panel.add(new Label(getFieldsDescription(service))); // If a response schema is provided, add a link to the fields editor and // tell the fields editor about this method's response schema. if (responseSchema != null && responseSchema.getProperties() != null) { Label openFieldsEditor = new InlineLabel("Use fields editor"); openFieldsEditor.addStyleName(Resources.INSTANCE.style().clickable()); openFieldsEditor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { fieldsPopupPanel.show(); fieldsPopupPanel.center(); } }); panel.add(openFieldsEditor); fieldsEditor = new FieldsEditor(service, /* This is the root, no field name req'd */""); fieldsEditor.setProperties(responseSchema.getProperties()); fieldsPlaceholder.add(fieldsEditor); } // Add the description (and maybe fields editor link) to the table. table.setWidget(row, 2, panel); cellFormatter.addStyleName(row, 0, EmbeddedResources.INSTANCE.style().parameterFormNameCell()); cellFormatter.addStyleName(row, 1, EmbeddedResources.INSTANCE.style().parameterFormEditorCell()); cellFormatter.addStyleName(row, 2, EmbeddedResources.INSTANCE.style().parameterFormDescriptionCell()); }
From source file:com.google.api.explorer.client.history.JsonPrettifier.java
License:Apache License
private static Widget simpleInline(String title, String inlineText, String style, int depth, boolean hasSeparator) { Widget valueLabel = new InlineLabel(inlineText); valueLabel.addStyleName(style); return inlineWidget(title, Lists.newArrayList(valueLabel), depth, hasSeparator); }
From source file:com.google.api.explorer.client.history.JsonPrettifier.java
License:Apache License
private static List<Widget> formatString(ApiService service, String rawText, PrettifierLinkFactory linkFactory) { if (isLink(rawText)) { List<Widget> response = Lists.newArrayList(); response.add(new InlineLabel("\"")); boolean createdExplorerLink = false; try {//from w w w. j a v a 2 s .c o m ApiMethod method = getMethodForUrl(service, rawText); if (method != null) { String explorerLink = createExplorerLink(service, rawText, method); Widget linkObject = linkFactory.generateAnchor(rawText, explorerLink); linkObject.addStyleName(style.jsonStringExplorerLink()); response.add(linkObject); createdExplorerLink = true; } } catch (IndexOutOfBoundsException e) { // Intentionally blank - this will only happen when iterating the method // url template in parallel with the url components and you run out of // components } if (!createdExplorerLink) { Anchor linkObject = new Anchor(rawText, rawText, OPEN_IN_NEW_WINDOW); linkObject.addStyleName(style.jsonStringLink()); response.add(linkObject); } response.add(new InlineLabel("\"")); return response; } else { JSONString encoded = new JSONString(rawText); Widget stringText = new InlineLabel(encoded.toString()); stringText.addStyleName(style.jsonString()); return Lists.newArrayList(stringText); } }
From source file:com.google.code.guidatv.client.ui.widget.imported.DisclosurePanel.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. * * @param content the widget to be used as the content panel *///from w ww . j a va2 s . c o m public void setContent(Widget content) { final Widget currentContent = getContent(); // Remove existing content widget. if (currentContent != null) { contentWrapper.setWidget(null); currentContent.removeStyleName(STYLENAME_CONTENT); } // Add new content widget if != null. if (content != null) { contentWrapper.setWidget(content); content.addStyleName(STYLENAME_CONTENT); setContentDisplay(false); } }