List of usage examples for com.google.gwt.user.client.ui HTMLPanel HTMLPanel
private HTMLPanel(Element elem)
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. *///from www . j av a2 s . co 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.parameter.schema.FieldsEditor.java
License:Apache License
/** * Sets the properties this field will have, if it is an object. *//*from w w w .java2 s . c om*/ public void setProperties(Map<String, Schema> properties) { List<String> keys = Lists.newArrayList(properties.keySet()); Collections.sort(keys); HTMLPanel inner = new HTMLPanel(""); inner.getElement().getStyle().setPaddingLeft(20, Unit.PX); for (String childKey : keys) { final Schema property = properties.get(childKey); final Map<String, Schema> childProperties = property.getProperties(); final Schema items = property.getItems(); if (childProperties == null && items == null) { // This is a simple field CheckBox checkBox = new CheckBox(childKey); checkBox.setValue(root.getValue()); checkBox.setTitle(property.getDescription()); children.put(childKey, checkBox); checkBox.getElement().appendChild(Document.get().createBRElement()); inner.add(checkBox); } else { final FieldsEditor editor = new FieldsEditor(service, childKey); children.put(childKey, editor); inner.add(editor); if (childProperties != null) { editor.setProperties(childProperties); } else if (property.getRef() != null) { editor.setRef(property.getRef()); } else if (items != null) { if (items.getProperties() != null) { editor.setProperties(items.getProperties()); } else if (items.getRef() != null) { editor.setRef(items.getRef()); } } } } add(inner); }
From source file:com.google.code.p.gwtchismes.client.GWTCFieldSet.java
License:Apache License
/** * Sets the text for the leyend//from w w w. j a v a 2 s . c o m * @param txt */ public void setLegend(String txt) { if (DOM.getElementById(idLegend) != null) { DOM.setInnerText(DOM.getElementById(idLegend), txt); } else { DOM.setInnerText(legend, txt); } DOM.setElementAttribute(legend, "id", idLegend); DOM.setElementAttribute(fieldSet, "id", idFieldSet); DOM.appendChild(fieldSet, legend); container = new HTMLPanel(fieldSet.toString()); container.add(dockpanel, idFieldSet); setElement(container.getElement()); }
From source file:com.google.gwt.sample.kitchensink.client.Layouts.java
License:Apache License
public Layouts() { HTML contents = new HTML("This is a <code>ScrollPanel</code> contained at " + "the center of a <code>DockPanel</code>. " + "By putting some fairly large contents " + "in the middle and setting its size explicitly, it becomes a " + "scrollable area within the page, but without requiring the use of " + "an IFRAME." + "Here's quite a bit more meaningless text that will serve primarily " + "to make this thing scroll off the bottom of its visible area. " + "Otherwise, you might have to make it really, really small in order " + "to see the nifty scroll bars!"); ScrollPanel scroller = new ScrollPanel(contents); scroller.setStyleName("ks-layouts-Scroller"); DockPanel dock = new DockPanel(); dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER); HTML north0 = new HTML("This is the <i>first</i> north component", true); HTML east = new HTML("<center>This<br>is<br>the<br>east<br>component</center>", true); HTML south = new HTML("This is the south component"); HTML west = new HTML("<center>This<br>is<br>the<br>west<br>component</center>", true); HTML north1 = new HTML("This is the <b>second</b> north component", true); dock.add(north0, DockPanel.NORTH);// www.j a v a 2 s .c o m dock.add(east, DockPanel.EAST); dock.add(south, DockPanel.SOUTH); dock.add(west, DockPanel.WEST); dock.add(north1, DockPanel.NORTH); dock.add(scroller, DockPanel.CENTER); FlowPanel flow = new FlowPanel(); for (int i = 0; i < 8; ++i) flow.add(new CheckBox("Flow " + i)); HorizontalPanel horz = new HorizontalPanel(); horz.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); horz.add(new Button("Button")); horz.add(new HTML("<center>This is a<br>very<br>tall thing</center>", true)); horz.add(new Button("Button")); VerticalPanel vert = new VerticalPanel(); vert.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vert.add(new Button("Small")); vert.add(new Button("--- BigBigBigBig ---")); vert.add(new Button("tiny")); MenuBar menu = new MenuBar(); MenuBar menu0 = new MenuBar(true), menu1 = new MenuBar(true); menu.addItem("menu0", menu0); menu.addItem("menu1", menu1); menu0.addItem("child00", (Command) null); menu0.addItem("child01", (Command) null); menu0.addItem("child02", (Command) null); menu1.addItem("child10", (Command) null); menu1.addItem("child11", (Command) null); menu1.addItem("child12", (Command) null); String id = HTMLPanel.createUniqueId(); HTMLPanel html = new HTMLPanel("This is an <code>HTMLPanel</code>. It allows you to add " + "components inside existing HTML, like this:" + "<span id='" + id + "'></span>" + "Notice how the menu just fits snugly in there? Cute."); DOM.setStyleAttribute(menu.getElement(), "display", "inline"); html.add(menu, id); VerticalPanel panel = new VerticalPanel(); panel.setSpacing(8); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); panel.add(makeLabel("Dock Panel")); panel.add(dock); panel.add(makeLabel("Flow Panel")); panel.add(flow); panel.add(makeLabel("Horizontal Panel")); panel.add(horz); panel.add(makeLabel("Vertical Panel")); panel.add(vert); panel.add(makeLabel("HTML Panel")); panel.add(html); initWidget(panel); setStyleName("ks-layouts"); }
From source file:com.google.livingstories.client.lsp.ContentRenderer.java
License:Apache License
/** * Find the custom tags in the HTML and process them. *//*from w ww . j av a 2 s. c om*/ private HTMLPanel processTagsInChunk(String chunk) { HTMLPanel contentPanel = new HTMLPanel(chunk); try { // Process each type of tag for (ContentTag tag : contentTags) { NodeList<Element> tagNodeList = contentPanel.getElement().getElementsByTagName(tag.getTagName()); List<Element> tagElements = new ArrayList<Element>(); for (int i = 0; i < tagNodeList.getLength(); i++) { // First iterate over the node list and copy all the elements into a new list. Can't // iterate and modify them at the same time because the list changes dynamically. tagElements.add(tagNodeList.getItem(i)); } for (Element tagElement : tagElements) { Widget widget = tag.createWidgetToReplaceTag(tagElement); if (widget != null) { // To replace the existing tag with the widget created above, the HTMLPanel needs // to have the id of the element being replaced. Since we can't expect users to assign // unique ids in every tag, we do this here automatically. String uniqueId = HTMLPanel.createUniqueId(); tagElement.setId(uniqueId); contentPanel.addAndReplaceElement(widget, uniqueId); } } } } catch (Exception e) { // Just return the panel with the original content } return contentPanel; }
From source file:com.google.sampling.experiential.client.PacoEventServer.java
License:Open Source License
private VerticalPanel createSearchPanel() { final VerticalPanel filterPanel = new VerticalPanel(); filterPanel.add(new HTMLPanel("<b>Events (empty for all):</b> ")); tagList = new TextBox(); tagList.setWidth("45em"); filterPanel.add(tagList);//w ww .j a va 2s .c om filterPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); filterPanel.add(buttonPanel); Button cafeButton = new Button("Paco Search"); buttonPanel.add(cafeButton); InputHandler cafeHandler = new InputHandler(); cafeButton.addClickHandler(cafeHandler); tagList.addKeyUpHandler(cafeHandler); Button postButton = new Button("Store Data"); buttonPanel.add(postButton); postButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.Location.assign("/PostEvent.html"); } }); return filterPanel; }
From source file:com.gwtcx.extgwt.client.desktop.view.AbstractErrorPageView.java
License:Open Source License
public AbstractErrorPageView() { panel = new HTMLPanel(getPanelHtml()); okButton = new TextButton(I18nUtil.getConstant().ok()); panel.add(okButton, OK_BUTTON_CONTAINER); bindCustomUiHandlers();// w ww .ja v a 2 s . c om }
From source file:com.gwtcx.extgwt.client.desktop.view.PlaceholderView.java
License:Open Source License
public PlaceholderView() { panel = new HTMLPanel(getPanelHtml()); }
From source file:com.gwtcx.smartgwt.client.view.AbstractErrorPageView.java
License:Open Source License
public AbstractErrorPageView() { panel = new HTMLPanel(getPanelHtml()); okButton = new Button(I18nUtil.getConstant().ok()); panel.add(okButton, OK_BUTTON_CONTAINER); bindCustomUiHandlers();/*from w w w . jav a2 s . c o m*/ }
From source file:com.gwtcx.smartgwt.client.view.AbstractSignInPageView.java
License:Open Source License
public AbstractSignInPageView() { panel = new HTMLPanel(getPanelHtml()); userName = new TextBox(); password = new PasswordTextBox(); signInButton = new Button(I18nUtil.getConstant().signIn()); panel.add(userName, USER_NAME_FIELD_CONTAINER); panel.add(password, PASSWORD_FIELD_CONTAINER); panel.add(signInButton, SIGNIN_BUTTON_CONTAINER); bindCustomUiHandlers();/*from w ww. ja va2 s .c om*/ }