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