Search in sources :

Example 1 with SVGImage

use of org.vectomatic.dom.svg.ui.SVGImage in project che by eclipse.

the class NotificationPopup method getIconBaseOnStatus.

/**
     * Return an icon based on {@link Status}.
     *
     * @return SVG image that represents icon status
     */
private SVGImage getIconBaseOnStatus() {
    final SVGResource icon;
    final String status;
    switch(notification.getStatus()) {
        case PROGRESS:
            icon = resources.progress();
            status = "progress";
            break;
        case SUCCESS:
            icon = resources.success();
            status = "success";
            break;
        case FAIL:
            icon = resources.fail();
            status = "fail";
            break;
        case WARNING:
            icon = resources.warning();
            status = "warning";
            break;
        default:
            throw new IllegalArgumentException("Can't determine notification icon");
    }
    SVGImage image = new SVGImage(icon);
    image.getElement().setAttribute("name", status);
    return image;
}
Also used : SVGResource(org.vectomatic.dom.svg.ui.SVGResource) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 2 with SVGImage

use of org.vectomatic.dom.svg.ui.SVGImage in project che by eclipse.

the class NotificationPopup method createCloseWidget.

/**
     * Create close icon widget that contains an close notification icon.
     *
     * @return {@link SimplePanel} as close icon wrapper
     */
private SimplePanel createCloseWidget() {
    SimplePanel closeWrapper = new SimplePanel();
    SVGImage closeImage = new SVGImage(resources.closeIcon());
    closeImage.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            delegate.onClose(notification);
        }
    });
    closeWrapper.add(closeImage);
    closeWrapper.setStyleName(resources.notificationCss().notificationPopupCloseButtonWrapper());
    closeWrapper.ensureDebugId(CLOSE_ICON_DBG_ID + notification.getId());
    return closeWrapper;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 3 with SVGImage

use of org.vectomatic.dom.svg.ui.SVGImage in project che by eclipse.

the class EditDebugConfigurationsViewImpl method renderCategoryHeader.

private SpanElement renderCategoryHeader(final String categoryTitle) {
    SpanElement categoryHeaderElement = Document.get().createSpanElement();
    categoryHeaderElement.setClassName(editConfigurationsResources.getCss().categoryHeader());
    SpanElement iconElement = Document.get().createSpanElement();
    categoryHeaderElement.appendChild(iconElement);
    SpanElement textElement = Document.get().createSpanElement();
    categoryHeaderElement.appendChild(textElement);
    DebugConfigurationType currentDebugConfigurationType = getTypeById(categoryTitle);
    textElement.setInnerText(currentDebugConfigurationType != null ? currentDebugConfigurationType.getDisplayName() : categoryTitle);
    SpanElement buttonElement = Document.get().createSpanElement();
    buttonElement.appendChild(editConfigurationsResources.addConfigurationButton().getSvg().getElement());
    categoryHeaderElement.appendChild(buttonElement);
    Event.sinkEvents(buttonElement, Event.ONCLICK);
    Event.setEventListener(buttonElement, new EventListener() {

        @Override
        public void onBrowserEvent(Event event) {
            if (Event.ONCLICK == event.getTypeInt()) {
                event.stopPropagation();
                namePanel.setVisible(true);
                selectedType = getTypeById(categoryTitle);
                delegate.onAddClicked();
                resetFilter();
            }
        }
    });
    Icon icon = iconRegistry.getIconIfExist(categoryTitle + ".debug.configuration.type.icon");
    if (icon != null) {
        final SVGImage iconSVG = icon.getSVGImage();
        if (iconSVG != null) {
            iconElement.appendChild(iconSVG.getElement());
            return categoryHeaderElement;
        }
    }
    return categoryHeaderElement;
}
Also used : SpanElement(com.google.gwt.dom.client.SpanElement) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Event(com.google.gwt.user.client.Event) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyboardEvent(elemental.events.KeyboardEvent) EventListener(com.google.gwt.user.client.EventListener) Icon(org.eclipse.che.ide.api.icon.Icon) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 4 with SVGImage

use of org.vectomatic.dom.svg.ui.SVGImage in project che by eclipse.

