use of com.google.gwt.dom.client.SpanElement in project che by eclipse.
the class CategoriesPageViewImpl method renderCategoryHeader.
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;
}
use of com.google.gwt.dom.client.SpanElement in project rstudio by rstudio.
the class ShellWidget method output.
private boolean output(String text, String className, boolean addToTop) {
if (text.indexOf('\f') >= 0)
clearOutput();
Element outEl = output_.getElement();
if (addToTop) {
SpanElement leading = Document.get().createSpanElement();
outEl.insertFirst(leading);
VirtualConsole console = new VirtualConsole(leading);
console.submit(text, className);
lines_ += DomUtils.countLines(leading, true);
} else {
// create trailing output console if it doesn't already exist
if (virtualConsole_ == null) {
SpanElement trailing = Document.get().createSpanElement();
outEl.appendChild(trailing);
virtualConsole_ = new VirtualConsole(trailing);
}
int oldLineCount = DomUtils.countLines(virtualConsole_.getParent(), true);
virtualConsole_.submit(text, className);
int newLineCount = DomUtils.countLines(virtualConsole_.getParent(), true);
lines_ += newLineCount - oldLineCount;
}
boolean result = !trimExcess();
resizeCommand_.nudge();
return result;
}
use of com.google.gwt.dom.client.SpanElement in project rstudio by rstudio.
the class DomUtilsTests method testCountLinesRecursive.
public void testCountLinesRecursive() {
PreElement pre = Document.get().createPreElement();
SpanElement s1 = Document.get().createSpanElement();
s1.setInnerText("Line1\nLine2\n");
pre.appendChild(s1);
SpanElement s2 = Document.get().createSpanElement();
s2.setInnerText("Line3\n");
pre.appendChild(s2);
Assert.assertEquals(3, DomUtils.countLines(pre, true));
}
use of com.google.gwt.dom.client.SpanElement in project che by eclipse.
the class TargetsViewImpl method renderCategoryHeader.
private SpanElement renderCategoryHeader(final Category<Target> category) {
SpanElement categoryHeaderElement = Document.get().createSpanElement();
categoryHeaderElement.setClassName(commandResources.getCss().categoryHeader());
categoryHeaderElement.appendChild(createMachineLabel(category.getTitle()));
SpanElement textElement = Document.get().createSpanElement();
categoryHeaderElement.appendChild(textElement);
textElement.setInnerText(category.getTitle());
if (machineLocale.targetsViewCategorySsh().equalsIgnoreCase(category.getTitle())) {
// Add button to create a target
SpanElement buttonElement = Document.get().createSpanElement();
buttonElement.appendChild(commandResources.addCommandButton().getSvg().getElement());
categoryHeaderElement.appendChild(buttonElement);
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
event.stopPropagation();
event.preventDefault();
delegate.onAddTarget(category.getTitle());
}
});
} else {
// Add empty span for properly aligning items
categoryHeaderElement.appendChild(Document.get().createSpanElement());
}
return categoryHeaderElement;
}
use of com.google.gwt.dom.client.SpanElement in project gwt-test-utils by gwt-test-utils.
the class UiBinderWithWidgetsTest method uiObjectTag.
@Test
public void uiObjectTag() {
// Given
UiBinderWithWidgets w = new UiBinderWithWidgets("gael", "eric");
// When
RootPanel.get().add(w);
// Then
assertThat(w.listBox.getVisibleItemCount()).isEqualTo(1);
HTMLPanel wrappedPanel = GwtReflectionUtils.callPrivateMethod(w, "getWidget");
assertThat(wrappedPanel.getWidget(0)).isEqualTo(w.listBox);
assertThat(w.radioButton1.getText()).isEqualTo("Test radio 1");
assertThat(w.radioButton1.getName()).isEqualTo("MyRadioGroup");
assertThat(w.radioButton1.getValue()).isTrue();
assertThat(w.radioButton2.getText()).isEqualTo("Test radio 2");
assertThat(w.radioButton2.getName()).isEqualTo("MyRadioGroup");
assertThat(w.radioButton2.getValue()).isFalse();
assertThat(w.image.getUrl()).isEqualTo(MyClientBundle.INSTANCE.cellTableLoading().getSafeUri().asString());
assertThat(w.image.getAltText()).isEqualTo("Loading...");
assertThat(w.image.getStyleName()).isEqualTo("pretty");
assertThat(w.imageWithUrl.getUrl()).isEqualTo("http://slazzer.com/image.jpg");
assertThat(w.providedLabel.getText()).isEqualTo("my provided label");
assertThat(w.providedLabel.getCustomText()).isEqualTo("custom text setup in ui.xml");
assertThat(w.providedLabel.providedString).isEqualTo("my provided string");
assertThat(w.providedLabel.getStyleName()).isEqualTo("disabled");
assertThat(w.uiFactoryLabel.getText()).isEqualTo("my UiFactory label");
assertThat(w.uiFactoryLabel.getCustomText()).isEqualTo("custom text setup in ui.xml");
assertThat(w.uiFactoryLabel.uiFactoryString).isEqualTo("gael");
assertThat(w.uiConstructorLabel.getText()).isEqualTo("my UiConstructor label");
assertThat(w.uiConstructorLabel.getCustomText()).isEqualTo("custom text setup in ui.xml");
assertThat(w.uiConstructorLabel.uiConstructorLabel).isEqualTo("uiConstructor property");
Label label = (Label) wrappedPanel.getWidget(1);
assertThat(label).isNotNull();
assertThat(label.getText()).isEqualTo("Keep your ducks");
SpanElement spanElement = Document.get().getElementById("mySpan").cast();
assertThat(spanElement.getInnerText()).isEqualTo("some span for testing");
assertThat(spanElement.getClassName()).isEqualTo("pretty");
assertThat(w.msgLabel.getText()).isEqualTo("We strongly urge you to reconsider.");
assertThat(w.msgInnerWidget.getText()).isEqualTo("9'00");
assertThat(wrappedPanel.getWidget(5)).isEqualTo(w.msgInnerWidget);
assertThat(w.verticalPanel.getHorizontalAlignment()).isEqualTo(HasHorizontalAlignment.ALIGN_LEFT);
assertThat(w.verticalPanel.getVerticalAlignment()).isEqualTo(HasVerticalAlignment.ALIGN_MIDDLE);
// Thenion on specific style
assertThat(w.style.getName()).isEqualTo("style");
assertThat(w.style.disabled()).isEqualTo("disabled");
assertThat(w.style.getText()).isEqualTo(".redBox {background-color: pink;border: 1px solid red;}.enabled {color: black;}.disabled {color: gray;}");
// Thenion on inner style
assertThat(w.pushButton.getStyleName()).isEqualTo("gwt-PushButton testStyle pretty gwt-PushButton-up");
// Thenion on inner image
assertThat(w.img.getName()).isEqualTo("img");
assertThat(w.img.getSafeUri().asString()).isEqualTo("http://127.0.0.1:8888/gwt_test_utils_module/img.jpg");
// Thenion on inner data
assertThat(w.data.getName()).isEqualTo("data");
assertThat(w.data.getSafeUri().asString()).isEqualTo("http://127.0.0.1:8888/gwt_test_utils_module/MyChildConstants.properties");
// Thenion on "IsWidget
assertThat(w.isWidgetLabel.getText()).isEqualTo("isWidget Label");
assertThat(DOM.getStyleAttribute(w.textBox.getElement(), "textAlign")).isEqualTo("justify");
}
Aggregations