Search in sources :

Example 1 with Element

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

the class MainMenuViewImpl method add.

/**
     * Create and add new item in menu.
     */
private void add(Action action, PresentationFactory presentationFactory) {
    Presentation presentation = presentationFactory.getPresentation(action);
    if (action instanceof ActionGroup) {
        ActionGroup group = (ActionGroup) action;
        table.setText(0, menuBarItems.size(), presentation.getText());
        Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
        MenuBarItem item = new MenuBarItem(group, actionManager, managerProvider, presentationFactory, element, this, keyBindingAgent, resources.menuCss());
        item.onMouseOut();
        menuBarItems.put(element, item);
        action2barItem.put(group, item);
    } else if (action instanceof CustomComponentAction) {
        Widget widget = ((CustomComponentAction) action).createCustomComponent(presentation);
        table.setWidget(0, menuBarItems.size(), widget);
        Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
        menuBarItems.put(element, null);
    }
}
Also used : CustomComponentAction(org.eclipse.che.ide.api.action.CustomComponentAction) ActionGroup(org.eclipse.che.ide.api.action.ActionGroup) Element(com.google.gwt.dom.client.Element) Widget(com.google.gwt.user.client.ui.Widget) Presentation(org.eclipse.che.ide.api.action.Presentation)

Example 2 with Element

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

the class DefaultGoInto method reset.

/** {@inheritDoc} */
public void reset() {
    //reset selection
    tree.getSelectionModel().deselectAll();
    Element rootContainer = tree.getContainer(null);
    rootContainer.setInnerHTML("");
    //restore root nodes
    for (Node rootNode : rootNodes) {
        NodeDescriptor descriptor = tree.getNodeDescriptor(rootNode);
        rootContainer.appendChild(descriptor.getRootContainer());
    }
    //then re-add our go into node
    Node parent = node.getParent();
    if (parent != null) {
        tree.getNodeStorage().add(parent, node);
    }
    tree.scrollIntoView(node);
    tree.getSelectionModel().select(node, false);
    tree.update();
    active = false;
    fireEvent(new GoIntoStateEvent(DEACTIVATED, node));
}
Also used : Element(com.google.gwt.dom.client.Element) Node(org.eclipse.che.ide.api.data.tree.Node) GoIntoStateEvent(org.eclipse.che.ide.ui.smartTree.event.GoIntoStateEvent)

Example 3 with Element

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

the class ParametersHintsViewImpl method show.

@Override
public void show(List<MethodParameters> parametersList, int x, int y) {
    parametersPanel.clear();
    for (MethodParameters parameters : parametersList) {
        FlowPanel widget = panelsProvider.get();
        String parametersLine = parameters.getParameters();
        if (parametersLine.isEmpty()) {
            parametersLine = "<no parameters>";
        }
        String result = parametersLine.replace("<", "&lt").replace(">", "&gt");
        Element element = widget.getElement();
        element.setInnerHTML(result);
        element.getStyle().setColor("yellow");
        parametersPanel.add(widget);
    }
    setPopupPosition(x, y);
    show();
}
Also used : Element(com.google.gwt.dom.client.Element) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) MethodParameters(org.eclipse.che.ide.ext.java.shared.dto.model.MethodParameters)

Example 4 with Element

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

the class EditDebugConfigurationsViewImpl method createButtons.

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

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

        @Override
        public void onClick(ClickEvent event) {
            delegate.onCancelClicked();
        }
    });
    overFooter.add(cancelButton);
    debugButton = createButton(coreLocale.debug(), "window-edit-debug-configurations-debug", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onDebugClicked();
        }
    });
    overFooter.add(debugButton);
    closeButton = createButton(coreLocale.close(), "window-edit-debug-configurations-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 5 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)

Aggregations

Element (com.google.gwt.dom.client.Element)340 DivElement (com.google.gwt.dom.client.DivElement)19 TableRowElement (com.google.gwt.dom.client.TableRowElement)19 NativeEvent (com.google.gwt.dom.client.NativeEvent)16 Test (org.junit.Test)14 EventTarget (com.google.gwt.dom.client.EventTarget)11 SVGSVGElement (elemental.svg.SVGSVGElement)11 InputElement (com.google.gwt.dom.client.InputElement)10 Node (com.google.gwt.dom.client.Node)9 TableCellElement (com.google.gwt.dom.client.TableCellElement)9 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)8 AnchorElement (com.google.gwt.dom.client.AnchorElement)8 ImageElement (com.google.gwt.dom.client.ImageElement)8 LabelElement (com.google.gwt.dom.client.LabelElement)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)8 Image (com.google.gwt.user.client.ui.Image)8 SpanElement (com.google.gwt.dom.client.SpanElement)7 Style (com.google.gwt.dom.client.Style)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 Widget (com.google.gwt.user.client.ui.Widget)7