the class ProcessTreeRenderer method createCloseElement.

private SpanElement createCloseElement(final ProcessTreeNode node) {
    SpanElement closeButton = Elements.createSpanElement(resources.getCss().processesPanelCloseButtonForProcess());
    SVGImage icon = new SVGImage(partStackUIResources.closeIcon());
    closeButton.appendChild((Node) icon.getElement());
    Tooltip.create(closeButton, BOTTOM, MIDDLE, locale.viewCloseProcessOutputTooltip());
    closeButton.addEventListener(Event.CLICK, new EventListener() {

        @Override
        public void handleEvent(Event event) {
            if (stopProcessHandler != null) {
                stopProcessHandler.onCloseProcessOutputClick(node);
            }
        }
    }, true);
    return closeButton;
}
Also used : SpanElement(elemental.html.SpanElement) Event(elemental.events.Event) EventListener(elemental.events.EventListener) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 5 with SVGImage

use of org.vectomatic.dom.svg.ui.SVGImage in project che by eclipse.

the class EditCommandsViewImpl method createCategoryHeaderForCommandType.

private SpanElement createCategoryHeaderForCommandType(final String commandTypeId) {
    final SpanElement categoryHeaderElement = Document.get().createSpanElement();
    categoryHeaderElement.setClassName(commandResources.getCss().categoryHeader());
    final SpanElement iconElement = Document.get().createSpanElement();
    categoryHeaderElement.appendChild(iconElement);
    final SpanElement nameElement = Document.get().createSpanElement();
    categoryHeaderElement.appendChild(nameElement);
    final CommandType currentCommandType = getTypeById(commandTypeId);
    nameElement.setInnerText(currentCommandType != null ? currentCommandType.getDisplayName() : commandTypeId);
    final SpanElement buttonElement = Document.get().createSpanElement();
    buttonElement.appendChild(commandResources.addCommandButton().getSvg().getElement());
    categoryHeaderElement.appendChild(buttonElement);
    Event.sinkEvents(buttonElement, Event.ONCLICK);
    Event.setEventListener(buttonElement, new EventListener() {

        @Override
        public void onBrowserEvent(Event event) {
            if (Event.ONCLICK == event.getTypeInt()) {
                event.stopPropagation();
                namePanel.setVisible(true);
                previewUrlPanel.setVisible(true);
                selectedType = commandTypeId;
                delegate.onAddClicked();
                resetFilter();
            }
        }
    });
    final Icon icon = iconRegistry.getIconIfExist(commandTypeId + ".commands.category.icon");
    if (icon != null) {
        final SVGImage iconSVG = icon.getSVGImage();
        if (iconSVG != null) {
            iconElement.appendChild(iconSVG.getElement());
            return categoryHeaderElement;
        }
    }
    return categoryHeaderElement;
}
Also used : SpanElement(com.google.gwt.dom.client.SpanElement) CommandType(org.eclipse.che.ide.api.command.CommandType) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Event(com.google.gwt.user.client.Event) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyboardEvent(elemental.events.KeyboardEvent) EventListener(com.google.gwt.user.client.EventListener) Icon(org.eclipse.che.ide.api.icon.Icon) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Aggregations

SVGImage (org.vectomatic.dom.svg.ui.SVGImage)22 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 SpanElement (elemental.html.SpanElement)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Element (elemental.dom.Element)4 SVGResource (org.vectomatic.dom.svg.ui.SVGResource)4 SpanElement (com.google.gwt.dom.client.SpanElement)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 Image (com.google.gwt.user.client.ui.Image)3 Event (elemental.events.Event)3 EventListener (elemental.events.EventListener)3 DivElement (elemental.html.DivElement)3 Icon (org.eclipse.che.ide.api.icon.Icon)3 TreeNodeElement (org.eclipse.che.ide.ui.tree.TreeNodeElement)3 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)2 DoubleClickEvent (com.google.gwt.event.dom.client.DoubleClickEvent)2 DoubleClickHandler (com.google.gwt.event.dom.client.DoubleClickHandler)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)2 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)2 Event (com.google.gwt.user.client.Event)2