@Override public void showEmpty(String message) { SpanElement span = Document.get().createSpanElement(); span.setInnerText(message); DivElement gi = createItemDiv(new Element[] {span}); perspectivesDiv.appendChild((Node) gi); }
private void createPrintServiceOverlay(Document document, DivElement parent) { printServiceOverlay = createChildDiv(document, parent, "printServiceOverlay"); printServiceOverlay.addClassName("container"); printServiceOverlay.addClassName("hidden"); DivElement dialog = createChildDiv(document, printServiceOverlay, "dialog"); DivElement row1 = createChildDiv(document, dialog, "row"); SpanElement message = createChildSpan(document, row1, ""); message.setInnerText("Preparing document for printing!"); DivElement row2 = createChildDiv(document, dialog, "row"); createChildProgress(document, row2, 0, 100); SpanElement relativeProgressSpan = createChildSpan(document, row2, "relative-progress"); relativeProgressSpan.setInnerText("0%"); DivElement row3 = createChildDiv(document, dialog, "row"); printCancel = createChildButton(document, row3, "printCancel"); printCancel.addClassName("overlayButton"); SpanElement printCancelMessage = createChildSpan(document, printCancel, ""); printCancelMessage.setInnerText("Cancel"); }
@Override public Element createDomImpl(Renderable element) { InputElement inputElem = Document.get().createCheckInputElement(); inputElem.setClassName(CheckConstants.css.check()); // Wrap in non-editable span- Firefox does not fire events for checkboxes // inside contentEditable region. SpanElement nonEditableSpan = Document.get().createSpanElement(); DomHelper.setContentEditable(nonEditableSpan, false, false); nonEditableSpan.appendChild(inputElem); return nonEditableSpan; }
/** * Create a diff annotation element * @param type The type of change it will be annotating * @return The newly created element */ public Element createElement(DiffType type) { SpanElement element = Document.get().createSpanElement(); element.setPropertyObject(DIFF_KEY, type); NodeManager.setTransparentBackref(element, this); // HACK(danilatos): Demo looms, no time for learning how to use resource bundle etc. // or adding accessors to stylebase switch (type) { case INSERT: NodeManager.setTransparency(element, Skip.SHALLOW); break; case DELETE: NodeManager.setTransparency(element, Skip.DEEP); break; } styleElement(element, type); elements.add(element); return element; }
private void buildActionBar() { disableBulkActions(); actionBar.addStyleName(AppStyles.ACTION_BAR); SpanElement listFilterLabel = Document.get().createSpanElement(); listFilterLabel.setInnerText("Show"); buttonSet.getElement().appendChild(listFilterLabel); buttonSet.add(selectNoteList); SpanElement selectLabel = Document.get().createSpanElement(); selectLabel.setInnerText("Select:"); buttonSet.getElement().appendChild(selectLabel); buttonSet.add(selectAll); buttonSet.add(selectNone); buttonSet.add(deleteButton); // buttonSet.add(showHistory); actionBar.add(buttonSet); }
private Element renderCategoryHeader(String category) { SpanElement categoryElement = Document.get().createSpanElement(); categoryElement.setClassName(resources.defaultCategoriesListCss().headerText()); SpanElement iconElement = Document.get().createSpanElement(); categoryElement.appendChild(iconElement); SpanElement textElement = Document.get().createSpanElement(); categoryElement.appendChild(textElement); textElement.setInnerText(category); Icon icon = iconRegistry.getIconIfExist(category + ".samples.category.icon"); if (icon != null) { final SVGImage iconSVG = icon.getSVGImage(); if (iconSVG != null) { iconElement.appendChild(iconSVG.getElement()); return categoryElement; } } return categoryElement; }
@Override public void renderElement(Element element, ClasspathEntryDto data) { SpanElement categoryHeaderElement = Document.get().createSpanElement(); categoryHeaderElement.setClassName(classpathResources.getCss().elementHeader()); element.appendChild(categoryHeaderElement); SpanElement iconElement = Document.get().createSpanElement(); if (data.getPath().endsWith(".jar")) { iconElement.appendChild(javaResources.jarFileIcon().getSvg().getElement()); } categoryHeaderElement.appendChild(iconElement); Element textElement = createNameOfElement(data.getPath()); textElement.addClassName(classpathResources.getCss().elementLabel()); categoryHeaderElement.appendChild(textElement); element.appendChild(categoryHeaderElement); }
private static LIElement _createBaseTagElement() { // <ul class='tags'> // <li><span><img />Tag1</span></li> // <li><span><img />Tag1</span></li> // ... // </ul> LIElement containerLIEl = DOM.createElement("li").cast(); SpanElement spanEl = DOM.createSpan().cast(); ImageElement imgEl = DOM.createImg().cast(); // assemble the structure spanEl.appendChild(imgEl); spanEl.appendChild(Document.get().createTextNode("")); containerLIEl.appendChild(spanEl); return containerLIEl; }
private SpanElement createSpanElement(final Cursor cursor, final double left, final double width) { final SpanElement span = document.createSpanElement(); span.setAttribute("title", title); final Style style = span.getStyle(); style.setCursor(cursor); style.setPosition(Position.ABSOLUTE); style.setBottom(0, PX); style.setHeight(source.getOffsetHeight(), PX); style.setTop(source.getOffsetTop(), PX); style.setWidth(width, PX); style.setLeft(left, PX); return span; }
@Override public void declareVariable(String var, String description) { SpanElement span = Document.get().createSpanElement(); span.setInnerText(var); AnchorElement anchor = Document.get().createAnchorElement(); anchor.setTitle(description); anchor.appendChild(span); LIElement li = Document.get().createLIElement(); li.getStyle().setCursor(Style.Cursor.POINTER); li.appendChild(anchor); variablesMenu.appendChild((Node) li); Event.sinkEvents(anchor, Event.ONCLICK); Event.setEventListener(anchor, event -> { if(Event.ONCLICK == event.getTypeInt()) { presenter.onVariableSelected(var); } }); }
@Override public void addPerspective(String name, Command onClicked) { AnchorElement anchor = Document.get().createAnchorElement(); anchor.getStyle().setCursor(Style.Cursor.POINTER); anchor.getStyle().setColor("black"); anchor.getStyle().setProperty("fontSize", "larger"); anchor.setInnerText(name); Event.sinkEvents(anchor, Event.ONCLICK); Event.setEventListener(anchor, event -> { if(Event.ONCLICK == event.getTypeInt()) { onClicked.execute(); } }); SpanElement icon = Document.get().createSpanElement(); icon.getStyle().setMarginRight(10, Style.Unit.PX); icon.setClassName("pficon-virtual-machine"); icon.getStyle().setProperty("fontSize", "larger"); DivElement gi = createItemDiv(new Element[] {icon, anchor}); perspectivesDiv.appendChild((Node) gi); }
private void ensureTdOk() { TableCellElement td = getTd(); if( td == null ) return; int count = td.getChildCount(); if( count <= 0 ) { SpanElement treeView = Document.get().createSpanElement(); td.appendChild( treeView ); DOM.sinkEvents( treeView, Event.ONCLICK ); DOM.setEventListener( treeView, this ); } if( count <= 1 ) { SpanElement content = Document.get().createSpanElement(); td.appendChild( content ); } }
public void setValue(T value) { this.value = value; double val = 0; if (value == null) { val = this.min; } else { val = value.doubleValue(); } if (val > this.max) { val = this.max; } else if (val < this.min) { val = this.min; } this.progressBarElement.setAttribute(OutputProgressBar.ATT_ARIA_VALUE, value + ""); double percent = 100 * (val - this.min) / (this.max - this.min); this.progressBarElement.getStyle().setProperty("width", percent, Unit.PCT); NumberFormat formatter = NumberFormat.getFormat("#.##"); String stringToDisplay = this.format; stringToDisplay = RegExp.compile("\\{0\\}").replace(stringToDisplay, formatter.format(val)); stringToDisplay = RegExp.compile("\\{1\\}").replace(stringToDisplay, formatter.format(percent)); stringToDisplay = RegExp.compile("\\{2\\}").replace(stringToDisplay, formatter.format(this.min)); stringToDisplay = RegExp.compile("\\{3\\}").replace(stringToDisplay, formatter.format(this.max)); this.progressBarElement.removeAllChildren(); if (this.displayValue) { this.progressBarElement.setInnerText(stringToDisplay); } else { SpanElement reader = Document.get().createSpanElement(); reader.setInnerText(stringToDisplay); reader.addClassName("sr-only"); this.progressBarElement.appendChild(reader); } }
@Override public void redraw() { this.getElement().removeAllChildren(); for (Token<?> token : this.tokenList) { if (token.getContent() != null && token.getContent() instanceof CssRendererTokenContent && ((CssRendererTokenContent) token.getContent()).getCssStyle() != null) { SpanElement spanElement = Document.get().createSpanElement(); spanElement.addClassName(((CssRendererTokenContent) token.getContent()).getCssStyle()); spanElement.setInnerText(token.getText()); this.getElement().appendChild(spanElement); } else { Text textElement = Document.get().createTextNode(token.getText()); this.getElement().appendChild(textElement); } } }
private SpanElement createSpanElement(String innerText, String title, String backgroundColor, Cursor cursor, double left){ final SpanElement span = document.createSpanElement(); span.setInnerText(innerText); span.setAttribute("title", title); final Style style = span.getStyle(); style.setCursor(cursor); style.setPosition(Position.ABSOLUTE); style.setBottom(0, PX); style.setHeight(source.getOffsetHeight(), PX); style.setTop(source.getOffsetTop(), PX); style.setColor(FOREGROUND_COLOR); style.setWidth(RESIZE_HANDLE_WIDTH, PX); style.setLeft(left, PX); style.setBackgroundColor(backgroundColor); return span; }
private ParagraphElement addDocumentPropertiesRow(Document document, DivElement dialog, String label) { DivElement row = createChildDiv(document, dialog, "row"); SpanElement span = createChildSpan(document, row, ""); span.setInnerText(label); ParagraphElement result = createChildP(document, row); result.setInnerText("-"); return result; }
void toGwtWidget( final PromptlyPanel promptlyPanel, FlowPanel outerWidget, boolean withFormatting, String outerClassOverride ) { if (outerClassOverride != null) { outerWidget.getElement().setAttribute("class", outerClassOverride); } for (StyledParagraphItem paragraphItem : _items) { final String text = paragraphItem.getText(); final String style = paragraphItem.getStyle(); FlowPanel spanElement = new FlowPanel(SpanElement.TAG /* <span> tag */ ); spanElement.getElement().setInnerText(text); if (withFormatting && style != null) { spanElement.getElement().setAttribute("style", style); } final ItemListener callback = paragraphItem.getCallback(); if (callback != null) { Hyperlink hl = new Hyperlink(promptlyPanel, promptlyPanel.getNextHyperlinkIdAndIncrement(), callback, text); spanElement.addDomHandler(hl , ClickEvent.getType()); spanElement.getElement().setAttribute("onMouseOver", "this.style.fontWeight='normal'"); spanElement.getElement().setAttribute("onMouseOut", "this.style.fontWeight='normal'"); } outerWidget.add(spanElement); } }
public MenuItemWidget(CubaSideMenuWidget menu, String id, Icon icon, String styleName, String caption, boolean captionAsHtml) { this.menu = menu; this.id = id; setElement(Document.get().createDivElement()); setStylePrimaryName(menu.getStylePrimaryName() + "-item"); addStyleDependentName("action"); if (styleName != null) { for (String style : styleName.split(" ")) { if (!style.isEmpty()) { addStyleName(style); } } } SpanElement wrapElement = Document.get().createSpanElement(); wrapElement.setClassName(getStylePrimaryName() + "-wrap"); if (icon != null) { wrapElement.appendChild(icon.getElement()); } captionElement = Document.get().createSpanElement(); captionElement.setClassName(getStylePrimaryName() + "-caption"); if (caption != null) { if (captionAsHtml) { captionElement.setInnerHTML(caption); } else { captionElement.setInnerText(caption); } } badgeElement = Document.get().createSpanElement(); badgeElement.setClassName(getStylePrimaryName() + "-badge"); wrapElement.appendChild(captionElement); getElement().appendChild(wrapElement); addDomHandler(this, ClickEvent.getType()); }
@Override public SpanElement renderCategory(Category<ProjectImporterDescriptor> category) { SpanElement textElement = Document.get().createSpanElement(); textElement.setClassName(resources.defaultCategoriesListCss().headerText()); textElement.setInnerText(category.getTitle()); return textElement; }
@Override public com.google.gwt.dom.client.SpanElement renderCategory( Category<PreferencePagePresenter> category) { SpanElement spanElement = Document.get().createSpanElement(); spanElement.setClassName(resources.defaultCategoriesListCss().headerText()); spanElement.setInnerText(category.getTitle()); return spanElement; }
private Element getIconElement(Object icon) { if (icon instanceof SVGResource) { return ((SVGResource) icon).getSvg().getElement(); } else if (icon instanceof String) { SpanElement element = Document.get().createSpanElement(); element.getStyle().setFontSize(11., Style.Unit.PT); element.getStyle().setMarginTop(2., Style.Unit.PT); element.setInnerHTML((String) icon); return element; } throw new IllegalArgumentException("Icon type is undefined"); }
@Override public SpanElement renderCategory(Category<ClasspathPagePresenter> category) { SpanElement spanElement = Document.get().createSpanElement(); spanElement.setClassName(commandResources.getCss().categoryHeader()); spanElement.setInnerText(category.getTitle()); return spanElement; }
private DragArea buildTitleWidget(final String title, final IsWidget titleDecoration) { final SpanElement spanElement = buildTitleTextWidget(title, titleDecoration); final DragArea dragArea = new DragArea(); dragArea.add(spanElement); dragArea.ensureDebugId(DEBUG_TITLE_PREFIX + title); dragArea.addMouseDownHandler(new NoMouseDownHandler()); return dragArea; }
private SpanElement buildTitleTextWidget(final String title, final IsWidget titleDecoration) { final SpanElement spanElement = Document.get().createSpanElement(); spanElement.addClassName("uf-listbar-panel-header-title-text"); spanElement.addClassName(CSSLocatorsUtils.buildLocator("qe-list-bar-header", title)); final String titleWidget = (titleDecoration instanceof Image) ? titleDecoration.toString() : ""; spanElement.setInnerHTML(titleWidget + " " + title.replaceAll(" ", "\u00a0")); spanElement.setTitle(title); return spanElement; }
protected void addItem(String iconClass, String id, String name, String description, Command onClicked) { Element nameEl = onClicked != null ? Document.get().createAnchorElement() : Document.get().createSpanElement(); nameEl.setInnerText(name); nameEl.setClassName(onClicked != null ? "uf-navtree-widget-non-clicked" : "uf-navtree-widget-non-clickable"); if (description != null && !description.equals(name)) { nameEl.setTitle(description); } SpanElement iconSpan = Document.get().createSpanElement(); iconSpan.setClassName("uf-navtree-widget-icon " + iconClass); DivElement div = Document.get().createDivElement(); div.appendChild(iconSpan); div.appendChild(nameEl); navWidget.appendChild((Node) div); itemMap.put(id, nameEl); if (onClicked != null) { Event.sinkEvents(nameEl, Event.ONCLICK); Event.setEventListener(nameEl, event -> { if (Event.ONCLICK == event.getTypeInt()) { onClicked.execute(); } }); } }
public void print(String j,int calc, PrayTime p, double latitude,double longitude, int day){ Element sub = DOM.getElementById("prayer-times-"+j+"-" + day); if(sub != null){ String[] dateTitle = p.getMonthInfo(day); sub.removeAllChildren(); Document doc = Document.get(); DivElement l = doc.createDivElement(); l.setAttribute("class", "timeslot__label g-color-slate-grey js-timeslot-label js-sticky-element fixed"); l.setAttribute("style", "position: absolute; top: 0px; width: 100px; height: 100px; overflow: hidden; display: block; z-index: 1000; -webkit-transform: translate3d(0px, 0px, 0px); left: 0px;"); l.setInnerHTML(dateTitle[0] +"<span>"+dateTitle[1]+"</span>"); sub.appendChild(l); DivElement l1 = doc.createDivElement(); l1.setAttribute("class", "event__content -quran"); l1.setAttribute("id", "prayer-times-2"); String html = p.print(latitude, longitude, title, day); l1.setInnerHTML(html); sub.appendChild(l1); //<span class="video-card__speakers g-light-grey" style="position:relative; bottom:0; right:0; font-size:10px;">Shafii,ISNA</span> SpanElement l2 = doc.createSpanElement(); l2.setAttribute("class", "video-card__speakers g-light-grey"); l2.setAttribute("style", "position:relative; bottom:0; right:0; font-size:10px;"); l2.setInnerText(createSubText(j, calc)); sub.appendChild(l2); if(j.equals("Shafii") && calc == 0){ //updateDescription(html); } } }
/** * Set title. * @param title the title */ public void setTitle(String title) { if (showCaption) { if (optional) { recordCaption.setCaptionText(title); } else { SpanElement span = Document.get().createSpanElement(); span.appendChild(Document.get().createTextNode(title)); span.addClassName("gwt-Label"); span.addClassName(REQUIRED); recordCaption.setCaptionHTML(span.getString()); } } }
private void showError(String message) { final SpanElement errorElement = getElement().appendChild( Document.get().createSpanElement()); errorElement.setClassName("header-new-author-error"); final Style errorStyle = errorElement.getStyle(); errorStyle.setProperty("color", "#800"); errorStyle.setProperty("paddingLeft", "2px"); errorStyle.setProperty("fontSize", "80%"); errorElement.setInnerText(message); addHandler(this, ClickEvent.getType()); sinkEvents(Event.ONCLICK); }
private SpanElement createSpan(Document document, String className) { SpanElement result = document.createSpanElement(); result.addClassName(className); return result; }
@Override public Element createDomImpl(Renderable element) { SpanElement domElement = Document.get().createSpanElement(); return element.setAutoAppendContainer(domElement); }
@Override public SpanElement renderCategory(Category<HotKeyItem> category) { SpanElement spanElement = Document.get().createSpanElement(); spanElement.setInnerText(category.getTitle()); return spanElement; }
private SpanElement renderCategoryHeader(final String categoryTitle) { SpanElement categoryHeaderElement = Document.get().createSpanElement(); categoryHeaderElement.setClassName(editConfigurationsResources.getCss().categoryHeader()); SpanElement iconElement = Document.get().createSpanElement(); categoryHeaderElement.appendChild(iconElement); SpanElement textElement = Document.get().createSpanElement(); categoryHeaderElement.appendChild(textElement); DebugConfigurationType currentDebugConfigurationType = getTypeById(categoryTitle); textElement.setInnerText( currentDebugConfigurationType != null ? currentDebugConfigurationType.getDisplayName() : categoryTitle); SpanElement buttonElement = Document.get().createSpanElement(); buttonElement.appendChild( editConfigurationsResources.addConfigurationButton().getSvg().getElement()); categoryHeaderElement.appendChild(buttonElement); Event.sinkEvents(buttonElement, Event.ONCLICK); Event.setEventListener( buttonElement, new EventListener() { @Override public void onBrowserEvent(Event event) { if (Event.ONCLICK == event.getTypeInt()) { event.stopPropagation(); namePanel.setVisible(true); selectedType = getTypeById(categoryTitle); delegate.onAddClicked(); resetFilter(); } } }); Icon icon = iconRegistry.getIconIfExist(categoryTitle + ".debug.configuration.type.icon"); if (icon != null) { final SVGImage iconSVG = icon.getSVGImage(); if (iconSVG != null) { iconElement.appendChild(iconSVG.getElement()); return categoryHeaderElement; } } return categoryHeaderElement; }
/** * Creates a single tree node from the given trace node. * @param node */ protected LIElement createTreeNode(TraceNodeBean node) { String nodeId = String.valueOf(nodeIdCounter++); nodeMap.put(nodeId, node); boolean isCall = "Call".equals(node.getType()); //$NON-NLS-1$ boolean hasChildren = !node.getTasks().isEmpty(); LIElement li = Document.get().createLIElement(); li.setClassName(hasChildren ? "parent_li" : "leaf_li"); //$NON-NLS-1$ //$NON-NLS-2$ if (hasChildren) li.setAttribute("role", "treeitem"); //$NON-NLS-1$ //$NON-NLS-2$ SpanElement span = Document.get().createSpanElement(); span.setAttribute("data-nodeid", nodeId); //$NON-NLS-1$ Element icon = Document.get().createElement("i"); //$NON-NLS-1$ span.appendChild(icon); span.appendChild(Document.get().createTextNode(" ")); //$NON-NLS-1$ if (isCall) { span.setClassName(node.getStatus()); icon.setClassName("icon-minus-sign"); //$NON-NLS-1$ span.appendChild(Document.get().createTextNode(node.getOperation())); span.appendChild(Document.get().createTextNode(":")); //$NON-NLS-1$ span.appendChild(Document.get().createTextNode(node.getComponent())); } else { span.appendChild(Document.get().createTextNode(node.getDescription())); span.setClassName("Info"); //$NON-NLS-1$ icon.setClassName("icon-info-sign"); //$NON-NLS-1$ } li.appendChild(span); if (node.getDuration() != -1) { li.appendChild(Document.get().createTextNode(" [")); //$NON-NLS-1$ li.appendChild(Document.get().createTextNode(String.valueOf(node.getDuration()))); li.appendChild(Document.get().createTextNode("ms]")); //$NON-NLS-1$ } if (node.getPercentage() != -1) { li.appendChild(Document.get().createTextNode(" (")); //$NON-NLS-1$ li.appendChild(Document.get().createTextNode(String.valueOf(node.getPercentage()))); li.appendChild(Document.get().createTextNode("%)")); //$NON-NLS-1$ } if (hasChildren) { UListElement ul = Document.get().createULElement(); ul.setAttribute("role", "group"); //$NON-NLS-1$ //$NON-NLS-2$ li.appendChild(ul); List<TraceNodeBean> tasks = node.getTasks(); for (TraceNodeBean task : tasks) { LIElement tn = createTreeNode(task); ul.appendChild(tn); } } return li; }
@Override protected InputElement getInputElement(Element parent) { return parent.getFirstChildElement().<SpanElement> cast(). getFirstChildElement().<InputElement> cast(); }