List of usage examples for com.google.gwt.user.client.ui HTML HTML
protected HTML(Element element)
From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java
License:Apache License
private void rebuildSnapshotDisclaimer() { snapshotDisclaimerDiv.clear();// w w w . ja v a 2 s .c om if (isSnapshot()) { DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd 'at' HH:mm:ss Z"); long createdEpochTime = 0; for (BenchmarkSnapshotMeta snapshot : benchmarkMeta.getSnapshots()) { if (snapshot.getId() == snapshotId) { createdEpochTime = snapshot.getCreated(); } } String formattedDate = format.format(new Date(createdEpochTime)); snapshotDisclaimerDiv.add( new HTML("This is a snapshot taken on " + formattedDate + " (<a target=\"_blank\" href=\"/run/" + URL.encode(benchmarkOwner) + "/" + URL.encode(benchmarkName) + "\">Original</a>)")); } }
From source file:com.google.client.GwtEarth.java
License:Apache License
/** * This is the entry point method.//www . j av a 2 s . c o m */ public void onModuleLoad() { tabPanel.setSize("95%", "95%"); RootPanel.get().add(tabPanel); VerticalPanel vp = new VerticalPanel(); vp.add(new HTML("<p>Welcome to Google Earth In GWT demo.</p>" + "<p>To add a new Google Earth tab, click the button below.</p>")); vp.add(pb); tabPanel.add(vp, "Welcome !"); tabPanel.selectTab(0); pb.addClickListener(this); tabPanel.addTabListener(this); }
From source file:com.google.client.widget.GoogleEarthWidget.java
License:Apache License
public GoogleEarthWidget() { HTML html = new HTML("<div class='map3dcontainer' id='map3dcontainer" + id + "'>" + "<div class='map3d' id='map3d" + id + "'></div></div>"); setElement(html.getElement());/* w w w .j a v a 2s .co m*/ }
From source file:com.google.code.gwt.storage.sample.hellostorage.client.HelloStorage.java
License:Apache License
private static void renderGrid(Grid grid, Storage storage) { grid.clear();/*from w w w.j a v a2 s. c om*/ grid.resize(storage.getLength() + 1, 3); grid.setWidget(0, 0, new HTML("<b>Key</b>")); grid.setWidget(0, 1, new HTML("<b>Data</b>")); for (int i = 1; i <= storage.getLength(); i++) { String key = storage.key(i - 1); grid.setWidget(i, 0, new Label(key)); grid.setWidget(i, 1, new Label(storage.getItem(key))); grid.setWidget(i, 2, new DeleteButton(storage, key, grid)); } }
From source file:com.google.code.p.gwtchismes.client.editor.Toolbar.java
License:Apache License
public Toolbar(RichTextArea richText, ToolbarConstants strings, ToolbarImages images) { this.richText = richText; this.basic = richText.getBasicFormatter(); this.extended = richText.getExtendedFormatter(); topPanel.setWidth("100%"); initWidget(topPanel);// ww w . j av a 2 s .co m setStyleName("gwt-RichTextToolbar"); richText.addStyleName("hasRichTextToolbar"); if (basic != null) { topPanel.add(bold = createToggleButton(images.bold(), strings.editor_bold())); topPanel.add(italic = createToggleButton(images.italic(), strings.editor_italic())); topPanel.add(underline = createToggleButton(images.underline(), strings.editor_underline())); topPanel.add(backColors = createPushButton(images.backColors(), strings.editor_background())); topPanel.add(foreColors = createPushButton(images.foreColors(), strings.editor_foreground())); topPanel.add(fontFamily = createPushButton(images.fonts(), strings.editor_font())); topPanel.add(fontSize = createPushButton(images.fontSizes(), strings.editor_size())); topPanel.add(subscript = createToggleButton(images.subscript(), strings.editor_subscript())); topPanel.add(superscript = createToggleButton(images.superscript(), strings.editor_superscript())); topPanel.add(justifyLeft = createPushButton(images.justifyLeft(), strings.editor_justifyLeft())); topPanel.add(justifyCenter = createPushButton(images.justifyCenter(), strings.editor_justifyCenter())); topPanel.add(justifyRight = createPushButton(images.justifyRight(), strings.editor_justifyRight())); } if (extended != null) { topPanel.add( strikethrough = createToggleButton(images.strikeThrough(), strings.editor_strikeThrough())); topPanel.add(indent = createPushButton(images.indent(), strings.editor_indent())); topPanel.add(outdent = createPushButton(images.outdent(), strings.editor_outdent())); topPanel.add(hr = createPushButton(images.hr(), strings.editor_hr())); topPanel.add(ol = createPushButton(images.ol(), strings.editor_ol())); topPanel.add(ul = createPushButton(images.ul(), strings.editor_ul())); topPanel.add(insertImage = createPushButton(images.insertImage(), strings.editor_insertImage())); topPanel.add(createLink = createPushButton(images.createLink(), strings.editor_createLink())); topPanel.add(removeLink = createPushButton(images.removeLink(), strings.editor_removeLink())); topPanel.add(removeFormat = createPushButton(images.removeFormat(), strings.editor_removeFormat())); } HTML topEmtyCell = new HTML(""); topPanel.add(topEmtyCell); topPanel.setCellWidth(topEmtyCell, "100%"); richText.addKeyDownHandler(handler); richText.addKeyUpHandler(handler); richText.addClickHandler(handler); backColorsPicker.addValueChangeHandler(colorHandler); foreColorsPicker.addValueChangeHandler(colorHandler); fontFamilyPicker.addValueChangeHandler(fontHandler); fontSizePicker.addValueChangeHandler(fontHandler); }
From source file:com.google.code.p.gwtchismes.client.GWTCBox.java
License:Apache License
public static Widget objectToWidget(Object object) { Widget html;//w w w. j a v a 2s. c o m if (object == null) { html = null; } else if (object instanceof String) { html = new HTML((String) object) { public void onDetach() { if (isAttached()) super.onDetach(); } }; } else if (object instanceof Widget) { html = (Widget) object; } else { Element element = (Element) object; if (element.getTagName().equalsIgnoreCase("div") || element.getTagName().equalsIgnoreCase("span")) { html = HTML.wrap(element); } else { html = new SimplePanel(element) { }; } } return html; }
From source file:com.google.code.p.gwtchismes.client.GWTCButton.java
License:Apache License
@Override public void setHTML(String html) { if (container == null) super.setHTML(html); else {/*from www . ja v a2 s .co m*/ textPanel.clear(); textPanel.setWidget(new HTML(html)); textPanel.getWidget().setStyleName(S_BTN + "-" + S_TEXT); } }
From source file:com.google.gdbe.client.dialogs.AboutDialog.java
License:Apache License
/** * Constructs an About dialog window.// ww w . j a va 2 s. c o m */ public AboutDialog() { super("About", true); addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hide(); } }); VerticalPanel content = new VerticalPanel(); content.setStylePrimaryName("gdbe-About"); Image logo = Icons.editorIcons.LogoLarge().createImage(); content.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); content.add(logo); content.setSize("500px", "100px"); HTML l1 = new HTML("© 2010 GDBE Project (1.3). Licensed under the Apache License, Version 2.0."); l1.setStylePrimaryName("gdbe-About-Caption"); content.add(l1); setContentWidget(content); }
From source file:com.google.gerrit.client.account.ContactPanelFull.java
License:Apache License
@Override protected void onInitUI() { super.onInitUI(); addressTxt = new NpTextArea(); addressTxt.setVisibleLines(4);/* w w w. j a v a 2 s . co m*/ addressTxt.setCharacterWidth(60); countryTxt = new NpTextBox(); countryTxt.setVisibleLength(40); countryTxt.setMaxLength(40); phoneTxt = new NpTextBox(); phoneTxt.setVisibleLength(30); phoneTxt.setMaxLength(30); faxTxt = new NpTextBox(); faxTxt.setVisibleLength(30); faxTxt.setMaxLength(30); final Grid infoSecure = new Grid(4, 2); infoSecure.setStyleName(Gerrit.RESOURCES.css().infoBlock()); infoSecure.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock()); final HTML privhtml = new HTML(Util.C.contactPrivacyDetailsHtml()); privhtml.setStyleName(Gerrit.RESOURCES.css().accountContactPrivacyDetails()); hasContact = new Label(); hasContact.setStyleName(Gerrit.RESOURCES.css().accountContactOnFile()); hasContact.setVisible(false); if (Gerrit.getConfig().isUseContactInfo()) { body.add(privhtml); body.add(hasContact); body.add(infoSecure); } row(infoSecure, 0, Util.C.contactFieldAddress(), addressTxt); row(infoSecure, 1, Util.C.contactFieldCountry(), countryTxt); row(infoSecure, 2, Util.C.contactFieldPhone(), phoneTxt); row(infoSecure, 3, Util.C.contactFieldFax(), faxTxt); infoSecure.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); infoSecure.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); infoSecure.getCellFormatter().addStyleName(3, 0, Gerrit.RESOURCES.css().bottomheader()); final OnEditEnabler sbl = new OnEditEnabler(save); sbl.listenTo(addressTxt); sbl.listenTo(countryTxt); sbl.listenTo(phoneTxt); sbl.listenTo(faxTxt); }
From source file:com.google.gerrit.client.account.ContactPanelShort.java
License:Apache License
private void doRegisterNewEmail() { if (!canRegisterNewEmail()) { return;/*from w ww . j a v a2 s. com*/ } final AutoCenterDialogBox box = new AutoCenterDialogBox(true, true); final VerticalPanel body = new VerticalPanel(); final NpTextBox inEmail = new NpTextBox(); inEmail.setVisibleLength(60); final Button register = new Button(Util.C.buttonSendRegisterNewEmail()); final Button cancel = new Button(Util.C.buttonCancel()); final FormPanel form = new FormPanel(); form.addSubmitHandler(new FormPanel.SubmitHandler() { @Override public void onSubmit(final SubmitEvent event) { event.cancel(); final String addr = inEmail.getText().trim(); if (!addr.contains("@")) { new ErrorDialog(Util.C.invalidUserEmail()).center(); return; } inEmail.setEnabled(false); register.setEnabled(false); AccountApi.registerEmail("self", addr, new GerritCallback<NativeString>() { @Override public void onSuccess(NativeString result) { box.hide(); if (Gerrit.getConfig().getAuthType() == AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT) { currentEmail = addr; if (emailPick.getItemCount() == 0) { final Account me = Gerrit.getUserAccount(); me.setPreferredEmail(addr); onSaveSuccess(me); } else { save.setEnabled(true); } updateEmailList(); } } @Override public void onFailure(final Throwable caught) { inEmail.setEnabled(true); register.setEnabled(true); if (caught.getMessage().startsWith(EmailException.MESSAGE)) { final ErrorDialog d = new ErrorDialog( caught.getMessage().substring(EmailException.MESSAGE.length())); d.setText(Util.C.errorDialogTitleRegisterNewEmail()); d.center(); } else { super.onFailure(caught); } } }); } }); form.setWidget(body); register.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { box.hide(); } }); final FlowPanel buttons = new FlowPanel(); buttons.setStyleName(Gerrit.RESOURCES.css().patchSetActions()); buttons.add(register); buttons.add(cancel); if (Gerrit.getConfig().getAuthType() != AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT) { body.add(new HTML(Util.C.descRegisterNewEmail())); } body.add(inEmail); body.add(buttons); box.setText(Util.C.titleRegisterNewEmail()); box.setWidget(form); box.center(); inEmail.setFocus(true); }