Search in sources :

Example 6 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 7 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)

Example 8 with SVGImage

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

the class CategoriesPageViewImpl method renderCategoryHeader.

private Element renderCategoryHeader(String category) {
    SpanElement categoryElement = Document.get().createSpanElement();
    categoryElement.setClassName(resources.defaultCategoriesListCss().headerText());
    SpanElement iconElement = Document.get().createSpanElement();
    categoryElement.appendChild(iconElement);
    SpanElement textElement = Document.get().createSpanElement();
    categoryElement.appendChild(textElement);
    textElement.setInnerText(category);
    Icon icon = iconRegistry.getIconIfExist(category + ".samples.category.icon");
    if (icon != null) {
        final SVGImage iconSVG = icon.getSVGImage();
        if (iconSVG != null) {
            iconElement.appendChild(iconSVG.getElement());
            return categoryElement;
        }
    }
    return categoryElement;
}
Also used : SpanElement(com.google.gwt.dom.client.SpanElement) Icon(org.eclipse.che.ide.api.icon.Icon) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 9 with SVGImage

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

the class ActionPopupButton method renderImage.

/**
     * Redraw the icon.
     */
private void renderImage() {
    panel.clear();
    if (presentation.getImageResource() != null) {
        Image image = new Image(presentationFactory.getPresentation(action).getImageResource());
        image.setStyleName(toolbarResources.toolbar().popupButtonIcon());
        panel.add(image);
    } else if (presentation.getSVGResource() != null) {
        SVGImage image = new SVGImage(presentation.getSVGResource());
        image.getElement().setAttribute("class", toolbarResources.toolbar().popupButtonIcon());
        panel.add(image);
    } else if (presentation.getHTMLResource() != null) {
        FlowPanel icon = new FlowPanel();
        icon.setStyleName(toolbarResources.toolbar().iconButtonIcon());
        FlowPanel inner = new FlowPanel();
        inner.setStyleName(toolbarResources.toolbar().popupButtonIconInner());
        inner.getElement().setInnerHTML(presentation.getHTMLResource());
        icon.add(inner);
        panel.add(inner);
    }
    InlineLabel caret = new InlineLabel("");
    caret.setStyleName(toolbarResources.toolbar().caret());
    panel.add(caret);
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel) SVGImage(org.vectomatic.dom.svg.ui.SVGImage) Image(com.google.gwt.user.client.ui.Image) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 10 with SVGImage

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

the class PartButtonWidget method setIcon.

/** {@inheritDoc} */
@NotNull
@Override
public PartButton setIcon(@Nullable SVGResource iconResource) {
    this.tabIcon = iconResource;
    iconPanel.clear();
    if (tabIcon != null) {
        iconPanel.add(new SVGImage(tabIcon));
    }
    return this;
}
Also used : SVGImage(org.vectomatic.dom.svg.ui.SVGImage) NotNull(javax.validation.constraints.NotNull)

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