Search in sources :

Example 6 with Node

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

the class UIObjectPatcher method replaceNode.

@PatchMethod
static void replaceNode(UIObject uiObject, Element node, Element newNode) {
    Node parent = node.getParentNode();
    if (parent != null) {
        parent.insertBefore(newNode, node);
        parent.removeChild(node);
    }
}
Also used : Node(com.google.gwt.dom.client.Node) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Example 7 with Node

use of com.google.gwt.dom.client.Node in project GwtMobile by dennisjzh.

the class DragController method fireSwipeEvent.

protected void fireSwipeEvent(SwipeEvent e) {
    if (_capturingSwipeEventsHandler != null) {
        e.dispatch(_capturingSwipeEventsHandler);
        return;
    }
    if (_capturingDragEventsHandler != null) {
        return;
    }
    EventTarget target = e.getNativeEvent().getEventTarget();
    Node node = Node.as(target);
    if (!Element.is(node)) {
        //Text node
        node = node.getParentNode();
    }
    if (Element.is(node)) {
        Element ele = Element.as(target);
        int count = 0;
        while (ele != null) {
            for (SwipeEventsHandler handler : _swipeEventHandlers) {
                if (ele.equals(handler.getElement())) {
                    e.dispatch(handler);
                    count++;
                    if (e.getStopPropagation() || count == _swipeEventHandlers.size()) {
                        return;
                    }
                }
            }
            ele = ele.getParentElement();
        }
    }
}
Also used : Node(com.google.gwt.dom.client.Node) Element(com.google.gwt.dom.client.Element) EventTarget(com.google.gwt.dom.client.EventTarget) Point(com.gwtmobile.ui.client.utils.Point)

Example 8 with Node

use of com.google.gwt.dom.client.Node in project GwtMobile by dennisjzh.

the class DragController method fireDragEvent.

protected void fireDragEvent(DragEvent e) {
    if (_capturingDragEventsHandler != null) {
        e.dispatch(_capturingDragEventsHandler);
        return;
    }
    EventTarget target = e.getNativeEvent().getEventTarget();
    Node node = Node.as(target);
    if (!Element.is(node)) {
        //Text node
        node = node.getParentNode();
    }
    if (Element.is(node)) {
        Element ele = Element.as(target);
        int count = 0;
        while (ele != null) {
            for (DragEventsHandler handler : _dragEventHandlers) {
                if (ele.equals(handler.getElement())) {
                    e.dispatch(handler);
                    count++;
                    if (e.getStopPropagation() || count == _dragEventHandlers.size()) {
                        return;
                    }
                }
            }
            ele = ele.getParentElement();
        }
    }
}
Also used : Node(com.google.gwt.dom.client.Node) Element(com.google.gwt.dom.client.Element) EventTarget(com.google.gwt.dom.client.EventTarget) Point(com.gwtmobile.ui.client.utils.Point)

Example 9 with Node

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

the class RadioButtonGroup method addButton.

/**
     * Adds the new button to the group.
     *
     * @param label
     *         button's label
     * @param title
     *         button's tooltip
     * @param icon
     *         button's icon
     * @param clickHandler
     *         click handler
     */
public void addButton(String label, String title, @Nullable SVGResource icon, ClickHandler clickHandler) {
    final RadioButton radioButton = new RadioButton(GROUP_NAME, label);
    radioButton.setTitle(title);
    radioButton.setStyleName(resources.getCSS().button());
    radioButton.addClickHandler(clickHandler);
    final Node child = radioButton.getElement().getLastChild();
    if (icon != null) {
        final SVGImage svgImage = new SVGImage(icon);
        child.insertFirst(svgImage.getElement());
    }
    mainPanel.add(radioButton);
    buttons.add(radioButton);
}
Also used : Node(com.google.gwt.dom.client.Node) RadioButton(com.google.gwt.user.client.ui.RadioButton) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 10 with Node

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

the class SplitEditorPartViewImpl method tuneSplitter.

/**
     * Improves splitter visibility.
     */
private void tuneSplitter(SplitLayoutPanel splitLayoutPanel) {
    NodeList<Node> nodes = splitLayoutPanel.getElement().getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.getItem(i);
        if (node.hasChildNodes()) {
            Element el = node.getFirstChild().cast();
            String className = el.getClassName();
            if (HORIZONTAL_DRAGGER_CLASS.equals(className)) {
                tuneVerticalSplitter(el);
            } else if (VERTICAL_DRAGGER_CLASS.equals(className)) {
                tuneHorizontalSplitter(el);
            }
        }
    }
}
Also used : Node(com.google.gwt.dom.client.Node) DivElement(com.google.gwt.dom.client.DivElement) Element(com.google.gwt.dom.client.Element)

Aggregations

Node (com.google.gwt.dom.client.Node)15 Element (com.google.gwt.dom.client.Element)9 DivElement (com.google.gwt.dom.client.DivElement)2 EventTarget (com.google.gwt.dom.client.EventTarget)2 PreElement (com.google.gwt.dom.client.PreElement)2 Point (com.gwtmobile.ui.client.utils.Point)2 Animation (com.google.gwt.animation.client.Animation)1 SpanElement (com.google.gwt.dom.client.SpanElement)1 Text (com.google.gwt.dom.client.Text)1 MatchResult (com.google.gwt.regexp.shared.MatchResult)1 RegExp (com.google.gwt.regexp.shared.RegExp)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 RadioButton (com.google.gwt.user.client.ui.RadioButton)1 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 HotKeyItem (org.eclipse.che.ide.api.hotkeys.HotKeyItem)1 Point (org.rstudio.core.client.Point)1