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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations