Search in sources :

Example 6 with VirtualConsole

use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.

the class ChunkOutputStream method initConsole.

private void initConsole() {
    if (console_ == null) {
        console_ = new PreWidget();
        console_.getElement().removeAttribute("tabIndex");
        console_.getElement().getStyle().setMarginTop(0, Unit.PX);
        console_.getElement().getStyle().setProperty("whiteSpace", "pre-wrap");
    } else {
        console_.getElement().setInnerHTML("");
    }
    if (vconsole_ == null)
        vconsole_ = new VirtualConsole(console_.getElement());
    else
        vconsole_.clear();
    // attach the console
    addWithOrdinal(console_, maxOrdinal_ + 1);
}
Also used : VirtualConsole(org.rstudio.core.client.VirtualConsole) PreWidget(org.rstudio.core.client.widget.PreWidget)

Example 7 with VirtualConsole

use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.

the class VirtualConsoleTests method testColorSplit.

public void testColorSplit() {
    PreElement ele = Document.get().createPreElement();
    VirtualConsole vc = new VirtualConsole(ele);
    vc.submit("123456");
    vc.submit("\b\b\b\bXX", "X");
    Assert.assertEquals("<span>12</span>" + "<span class=\"X\">XX</span>" + "<span>56</span>", ele.getInnerHTML());
}
Also used : VirtualConsole(org.rstudio.core.client.VirtualConsole) PreElement(com.google.gwt.dom.client.PreElement)

Example 8 with VirtualConsole

use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.

the class VirtualConsoleTests method testTwoColors.

public void testTwoColors() {
    PreElement ele = Document.get().createPreElement();
    VirtualConsole vc = new VirtualConsole(ele);
    vc.submit("Output 1", "one");
    vc.submit("Output 2", "two");
    Assert.assertEquals("<span class=\"one\">Output 1</span>" + "<span class=\"two\">Output 2</span>", ele.getInnerHTML());
}
Also used : VirtualConsole(org.rstudio.core.client.VirtualConsole) PreElement(com.google.gwt.dom.client.PreElement)

Example 9 with VirtualConsole

use of org.rstudio.core.client.VirtualConsole in project rstudio by rstudio.

the class VirtualConsoleTests method testColorOverlap.

public void testColorOverlap() {
    PreElement ele = Document.get().createPreElement();
    VirtualConsole vc = new VirtualConsole(ele);
    vc.submit("123", "A");
    vc.submit("456", "B");
    vc.submit("\b\b\b\bXX", "X");
    Assert.assertEquals("<span class=\"A\">12</span>" + "<span class=\"X\">XX</span>" + "<span class=\"B\">56</span>", ele.getInnerHTML());
}
Also used : VirtualConsole(org.rstudio.core.client.VirtualConsole) PreElement(com.google.gwt.dom.client.PreElement)

Aggregations

VirtualConsole (org.rstudio.core.client.VirtualConsole)9 PreElement (com.google.gwt.dom.client.PreElement)6 Element (com.google.gwt.dom.client.Element)1 SpanElement (com.google.gwt.dom.client.SpanElement)1 PreWidget (org.rstudio.core.client.widget.PreWidget)1