@Override public void outputHtml(SafeHtmlBuilder output) { open(output, id, css.panel(), TypeCodes.kind(Type.PARTICIPANTS)); { open(output, null, css.flow(), null); { open(output, Components.CONTAINER.getDomId(id), null, null); { participantUis.outputHtml(output); // Overflow-mode panel. openSpan(output, null, css.extra(), null); { openSpanWith(output, null, css.toggleGroup(), null, "onclick=\"" + onClickJs() + "\""); { appendSpan(output, null, css.expandButton(), null); openSpan(output, null, null, null); { output.appendPlainText("more"); } closeSpan(output); } closeSpan(output); appendSpan(output, null, css.addButton(), TypeCodes.kind(Type.ADD_PARTICIPANT)); button( output, null, css.newWaveWithParticipantsButton(), TypeCodes.kind(Type.NEW_WAVE_WITH_PARTICIPANTS), "New wave with the participants of current wave", "New wave"); } closeSpan(output); // Single-line mode panel. openSpan(output, null, css.simple(), null); { appendSpan(output, null, css.addButton(), TypeCodes.kind(Type.ADD_PARTICIPANT)); button( output, null, css.newWaveWithParticipantsButton(), TypeCodes.kind(Type.NEW_WAVE_WITH_PARTICIPANTS), "New wave with the participants of current wave", "New wave"); } closeSpan(output); } close(output); } close(output); } close(output); }
private void addParticipant(String userId, String displayEmail, String name, String color) { DivElement rowElement = Elements.createDivElement(css.row()); DivElement swatchElement = Elements.createDivElement(css.swatch()); swatchElement.setAttribute("style", "background-color: " + color); rowElement.appendChild(swatchElement); SpanElement nameElement = Elements.createSpanElement(css.name()); nameElement.setTextContent(name); nameElement.setTitle(displayEmail); rowElement.appendChild(nameElement); getElement().appendChild(rowElement); rows.put(userId, rowElement); }
@Override public void outputHtml(SafeHtmlBuilder output) { // HACK HACK HACK // This code should be automatically generated from UiBinder template, not // hand written. open(output, id, css.blip(), TypeCodes.kind(Type.BLIP)); // Meta (no wrapper). meta.outputHtml(output); // Replies. open(output, Components.REPLIES.getDomId(id), css.replies(), null); replies.outputHtml(output); close(output); // Private Replies. open(output, Components.PRIVATE_REPLIES.getDomId(id), css.privateReplies(), null); privateReplies.outputHtml(output); close(output); close(output); }
public TextLayout add(Css css) { TextLayout newL = clone(); for (P p : css.getProperties()) { newL.getProperties().add(p); } return newL; }
/** @return a JS click handler for toggling expanded and collapsed modes. */ private String onClickJs() { String js = "" // + "var p=document.getElementById('" + id + "');" // + "var x=p.getAttribute('s')=='e';" // + "var l=this.lastChild;" // + "p.style.height=x?'':'auto';" // + "p.setAttribute('s',x?'':'e');" // + "lastChild.innerHTML=x?'more':'less';" // + "firstChild.className=x?'" + css.expandButton() + "':'" + css.collapseButton() + "';" // + "parentNode.nextSibling.style.display=x?'':'none';" // ; // The constructed string has no double-quote characters in it, so it can be // double-quoted verbatim. assert !js.contains("\""); return js; }
View(Resources res) { this.res = res; this.css = res.workspaceNavigationParticipantListCss(); setElement(Elements.createDivElement(css.root())); }
static { StyleInjector.inject(css.getText(), true); }