Search in sources :

Example 21 with DivElement

use of com.google.gwt.dom.client.DivElement in project che by eclipse.

the class AbstractPresentationRenderer method getInfoTextContainer.

/** {@inheritDoc} */
@Override
public Element getInfoTextContainer(Element content) {
    DivElement divElement = Document.get().createDivElement();
    divElement.setClassName(treeStyles.styles().infoTextContainer());
    divElement.appendChild(content);
    return divElement;
}
Also used : DivElement(com.google.gwt.dom.client.DivElement)

Example 22 with DivElement

use of com.google.gwt.dom.client.DivElement in project che by eclipse.

the class EmptyEditorsPanel method renderAction.

private Node renderAction(String title, final Action action) {
    final Presentation presentation = presentationFactory.getPresentation(action);
    Element divElement = Elements.createDivElement(style.listElement());
    divElement.addEventListener("click", new EventListener() {

        @Override
        public void handleEvent(Event evt) {
            ActionEvent event = new ActionEvent(presentation, actionManager, perspectiveManagerProvider.get());
            action.actionPerformed(event);
        }
    }, true);
    divElement.getStyle().setCursor("pointer");
    divElement.getStyle().setColor(Style.getOutputLinkColor());
    Element label = Elements.createDivElement(style.actionLabel());
    label.setInnerText(title);
    divElement.appendChild(label);
    String hotKey = KeyMapUtil.getShortcutText(keyBindingAgent.getKeyBinding(actionManager.getId(action)));
    if (hotKey == null) {
        hotKey = " ";
    } else {
        hotKey = "<nobr>&nbsp;" + hotKey + "&nbsp;</nobr>";
    }
    SpanElement hotKeyElement = Elements.createSpanElement(style.hotKey());
    hotKeyElement.setInnerHTML(hotKey);
    divElement.appendChild(hotKeyElement);
    return divElement;
}
Also used : SpanElement(elemental.html.SpanElement) ActionEvent(org.eclipse.che.ide.api.action.ActionEvent) Element(elemental.dom.Element) DivElement(com.google.gwt.dom.client.DivElement) LIElement(elemental.html.LIElement) SpanElement(elemental.html.SpanElement) ActionEvent(org.eclipse.che.ide.api.action.ActionEvent) ResourceChangedEvent(org.eclipse.che.ide.api.resources.ResourceChangedEvent) Event(elemental.events.Event) EventListener(elemental.events.EventListener) Presentation(org.eclipse.che.ide.api.action.Presentation)

Example 23 with DivElement

use of com.google.gwt.dom.client.DivElement in project che by eclipse.

the class SplitEditorPartViewImpl method tuneHorizontalSplitter.

/**
     * Tunes bottom splitter. Makes it tiny but with a transparent area for easy resizing.
     *
     * @param el
     *         element to tune
     */
private void tuneHorizontalSplitter(Element el) {
    /** Add Z-Index to move the splitter on the top and make content visible */
    el.getParentElement().getStyle().setProperty("zIndex", "1000");
    el.getParentElement().getStyle().setProperty("overflow", "visible");
    el.getStyle().setProperty("height", "3px");
    el.getStyle().setProperty("marginTop", "-2px");
    el.getStyle().setProperty("backgroundColor", "transparent");
    /** Add small border */
    DivElement delimiter = Document.get().createDivElement();
    delimiter.getStyle().setProperty("position", "absolute");
    delimiter.getStyle().setProperty("width", "100%");
    delimiter.getStyle().setProperty("height", "1px");
    delimiter.getStyle().setProperty("left", "0px");
    delimiter.getStyle().setProperty("backgroundColor", Style.getSplitterSmallBorderColor());
    delimiter.getStyle().setProperty("top", "2px");
    el.appendChild(delimiter);
}
Also used : DivElement(com.google.gwt.dom.client.DivElement)

Example 24 with DivElement

use of com.google.gwt.dom.client.DivElement in project gwt-test-utils by gwt-test-utils.

the class HTMLPanelTest method getElementById.

@Test
public void getElementById() {
    // Given
    HTMLPanel panel = new HTMLPanel("<div id=\"childDiv\" class=\"myClass\">some text</div>");
    // When
    DivElement childDiv = panel.getElementById("childDiv").cast();
    // Then
    assertThat(childDiv.getClassName()).isEqualTo("myClass");
    assertThat(childDiv.getInnerText()).isEqualTo("some text");
}
Also used : DivElement(com.google.gwt.dom.client.DivElement) HTMLPanel(com.google.gwt.user.client.ui.HTMLPanel) Test(org.junit.Test)

Example 25 with DivElement

use of com.google.gwt.dom.client.DivElement in project rstudio by rstudio.

the class ShadowBorder method addPanel.

private DivElement addPanel(String styleName, int halign, int valign) {
    DivElement div = Document.get().createDivElement();
    div.setClassName(styleName);
    Style style = div.getStyle();
    style.setPosition(Style.Position.ABSOLUTE);
    switch(halign) {
        case LEFT:
            style.setPropertyPx("left", 0);
            style.setPropertyPx("width", 10);
            break;
        case CENTER:
            style.setPropertyPx("left", 10);
            style.setPropertyPx("right", 10);
            break;
        case RIGHT:
            style.setPropertyPx("right", 0);
            style.setPropertyPx("width", 10);
            break;
    }
    switch(valign) {
        case TOP:
            style.setPropertyPx("top", 0);
            style.setPropertyPx("height", 26);
            break;
        case MIDDLE:
            style.setPropertyPx("top", 26);
            style.setPropertyPx("bottom", 26);
            break;
        case BOTTOM:
            style.setPropertyPx("bottom", 0);
            style.setPropertyPx("height", 26);
    }
    layout_.getElement().appendChild(div);
    return div;
}
Also used : DivElement(com.google.gwt.dom.client.DivElement) Style(com.google.gwt.dom.client.Style)

Aggregations

DivElement (com.google.gwt.dom.client.DivElement)25 Element (com.google.gwt.dom.client.Element)2 Test (org.junit.Test)2 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)1 ImageElement (com.google.gwt.dom.client.ImageElement)1 Style (com.google.gwt.dom.client.Style)1 HTMLPanel (com.google.gwt.user.client.ui.HTMLPanel)1 Label (com.google.gwt.user.client.ui.Label)1 Element (elemental.dom.Element)1 Event (elemental.events.Event)1 EventListener (elemental.events.EventListener)1 LIElement (elemental.html.LIElement)1 SpanElement (elemental.html.SpanElement)1 ActionEvent (org.eclipse.che.ide.api.action.ActionEvent)1 Presentation (org.eclipse.che.ide.api.action.Presentation)1 ResourceChangedEvent (org.eclipse.che.ide.api.resources.ResourceChangedEvent)1 Value (org.rstudio.studio.client.common.Value)1 OMSVGSVGElement (org.vectomatic.dom.svg.OMSVGSVGElement)1