private void manageChunkIcons(AceEditorNative editor) { Element container = editor.getContainer(); if (container == null) return; Element[] icons = DomUtils.getElementsByClassName(container, ThemeStyles.INSTANCE.inlineChunkToolbar()); for (Element icon : icons) icon.removeFromParent(); if (!uiPrefs_.showInlineToolbarForRCodeChunks().getValue()) return; if (!shouldDisplayIcons(editor)) return; Element[] chunkStarts = DomUtils.getElementsByClassName("rstudio_chunk_start ace_start"); for (int i = 0; i < chunkStarts.length; i++) { Element el = chunkStarts[i]; if (isPseudoMarker(el)) continue; if (!isRunnableChunk(el, editor)) continue; if (!DomUtils.isVisibleVert(container, el)) continue; if (el.getChildCount() > 0) el.removeAllChildren(); addToolbar(el, isSetupChunk(el, editor), editor); } }
/** {@inheritDoc} */ @Override public void onChildAdded(Node child, Element paragraph) { Element spacer = getSpacer(paragraph); if (spacer.hasParentElement()) { spacer.removeFromParent(); } }
private void onEnd(DomEvent<?> event) { Element relativeElement = event.getRelativeElement(); String modeS = relativeElement.getAttribute("mode"); // Element target = event.getNativeEvent().getEventTarget().cast(); if (addList.getElement().isOrHasChild(relativeElement)) { if (modeS.isEmpty()) { handleAddClick(); } else { int mode = Integer.parseInt(modeS); addAssignment(mode); relativeElement.removeFromParent(); userAddModes.setVisible(false); } event.stopPropagation(); } else { userAddModes.setVisible(false); event.stopPropagation(); } }
public void testRenderer() { Renderer r = GWT.create(Renderer.class); SafeHtmlBuilder b = new SafeHtmlBuilder(); r.render(b, values); Element e = UiBinderUtil.fromHtml(b.toSafeHtml().asString()); Document.get().getBody().appendChild(e); try { assertEquals(values.anUnsafeUri(), r.getJsAnchorFromSafeUri(e).getHref()); AnchorElement anchor = expectedEscapedAnchor(); assertEquals(anchor.getHref(), r.getJsAnchorFromString(e).getHref()); assertEquals("http://www.google.com/images/logo_sm.gif", r.getInlineHttpAnchor(e).getHref()); assertEquals("javascript:void(0)", r.getInlineJavascriptAnchor(e).getHref()); assertEquals( values.aSelector() + values.aGifPath(), r.getHttpAnchorFromConstructedString(e).getHref()); } finally { e.removeFromParent(); } }