Search in sources :

Example 16 with Element

use of com.google.gwt.dom.client.Element in project actor-platform by actorapp.

the class JsFacade method handleLinkClick.

@UsedByApp
public void handleLinkClick(Event event) {
    Element target = Element.as(event.getEventTarget());
    String href = target.getAttribute("href");
    if (href.startsWith("send:")) {
        String msg = href.substring("send:".length());
        msg = URL.decode(msg);
        if (lastVisiblePeer != null) {
            messenger.sendMessage(lastVisiblePeer, msg);
            event.preventDefault();
        }
    } else {
        if (JsElectronApp.isElectron()) {
            JsElectronApp.openUrlExternal(href);
            event.preventDefault();
        }
    }
}
Also used : Element(com.google.gwt.dom.client.Element) UsedByApp(im.actor.core.js.annotations.UsedByApp)

Example 17 with Element

use of com.google.gwt.dom.client.Element 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 18 with Element

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

the class EditCommandsViewImpl method createButtons.

private void createButtons() {
    saveButton = createButton(coreLocale.save(), "window-edit-commands-save", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onSaveClicked();
        }
    });
    saveButton.addStyleName(Window.resources.windowCss().primaryButton());
    buttonsPanel.add(saveButton);
    cancelButton = createButton(coreLocale.cancel(), "window-edit-commands-cancel", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onCancelClicked();
        }
    });
    buttonsPanel.add(cancelButton);
    closeButton = createButton(coreLocale.close(), "window-edit-commands-close", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onCloseClicked();
        }
    });
    closeButton.addDomHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent blurEvent) {
            //set default focus
            selectText(filterInputField.getElement());
        }
    }, BlurEvent.getType());
    addButtonToFooter(closeButton);
    Element dummyFocusElement = DOM.createSpan();
    dummyFocusElement.setTabIndex(0);
    getFooter().getElement().appendChild(dummyFocusElement);
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SpanElement(com.google.gwt.dom.client.SpanElement) Element(com.google.gwt.dom.client.Element) BlurEvent(com.google.gwt.event.dom.client.BlurEvent)

Example 19 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 20 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)

Aggregations

Element (com.google.gwt.dom.client.Element)207 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 NativeEvent (com.google.gwt.dom.client.NativeEvent)9 EventTarget (com.google.gwt.dom.client.EventTarget)8 Node (com.google.gwt.dom.client.Node)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)8 Image (com.google.gwt.user.client.ui.Image)8 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)8 AnchorElement (com.google.gwt.dom.client.AnchorElement)7 ImageElement (com.google.gwt.dom.client.ImageElement)7 LabelElement (com.google.gwt.dom.client.LabelElement)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 JsArrayString (com.google.gwt.core.client.JsArrayString)6 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)6 ImageResource (com.google.gwt.resources.client.ImageResource)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)6