Search in sources :

Example 1 with Node

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

the class PerspectiveViewImpl method tuneSplitters.

/**
     * Makes splitter better.
     */
public void tuneSplitters() {
    NodeList<Node> nodes = splitPanel.getElement().getChildNodes();
    boolean firstFound = false;
    for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.getItem(i);
        if (node.hasChildNodes()) {
            com.google.gwt.dom.client.Element el = node.getFirstChild().cast();
            if ("gwt-SplitLayoutPanel-HDragger".equals(el.getClassName())) {
                if (!firstFound) {
                    firstFound = true;
                    tuneLeftSplitter(el);
                } else {
                    tuneRightSplitter(el);
                }
            } else if ("gwt-SplitLayoutPanel-VDragger".equals(el.getClassName())) {
                tuneBottomSplitter(el);
            }
        }
    }
}
Also used : Node(com.google.gwt.dom.client.Node) Element(com.google.gwt.dom.client.Element)

Example 2 with Node

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

the class HotKeysDialogPresenter method onPrintClicked.

@Override
public void onPrintClicked() {
    final JsoArray<Node> nodesArray = JsoArray.create();
    for (Map.Entry<String, List<HotKeyItem>> entry : categories.entrySet()) {
        nodesArray.add(wrapCategory(entry.getKey()));
        for (HotKeyItem hotKeyItem : entry.getValue()) {
            if (hotKeyItem.getActionDescription() != null) {
                nodesArray.add(wrapHotKey(hotKeyItem.getHotKey(), hotKeyItem.getActionDescription(), hotKeyItem.isGlobal()));
            }
        }
    }
    openWindowForPrinting(resources.printTemplate().getText(), nodesArray);
}
Also used : HotKeyItem(org.eclipse.che.ide.api.hotkeys.HotKeyItem) Node(com.google.gwt.dom.client.Node) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with Node

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

the class OutputConsoleViewImpl method getText.

@Override
public String getText() {
    String text = "";
    NodeList<Node> nodes = consoleLines.getElement().getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.getItem(i);
        Element element = node.cast();
        text += element.getInnerText() + "\r\n";
    }
    return text;
}
Also used : Node(com.google.gwt.dom.client.Node) PreElement(com.google.gwt.dom.client.PreElement) Element(com.google.gwt.dom.client.Element)

Example 4 with Node

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

the class ShellWidget method consoleWriteExtendedError.

public void consoleWriteExtendedError(final String error, UnhandledError traceInfo, boolean expand, String command) {
    if (errorNodes_.containsKey(error)) {
        Node errorNode = errorNodes_.get(error);
        clearPendingInput();
        ConsoleError errorWidget = new ConsoleError(traceInfo, getErrorClass(), this, command);
        if (expand)
            errorWidget.setTracebackVisible(true);
        errorNode.getParentNode().replaceChild(errorWidget.getElement(), errorNode);
        scrollPanel_.onContentSizeChanged();
        errorNodes_.remove(error);
    }
}
Also used : ConsoleError(org.rstudio.studio.client.common.debugging.ui.ConsoleError) Node(com.google.gwt.dom.client.Node)

Example 5 with Node

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

the class NodeRelativePosition method toPositionHelper.

private static NodeRelativePosition toPositionHelper(Node here, int[] counter) {
    switch(here.getNodeType()) {
        case Node.TEXT_NODE:
            Text text = (Text) here;
            if (counter[0] <= text.getLength())
                return new NodeRelativePosition(here, counter[0]);
            counter[0] -= text.getLength();
            return null;
        case Node.ELEMENT_NODE:
            Element el = (Element) here;
            String tagName = el.getTagName().toLowerCase();
            if (tagName.equals("br")) {
                if (counter[0] <= 0)
                    return new NodeRelativePosition(here, 0);
                counter[0] -= 1;
                return null;
            } else if (tagName.equals("script") || tagName.equals("style"))
                return null;
            break;
    }
    NodeList<Node> children = here.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        NodeRelativePosition result = toPositionHelper(children.getItem(i), counter);
        if (result != null)
            return result;
    }
    return null;
}
Also used : Element(com.google.gwt.dom.client.Element) Node(com.google.gwt.dom.client.Node) Text(com.google.gwt.dom.client.Text)

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