List of usage examples for com.google.gwt.user.client.ui HTMLPanel add
@Override public void add(Widget widget)
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 ww . j ava 2 s . co m 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.gwt.site.demo.AbstractDemos.java
License:Apache License
@Override public void onContentLoaded() { GQuery demos = $("//div[@id='content']//div[starts-with(@id, '" + prefix + "')]"); NodeList<Element> nodeList = demos.get(); for (int i = 0; i < nodeList.getLength(); i++) { Element item = nodeList.getItem(i); Widget demo = getDemoToLoad(item.getId().replace(prefix, "")); if (demo != null) { HTMLPanel panel = HTMLPanel.wrap(item); panel.add(demo); }/*from w w w . j a va 2 s .c o m*/ } }
From source file:com.gsr.myschool.back.client.web.application.dossierdetails.InscriptionDetailView.java
License:Apache License
private void setupParentType(HTMLPanel container, InfoParentProxy infoParent) { container.clear();//from w w w . ja va2 s . c o m SafeHtml safeNom = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getNom(), "")); SafeHtml safePrenom = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getPrenom(), "")); SafeHtml safeTelDom = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getTelDom(), "")); SafeHtml safeEmail = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getEmail(), "")); SafeHtml safeBirthLocation = SafeHtmlUtils .fromString(Objects.firstNonNull(infoParent.getBirthLocation(), "")); SafeHtml safeBirthDate; if (infoParent.getBirthDate() == null) { safeBirthDate = SafeHtmlUtils.fromString(""); } else { safeBirthDate = SafeHtmlUtils.fromString(dateFormat.format(infoParent.getBirthDate())); } container.add(rowLabelValueFactory.createHeader(infoParent.getParentType().toString())); container.add(rowLabelValueFactory.createValueLabel("Nom : ", safeNom)); container.add(rowLabelValueFactory.createValueLabel("Prnom : ", safePrenom)); container.add(rowLabelValueFactory.createValueLabel("Date de naissance : ", safeBirthDate)); container.add(rowLabelValueFactory.createValueLabel("Lieu de naissance : ", safeBirthLocation)); if (infoParent.getNationality() != null) { SafeHtml safeNationality = SafeHtmlUtils.fromString(infoParent.getNationality().getLabel()); container.add(rowLabelValueFactory.createValueLabel("Nationnalit : ", safeNationality)); } if (infoParent.getParentType() == ParentType.TUTEUR) { SafeHtml safeCivilite = SafeHtmlUtils.fromString(infoParent.getCivilite().toString()); container.add(rowLabelValueFactory.createValueLabel("Civilit : ", safeCivilite)); if (!Strings.isNullOrEmpty(infoParent.getLientParente())) { SafeHtml safelienParent = SafeHtmlUtils.fromString(infoParent.getLientParente()); container.add(rowLabelValueFactory.createValueLabel("Lien de parent : ", safelienParent)); } } container.add(rowLabelValueFactory.createValueLabel("Email : ", safeEmail)); container.add(rowLabelValueFactory.createValueLabel("Tlphone domicile : ", safeTelDom)); if (!Strings.isNullOrEmpty(infoParent.getTelGsm())) { SafeHtml safeTelGsm = SafeHtmlUtils.fromString(infoParent.getTelGsm()); container.add(rowLabelValueFactory.createValueLabel("Tlphone GSM : ", safeTelGsm)); } if (!Strings.isNullOrEmpty(infoParent.getTelBureau())) { SafeHtml safeTelBureau = SafeHtmlUtils.fromString(infoParent.getTelBureau()); container.add(rowLabelValueFactory.createValueLabel("Tlphone Bureau : ", safeTelBureau)); } if (!Strings.isNullOrEmpty(infoParent.getFonction())) { SafeHtml safeFonction = SafeHtmlUtils.fromString(infoParent.getFonction()); container.add(rowLabelValueFactory.createValueLabel("Fonction : ", safeFonction)); } if (!Strings.isNullOrEmpty(infoParent.getInstitution())) { SafeHtml safeInstitution = SafeHtmlUtils.fromString(infoParent.getInstitution()); container.add(rowLabelValueFactory.createValueLabel("Institution : ", safeInstitution)); } if (!Strings.isNullOrEmpty(infoParent.getAddress())) { SafeHtml safeAdresse = SafeHtmlUtils.fromString(infoParent.getAddress()); container.add(rowLabelValueFactory.createValueLabel("Adresse : ", safeAdresse)); } if (infoParent.getParentGsr()) { SafeHtml safe = SafeHtmlUtils.fromString("oui"); container.add(rowLabelValueFactory.createValueLabel("Ancien du GSR : ", safe)); } if (!Strings.isNullOrEmpty(infoParent.getPromotionGsr())) { SafeHtml safe = SafeHtmlUtils.fromString(infoParent.getPromotionGsr().toString()); container.add(rowLabelValueFactory.createValueLabel("Promotion : ", safe)); } if (!Strings.isNullOrEmpty(infoParent.getFormationGsr())) { SafeHtml safe = SafeHtmlUtils.fromString(infoParent.getFormationGsr()); container.add(rowLabelValueFactory.createValueLabel("Formation : ", safe)); } }
From source file:com.jythonui.client.dialog.util.StandardDialog.java
License:Apache License
private static void popupDraw(PaperDialog p, HTMLPanel ha, IEventBus i) { IMainPanel iM = M.getPanel();/* w w w .ja va 2 s.com*/ HTMLPanel hM = iM.getCurrentContent().getH(); hM.add(p); p.open(); p.addIronOverlayClosedHandler(event -> { hM.remove(ha); if (i != null) i.publish(new CloseDialogHandler(), null); }); }
From source file:com.palantir.gerrit.gerritci.ui.client.JobPanels.java
License:Apache License
private static HTMLPanel getCronPanel() { HTMLPanel cronPanel = new HTMLPanel(GerritCiPlugin.cronPanel.toString()); TextBox cronCommand = new TextBox(); cronCommand.setName("cronCommand"); cronCommand.setText("./scripts/cron.sh"); TextBox cronSchedule = new TextBox(); cronSchedule.setName("cronJob"); TextBox jobType = new TextBox(); jobType.setText("cron"); jobType.setName("jobType"); jobType.setVisible(false);/*from ww w . ja v a 2s . c o m*/ cronPanel.add(jobType); cronPanel.addAndReplaceElement(cronCommand, "cronCommand"); cronPanel.addAndReplaceElement(cronSchedule, "cronJob"); addCommonFields(cronPanel); return cronPanel; }
From source file:com.palantir.gerrit.gerritci.ui.client.JobPanels.java
License:Apache License
private static HTMLPanel getPublishPanel() { HTMLPanel publishPanel = new HTMLPanel(GerritCiPlugin.publishJobPanel.toString()); TextBox publishCommand = new TextBox(); publishCommand.setName("publishCommand"); publishCommand.setText("./scripts/publish.sh"); TextBox publishBranchRegex = new TextBox(); publishBranchRegex.setName("publishBranchRegex"); publishBranchRegex.setText("refs/heads/(develop|master)"); TextBox jobType = new TextBox(); jobType.setText("publish"); jobType.setName("jobType"); jobType.setVisible(false);/*from w w w. j a va2s . co m*/ publishPanel.add(jobType); publishPanel.addAndReplaceElement(publishCommand, "publishCommand"); publishPanel.addAndReplaceElement(publishBranchRegex, "publishBranchRegex"); addCommonFields(publishPanel); return publishPanel; }
From source file:com.palantir.gerrit.gerritci.ui.client.JobPanels.java
License:Apache License
private static HTMLPanel getVerifyPanel() { HTMLPanel verifyPanel = new HTMLPanel(GerritCiPlugin.verifyJobPanel.toString()); TextBox verifyCommand = new TextBox(); verifyCommand.setName("verifyCommand"); verifyCommand.setText("./scripts/verify.sh"); TextBox verifyBranchRegex = new TextBox(); verifyBranchRegex.setName("verifyBranchRegex"); verifyBranchRegex.setText(".*"); TextBox jobType = new TextBox(); jobType.setText("verify"); jobType.setName("jobType"); jobType.setVisible(false);//w ww . j av a 2 s. c o m verifyPanel.add(jobType); verifyPanel.addAndReplaceElement(verifyCommand, "verifyCommand"); verifyPanel.addAndReplaceElement(verifyBranchRegex, "verifyBranchRegex"); addCommonFields(verifyPanel); return verifyPanel; }
From source file:com.palantir.gerrit.gerritci.ui.client.JobPanels.java
License:Apache License
public static HTMLPanel showJob(JenkinsJob j) { String name = j.getName();/*from w w w . j a v a2 s .c om*/ HTMLPanel p = new HTMLPanel(""); if (j.getType().equals("cron")) p = new HTMLPanel(GerritCiPlugin.cronPanel.toString()); else if (j.getType().equals("publish")) p = new HTMLPanel(GerritCiPlugin.publishJobPanel.toString()); else if (j.getType().equals("verify")) p = new HTMLPanel(GerritCiPlugin.verifyJobPanel.toString()); else return null; TextBox jobName = new TextBox(); jobName.setName("jobName"); jobName.setText(name); jobName.setVisible(false); Label jobNameLabel = new Label("Job Id: " + name); p.addAndReplaceElement(jobNameLabel, "jobIdLabel"); p.add(jobName); TextBox jobType = new TextBox(); jobType.setName("jobType"); jobType.setText(j.getType()); jobType.setVisible(false); p.add(jobType); int numOfParams = j.getItems().length(); for (int i = 0; i < numOfParams; i++) { JobParam jp = j.getItems().get(i); String field = jp.getField(); String value = jp.getVal(); if (field.endsWith("Enabled")) { CheckBox cb = new CheckBox(); cb.setName(field); cb.setValue(Boolean.valueOf(value)); if (p.getElementById(field) != null) p.addAndReplaceElement(cb, field); else { cb.setVisible(false); p.add(cb); } } else { TextBox tb = new TextBox(); tb.setName(field); tb.setText(makeXMLReadeable(value)); if (p.getElementById(field) != null) p.addAndReplaceElement(tb, field); else { tb.setVisible(false); p.add(tb); } } } p.setVisible(true); return p; }
From source file:com.palantir.gerrit.gerritci.ui.client.ProjectConfigurationScreen.java
License:Apache License
private HTMLPanel createJob(String jobType) { final HTMLPanel p = JobPanels.createJobPanel(jobType); TextBox jobName = new TextBox(); jobName.setName("jobName"); jobName.setText(jobType + "_" + projectName + "_" + Random.nextInt()); jobName.setVisible(false);/*from w ww . ja va 2 s .c o m*/ p.add(jobName); final Button deleteButton = new Button("delete"); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deletePanel(p); } }); p.addAndReplaceElement(deleteButton, "delete"); if (jobType.equals("cron")) { addCronToggleButton(p, deleteButton); } activePanels.add(p); return p; }
From source file:com.polymerui.client.view.panel.MainPanel.java
License:Apache License
@Override public void replaceContent(IContent i) { HTMLPanel pane = (HTMLPanel) PolymerUtil.findandverifyWidget(M.M().MainPanelIconWidget("mainpanel"), ha, "mainpanel", HTMLPanel.class); pane.clear();/*from w w w . j a v a2 s . co m*/ pane.add(i.getH()); contenti = i; }