Search in sources :

Example 11 with Element

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

the class DefaultPresentationRenderer method render.

@Override
public Element render(N node, String domID, Tree.Joint joint, int depth) {
    NodePresentation presentation;
    if (node instanceof HasPresentation) {
        presentation = ((HasPresentation) node).getPresentation(false);
    } else {
        presentation = new NodePresentation();
        presentation.setPresentableText(node.getName());
    }
    Element rootContainer = getRootContainer(domID);
    Element nodeContainer = getNodeContainer();
    setIndentLevel(nodeContainer, depth);
    Element jointContainer = getJointContainer(joint);
    Element iconContainer = getIconContainer(presentation.getPresentableIcon());
    Element userElement = getUserElement(presentation.getUserElement());
    Element presentableTextContainer = getPresentableTextContainer(createPresentableTextElement(presentation));
    Element infoTextContainer = getInfoTextContainer(createInfoTextElement(presentation));
    Element descendantsContainer = getDescendantsContainer();
    nodeContainer.appendChild(jointContainer);
    nodeContainer.appendChild(iconContainer);
    nodeContainer.appendChild(userElement == null ? Document.get().createSpanElement() : userElement);
    nodeContainer.appendChild(presentableTextContainer);
    nodeContainer.appendChild(infoTextContainer);
    rootContainer.appendChild(nodeContainer);
    rootContainer.appendChild(descendantsContainer);
    return rootContainer;
}
Also used : Element(com.google.gwt.dom.client.Element) DivElement(com.google.gwt.dom.client.DivElement)

Example 12 with Element

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

the class View method setPopupPosition.

/**
     * Sets the popup's position relative to the browser's client area. The
     * popup's position may be set before calling {@link #setShowing(boolean)}.
     *
     * @param left
     *         the left position, in pixels
     * @param top
     *         the top position, in pixels
     */
public void setPopupPosition(int left, int top) {
    // Account for the difference between absolute position and the
    // body's positioning context.
    left -= Document.get().getBodyOffsetLeft();
    top -= Document.get().getBodyOffsetTop();
    // Set the popup's position manually, allowing setPopupPosition() to be
    // called before show() is called (so a popup can be positioned without it
    // 'jumping' on the screen).
    Element elem = contentContainer.getElement();
    elem.getStyle().setPropertyPx("left", left);
    elem.getStyle().setPropertyPx("top", top);
}
Also used : Element(com.google.gwt.dom.client.Element)

Example 13 with Element

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

the class CustomComboBox method setItemText.

/**
     * Sets the text associated with the item at a given index.
     *
     * @param index
     *         the index of the item to be set
     * @param text
     *         the item's new text
     * @throws IndexOutOfBoundsException
     *         if the index is out of range
     */
public void setItemText(int index, String text) {
    checkIndex(index);
    final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
    final LabelElement labelElement = (LabelElement) optionElement.getElementsByTagName("label").getItem(0);
    labelElement.setInnerText(text);
    if (selectedIndex == index) {
        currentInputElement.setValue(text);
    }
}
Also used : LabelElement(com.google.gwt.dom.client.LabelElement) InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element)

Example 14 with Element

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

the class CustomComboBox method getValue.

/**
     * Gets the value associated with the item at a given index.
     *
     * @param index
     *         the index of the item to be retrieved
     * @return the item's associated value
     * @throws IndexOutOfBoundsException
     *         if the index is out of range
     */
public String getValue(int index) {
    checkIndex(index);
    final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
    final InputElement inputElement = (InputElement) optionElement.getElementsByTagName("input").getItem(0);
    return inputElement.getValue();
}
Also used : InputElement(com.google.gwt.dom.client.InputElement) LabelElement(com.google.gwt.dom.client.LabelElement) Element(com.google.gwt.dom.client.Element) InputElement(com.google.gwt.dom.client.InputElement)

Example 15 with Element

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

the class Tree method onClick.

private void onClick(Event event) {
    NativeTreeEvent e = event.cast();
    NodeDescriptor node = getNodeDescriptor((Element) event.getEventTarget().cast());
    if (node != null) {
        Element jointEl = view.getJointContainer(node);
        if (jointEl != null && e.within(jointEl)) {
            toggle(node.getNode());
        }
    }
    focus();
}
Also used : NativeTreeEvent(org.eclipse.che.ide.ui.smartTree.event.internal.NativeTreeEvent) DivElement(com.google.gwt.dom.client.DivElement) Element(com.google.gwt.dom.client.Element)

Aggregations

Element (com.google.gwt.dom.client.Element)193 DivElement (com.google.gwt.dom.client.DivElement)14 Test (org.junit.Test)13 TableRowElement (com.google.gwt.dom.client.TableRowElement)11 SVGSVGElement (elemental.svg.SVGSVGElement)11 InputElement (com.google.gwt.dom.client.InputElement)9 Node (com.google.gwt.dom.client.Node)8 Image (com.google.gwt.user.client.ui.Image)8 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)8 EventTarget (com.google.gwt.dom.client.EventTarget)7 LabelElement (com.google.gwt.dom.client.LabelElement)7 NativeEvent (com.google.gwt.dom.client.NativeEvent)7 JsArrayString (com.google.gwt.core.client.JsArrayString)6 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)6 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 ImageResource (com.google.gwt.resources.client.ImageResource)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)6 Label (com.google.gwt.user.client.ui.Label)5