List of usage examples for com.google.gwt.user.client.ui HTML wrap
public static HTML wrap(Element element)
From source file:com.google.code.p.gwtchismes.client.GWTCBox.java
License:Apache License
public static Widget objectToWidget(Object object) { Widget html;/*from w w w. java 2 s .co 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.palantir.gerrit.gerritci.ui.client.ConfigurationScreen.java
License:Apache License
ConfigurationScreen() { setStyleName("gerrit-ci"); jenkinsURL = new TextBox(); jenkinsUser = new TextBox(); jenkinsPassword = new TextBox(); gerritUser = new TextBox(); credentialsId = new TextBox(); // initialize with defaults jenkinsURL.setText("http://localhost:8000"); jenkinsUser.setText(null);/*from w ww . ja va 2 s . c om*/ jenkinsPassword.setText(null); gerritUser.setText("jenkins"); credentialsId.setText("612940dd-cadf-43f0-98dc-e2f02f5e68ec"); // These settings will be the same for all Jenkins servers HeadingElement gerritSettings = Document.get().createHElement(2); gerritSettings.setInnerText("Gerrit Settings for Jenkins"); ParagraphElement gerritSettingsDescription = Document.get().createPElement(); gerritSettingsDescription.setClassName("description"); gerritSettingsDescription.setInnerText("The configurations below are similar for all Jenkins instances. " + "They describe how Jenkins will connect to Gerrit. For example: 'Gerrit User' " + "is Jenkins's username in Gerrit."); ParagraphElement gerritUserLabel = Document.get().createPElement(); gerritUserLabel.setInnerText("Gerrit User"); gerritUser.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); // These settings will be specific for a Jenkins server instance // when multiple Jenkins servers are supported by gerrit-ci HeadingElement serverSettings = Document.get().createHElement(2); serverSettings.setInnerText("Jenkins Settings for Gerrit"); ParagraphElement serverSettingsDescription = Document.get().createPElement(); serverSettingsDescription.setClassName("description"); serverSettingsDescription.setInnerText("The configurations below are specific to each instance of Jenkins." + "They describe how Gerrit will connect to a specific instance of Jenkins."); // create labels ParagraphElement jenkinsURLLabel = Document.get().createPElement(); jenkinsURLLabel.setInnerText("Jenkins Url"); jenkinsURL.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); ParagraphElement jenkinsUserLabel = Document.get().createPElement(); jenkinsUserLabel.setInnerText("Jenkins User"); jenkinsUser.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); ParagraphElement jenkinsPasswordLabel = Document.get().createPElement(); jenkinsPasswordLabel.setInnerText("Jenkins Password"); add(HTML.wrap(jenkinsURLLabel)); jenkinsPassword.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); ParagraphElement crendentialsIdLabel = Document.get().createPElement(); crendentialsIdLabel.setInnerText("Credentials Id"); credentialsId.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); // add to widgets screen add(HTML.wrap(gerritSettings)); add(HTML.wrap(gerritSettingsDescription)); add(HTML.wrap(gerritUserLabel)); add(gerritUser); add(HTML.wrap(serverSettings)); add(HTML.wrap(serverSettingsDescription)); add(HTML.wrap(jenkinsURLLabel)); add(jenkinsURL); add(HTML.wrap(jenkinsUserLabel)); add(jenkinsUser); add(HTML.wrap(jenkinsPasswordLabel)); add(jenkinsPassword); add(HTML.wrap(crendentialsIdLabel)); add(credentialsId); // retrieve values from gerrit-ci.config stored in the plugins config // file on gerrit new RestApi("plugins").id("gerrit-ci").view("settings").get(new AsyncCallback<JavaScriptObject>() { @Override public void onSuccess(JavaScriptObject jenkinsConfig) { JenkinsConfig config = (JenkinsConfig) jenkinsConfig; String jenkinsURLString = config.getJenkinsURL(); String jenkinsUserString = config.getJenkinsUser(); String jenkinsPasswordString = config.getJenkinsPassword(); String gerritUserString = config.getGerritUser(); String credentialIdString = config.getCredentialsId(); if (jenkinsURLString != null) { jenkinsURL.setText(jenkinsURLString); } if (jenkinsUserString != null) { jenkinsUser.setText(jenkinsUserString); } if (jenkinsPasswordString != null) { jenkinsPassword.setText(jenkinsPasswordString); } if (gerritUserString != null) { gerritUser.setText(gerritUserString); } if (credentialIdString != null) { credentialsId.setText(credentialIdString); } } @Override public void onFailure(Throwable caught) { // never invoked } }); Button save = new Button("Save"); save.setEnabled(true); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { save(); } }); add(save); }
From source file:com.palantir.gerrit.gerritci.ui.client.ProjectConfigurationScreen.java
License:Apache License
ProjectConfigurationScreen(String title, Unit u) { setStyleName("gerrit-ci"); HeadingElement header = Document.get().createHElement(1); header.setInnerText("Project: " + title); saveButton = new Button("Save"); saveButton.setEnabled(true);//from ww w . ja v a 2 s. c o m saveButton.setStyleName("gerrit-ci"); saveButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doSave(); } }); new RestApi("plugins").id("gerrit-ci").view("jobs").view(encodedProjectName).get(new AsyncCallback<Jobs>() { @Override public void onFailure(Throwable caught) { // Never invoked. Errors are shown in a dialog. } @Override public void onSuccess(Jobs result) { if ((result.getItems() != null && result.getItems().get(0).getType().equals("ERROR"))) { try { String msg = result.getItems().get(0).getItems().get(0).getVal(); alertWidget("Action not completed", msg).center(); } catch (Exception e) { alertWidget("Action not completed", "Please verify connection to Jenkins" + " is valid in the gerrit-ci admin page " + "(administrator access is required).") .center(); } } else { int numOfJobs = result.getItems().length(); for (int i = 0; i < numOfJobs; i++) { if (result.getItems().get(0).getItems().length() > 0) { JenkinsJob j = result.getItems().get(i); //We will always get back a list of JenkinsJobs. If none exists, //this list will be empty. Else, make a delete button for each job. final HTMLPanel p = JobPanels.showJob(j); if (p != null) { final Button deleteButton = new Button("delete"); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deletePanel(p); } }); p.addAndReplaceElement(deleteButton, "delete"); if (j.getType().equals("cron")) { addCronToggleButton(p, deleteButton); } add(p); activePanels.add(p); } } } } } }); saveButton = new Button("Save"); saveButton.setEnabled(true); saveButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doSave(); } }); addVerifyJob = new Button("+ Verify Job"); addVerifyJob.setEnabled(true); addVerifyJob.setStyleName("add"); addVerifyJob.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { add(createJob("verify")); } }); addPublishJob = new Button("+ Publish Job"); addPublishJob.setEnabled(true); addPublishJob.setStyleName("add"); addPublishJob.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { add(createJob("publish")); } }); addCronJob = new Button("+ Scheduled (cron) Job"); addCronJob.setEnabled(true); addCronJob.setStyleName("add"); addCronJob.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { add(createJob("cron")); } }); HTMLPanel buttonPanel = new HTMLPanel(GerritCiPlugin.buttonsPanel.toString()); buttonPanel.add(addVerifyJob, "addVerifyJob"); buttonPanel.add(addCronJob, "addCronJob"); buttonPanel.add(addPublishJob, "addPublishJob"); buttonPanel.add(saveButton, "saveButton"); buttonPanel.setStyleName("gerrit-ci"); buttonPanel.add(HTML.wrap(header), "projectName"); add(buttonPanel); }
From source file:com.xemantic.tadedon.gwt.user.client.Htmls.java
License:Apache License
public static HTML getHtml(String id) { HTML html = cache.get(id);//w w w .j a v a 2 s .c o m if (html == null) { Element element = Document.get().getElementById(id); if (element == null) { throw new IllegalArgumentException("No HTML Element with id: " + id); } html = HTML.wrap(element); cache.put(id, html); } return html; }
From source file:org.dataconservancy.dcs.access.client.model.JsMetadata.java
License:Apache License
private Widget formatXML(String xml) { PreElement pre = Document.get().createPreElement(); pre.setInnerText(xml.replace(">", ">\n")); return HTML.wrap(pre); }
From source file:org.dataconservancy.dcs.access.ui.client.model.JsMetadata.java
License:Apache License
private Widget formatXML(String xml) { PreElement pre = Document.get().createPreElement(); pre.setInnerText(xml.replace(">", ">\n")); return HTML.wrap(pre); }
From source file:org.silverpeas.mobile.client.components.homepage.HomePageContent.java
License:Open Source License
public void setData(HomePageDTO data) { this.data = data; news.clear();/*www .ja v a 2 s .co m*/ if (config.isNewsDisplay()) { List<NewsDTO> newsDTOList = data.getNews(); int i = 1; boolean v = true; int max = newsDTOList.size(); for (NewsDTO newsDTO : newsDTOList) { NewsItem item = new NewsItem(); item.setData(i, max, newsDTO); item.setVisible(v); news.add(item); i++; v = false; } } spaces.clear(); List<SilverpeasObjectDTO> spacesList = data.getSpacesAndApps(); for (SilverpeasObjectDTO space : spacesList) { NavigationItem item = new NavigationItem(); item.setData(space); spaces.add(item); } favoris.clear(); List<MyLinkDTO> favoritesList = data.getFavorites(); favorisSection.setVisible(!favoritesList.isEmpty() && config.isFavoritesDisplay()); for (MyLinkDTO favoriteDTO : favoritesList) { FavoriteItem item = new FavoriteItem(); item.setData(favoriteDTO); favoris.add(item); } lastPublications.clear(); List<PublicationDTO> publicationsList = data.getLastPublications(); lastPublicationsSection.setVisible(!publicationsList.isEmpty() && config.isLastPublicationsDisplay()); for (PublicationDTO publicationDTO : publicationsList) { PublicationItem item = new PublicationItem(); item.setData(publicationDTO); lastPublications.add(item); } if (MobilUtils.isMobil()) { Element e = Document.get().getElementById("actus"); HTML actus = HTML.wrap(e); swipeRecognizer = new SwipeRecognizer(actus); } Notification.activityStop(); }
From source file:teropa.ko2010.client.Client.java
License:Creative Commons License
private void initLeft(DockLayoutPanel dock) { DockLayoutPanel left = new DockLayoutPanel(Unit.PX); left.setStyleName("LeftPanel"); HTML src = HTML.wrap(Document.get().getElementById("src")); src.setStyleName("src"); left.addSouth(src, 30);/* w w w . j a v a 2s . c o m*/ HTML like = HTML.wrap(Document.get().getElementById("fb")); like.setStyleName("like"); left.addSouth(like, 30); HTML tweet = HTML.wrap(Document.get().getElementById("twitter")); tweet.setStyleName("tweetButton"); left.addSouth(tweet, 30); HTML badge = HTML.wrap(Document.get().getElementById("ko")); badge.setStyleName("koBadge"); left.addSouth(badge, 70); Info info = new Info(this); left.add(info); dock.addWest(left, 200); }
From source file:zpt.client.Client.java
License:Creative Commons License
private void initLeft(DockLayoutPanel dock) { DockLayoutPanel left = new DockLayoutPanel(Unit.PX); left.setStyleName("LeftPanel"); HTML src = HTML.wrap(Document.get().getElementById("src")); src.setStyleName("src"); left.addSouth(src, 30);//from www. j a va 2 s .c o m HTML like = HTML.wrap(Document.get().getElementById("fb")); like.setStyleName("like"); left.addSouth(like, 30); HTML tweet = HTML.wrap(Document.get().getElementById("twitter")); tweet.setStyleName("tweetButton"); left.addSouth(tweet, 30); Info info = new Info(this); left.add(info); dock.addWest(left, 200); }