Search in sources :

Example 16 with SVGImage

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

the class BaseView method addMinimizeButton.

/**
     * Adds minimize part button.
     */
private void addMinimizeButton() {
    SVGImage minimize = new SVGImage(resources.collapseExpandIcon());
    minimize.getElement().setAttribute("name", "workBenchIconMinimize");
    minimizeButton = new ToolButton(minimize);
    minimizeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            onMinimize();
        }
    });
    addToolButton(minimizeButton);
    if (minimizeButton.getElement() instanceof elemental.dom.Element) {
        Tooltip.create((elemental.dom.Element) minimizeButton.getElement(), PositionController.VerticalAlign.BOTTOM, PositionController.HorizontalAlign.MIDDLE, "Hide");
    }
}
Also used : DoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) DoubleClickEvent(com.google.gwt.event.dom.client.DoubleClickEvent) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 17 with SVGImage

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

the class NotificationContainerItem 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().notificationCloseButtonWrapper());
    closeImage.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 18 with SVGImage

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

the class NotificationContainerItem method getIconBaseOnStatus.

/**
     * Return an icon based on {@link org.eclipse.che.ide.api.notification.StatusNotification.Status}.
     *
     * @return SVG image that represents icon status
     */
private SVGImage getIconBaseOnStatus() {
    final SVGResource icon;
    final String status;
    switch(((StatusNotification) 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) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 19 with SVGImage

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

the class ProcessTreeRenderer method createMachineElement.

private SpanElement createMachineElement(final ProcessTreeNode node) {
    final MachineEntity machine = (MachineEntity) node.getData();
    final String machineId = machine.getId();
    final MachineConfig machineConfig = machine.getConfig();
    final String machineCategory = machineConfig.isDev() ? locale.devMachineCategory() : machineConfig.getType();
    SpanElement root = Elements.createSpanElement();
    root.appendChild(createMachineLabel(machineCategory));
    Element statusElement = Elements.createSpanElement(resources.getCss().machineStatus());
    root.appendChild(statusElement);
    if (node.isRunning()) {
        statusElement.appendChild(Elements.createDivElement(resources.getCss().machineStatusRunning()));
    } else {
        statusElement.appendChild(Elements.createDivElement(resources.getCss().machineStatusPausedLeft()));
        statusElement.appendChild(Elements.createDivElement(resources.getCss().machineStatusPausedRight()));
    }
    Tooltip.create(statusElement, BOTTOM, MIDDLE, locale.viewMachineRunningTooltip());
    /***************************************************************************
         *
         * New terminal button
         *
         ***************************************************************************/
    if (node.isRunning() && node.hasTerminalAgent()) {
        SpanElement newTerminalButton = Elements.createSpanElement(resources.getCss().newTerminalButton());
        newTerminalButton.appendChild((Node) new SVGImage(resources.addTerminalIcon()).getElement());
        root.appendChild(newTerminalButton);
        Tooltip.create(newTerminalButton, BOTTOM, MIDDLE, locale.viewNewTerminalTooltip());
        newTerminalButton.addEventListener(Event.CLICK, new EventListener() {

            @Override
            public void handleEvent(Event event) {
                event.stopPropagation();
                event.preventDefault();
                if (addTerminalClickHandler != null) {
                    addTerminalClickHandler.onAddTerminalClick(machineId);
                }
            }
        }, true);
        /**
             * This listener cancels mouse events on '+' button and prevents the jitter of the selection in the tree.
             */
        EventListener blockMouseListener = new EventListener() {

            @Override
            public void handleEvent(Event event) {
                event.stopPropagation();
                event.preventDefault();
            }
        };
        /**
             * Prevent jitter when pressing mouse on '+' button.
             */
        newTerminalButton.addEventListener(Event.MOUSEDOWN, blockMouseListener, true);
        newTerminalButton.addEventListener(Event.MOUSEUP, blockMouseListener, true);
        newTerminalButton.addEventListener(Event.CLICK, blockMouseListener, true);
        newTerminalButton.addEventListener(Event.DBLCLICK, blockMouseListener, true);
    }
    /***************************************************************************
         *
         * SSH button
         *
         ***************************************************************************/
    if (node.isRunning() && node.hasSSHAgent()) {
        SpanElement sshButton = Elements.createSpanElement(resources.getCss().sshButton());
        sshButton.setTextContent("SSH");
        root.appendChild(sshButton);
        sshButton.addEventListener(Event.CLICK, new EventListener() {

            @Override
            public void handleEvent(Event event) {
                if (previewSshClickHandler != null) {
                    previewSshClickHandler.onPreviewSshClick(machineId);
                }
            }
        }, true);
        Tooltip.create(sshButton, BOTTOM, MIDDLE, locale.connectViaSSH());
    }
    Element monitorsElement = Elements.createSpanElement(resources.getCss().machineMonitors());
    root.appendChild(monitorsElement);
    Node monitorNode = (Node) machineMonitors.getMonitorWidget(machineId, this).getElement();
    monitorsElement.appendChild(monitorNode);
    Element nameElement = Elements.createSpanElement(resources.getCss().nameLabel());
    nameElement.setTextContent(machineConfig.getName());
    Tooltip.create(nameElement, BOTTOM, MIDDLE, machineConfig.getName());
    root.appendChild(nameElement);
    return root;
}
Also used : MachineEntity(org.eclipse.che.ide.api.machine.MachineEntity) SpanElement(elemental.html.SpanElement) MachineConfig(org.eclipse.che.api.core.model.machine.MachineConfig) DivElement(elemental.html.DivElement) TreeNodeElement(org.eclipse.che.ide.ui.tree.TreeNodeElement) Element(elemental.dom.Element) SpanElement(elemental.html.SpanElement) Node(elemental.dom.Node) Event(elemental.events.Event) EventListener(elemental.events.EventListener) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 20 with SVGImage

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

the class SelectCommandComboBox method createCustomComponent.

@Override
public Widget createCustomComponent(Presentation presentation) {
    // Create widgets for custom component 'select command'.
    FlowPanel customComponentHeader = new FlowPanel();
    FlowPanel devMachineIconPanel = new FlowPanel();
    FlowPanel commandIconPanel = new FlowPanel();
    customComponentHeader.setStyleName(resources.getCss().selectCommandBox());
    devMachineIconPanel.setStyleName(resources.getCss().selectCommandBoxIconPanel());
    devMachineIconPanel.add(new SVGImage(resources.devMachine()));
    customComponentHeader.add(devMachineIconPanel);
    customComponentHeader.add((Widget) machinesListWidget);
    commandIconPanel.setStyleName(resources.getCss().selectCommandBoxIconPanel());
    commandIconPanel.add(new SVGImage(resources.cmdIcon()));
    customComponentHeader.add(commandIconPanel);
    customComponentHeader.add((Widget) commandsListWidget);
    return customComponentHeader;
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) 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