Search in sources :

Example 26 with SafeHtml

use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.

the class VmTypeColumn method getImagesToTooltipTextMap.

private Map<SafeHtml, String> getImagesToTooltipTextMap(VM vm) {
    Map<SafeHtml, String> res = new LinkedHashMap<>();
    if (vm.getVmPoolId() == null) {
        VmTypeConfig config = VmTypeConfig.from(vm.getVmType(), vm.isStateless(), vm.isNextRunConfigurationExists());
        res.put(getImageSafeHtml(config.getImageResource()), config.getTooltip());
    } else {
        ImageResource img = getPoolVmImageResource(vm.getVmType(), vm.isNextRunConfigurationExists());
        res.put(getImageSafeHtml(img), getPoolVmTooltip(vm.getVmType()));
    }
    if (vm.isHostedEngine()) {
        res.put(getImageSafeHtml(resources.mgmtNetwork()), constants.isHostedEngineVmTooltip());
    }
    return res;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) LinkedHashMap(java.util.LinkedHashMap)

Example 27 with SafeHtml

use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.

the class StorageDeviceStatusCell method render.

@Override
public void render(Context context, StorageDevice device, SafeHtmlBuilder sb, String id) {
    // No lock if we can create brick from the device
    if (device.getCanCreateBrick()) {
        return;
    }
    // Place a lock image to say that device is already in use and can't be used again
    SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.lockImage()).getHTML());
    sb.append(templates.statusTemplate(statusImageHtml, id, ""));
}
Also used : SafeHtml(com.google.gwt.safehtml.shared.SafeHtml)

Example 28 with SafeHtml

use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.

the class VmCountColumn method createInOutMigrationsTemplate.

protected SafeHtml createInOutMigrationsTemplate(int migrations, SafeHtml arrowImage) {
    String prefix;
    String postfix;
    String migrationsStr;
    SafeHtml image;
    if (migrations > 0) {
        // $NON-NLS-1$
        prefix = "(";
        migrationsStr = String.valueOf(migrations);
        image = arrowImage;
        // $NON-NLS-1$
        postfix = ")";
    } else {
        // $NON-NLS-1$
        prefix = "\u00a0";
        // $NON-NLS-1$
        migrationsStr = "\u00a0";
        image = SafeHtmlUtils.EMPTY_SAFE_HTML;
        // $NON-NLS-1$
        postfix = "\u00a0";
    }
    return templates.vmCountInOutMigrations(prefix, migrationsStr, image, postfix);
}
Also used : SafeHtml(com.google.gwt.safehtml.shared.SafeHtml)

Example 29 with SafeHtml

use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.

the class AssignedVNumaNodesPanel method setNodes.

public void setNodes(Collection<VNodeModel> virtualNodes, int numaNodeIndex, List<VdsNumaNode> numaNodeList) {
    String myImageHtml = AbstractImagePrototype.create(resources.vNumaTitleIcon()).getHTML();
    SafeHtml mySafeImageHtml = new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(myImageHtml);
    if (virtualNodes == null) {
        virtualNodes = new ArrayList<>();
    }
    SafeHtml title = titleTemplate.title(virtualNodes.size(), mySafeImageHtml, style.numaTitle());
    collapsiblePanel.setTitleWidget(new HTML(title));
    scrollPanel.setIndex(numaNodeIndex);
    scrollPanel.clear();
    for (VNodeModel nodeModel : virtualNodes) {
        DraggableVirtualNumaPanel numaNodePanel = virtualNumaPanelProvider.get();
        numaNodePanel.setModel(nodeModel, numaNodeList);
        scrollPanel.add(numaNodePanel);
    }
}
Also used : VNodeModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.VNodeModel) OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(com.google.gwt.safehtml.shared.OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(com.google.gwt.safehtml.shared.OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml) HTML(com.google.gwt.user.client.ui.HTML)

Example 30 with SafeHtml

use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.

the class NumaSupportPopupView method getHostSummaryTitle.

@Override
public IsWidget getHostSummaryTitle(int totalCpus, int usedCpuPercentage, int totalMemory, int usedMemory, int totalNumaNodes, int totalVNumaNodes) {
    FlowPanel summaryPanel = new FlowPanel();
    CpuSummaryPanel cpuSummaryPanel = this.cpuSummaryPanelProvider.get();
    cpuSummaryPanel.setName(constants.numaSummaryTotals());
    cpuSummaryPanel.setCpus(totalCpus, usedCpuPercentage);
    summaryPanel.add(cpuSummaryPanel);
    MemorySummaryPanel memorySummaryPanel = this.memorySummaryPanelProvider.get();
    memorySummaryPanel.setMemoryStats(totalMemory, usedMemory);
    summaryPanel.add(memorySummaryPanel);
    summaryPanel.add(new HTML(numaTitleTemplate.title(totalNumaNodes, style.hostSummaryNumaTitle())));
    String myImageHtml = AbstractImagePrototype.create(resources.vNumaTitleIcon()).getHTML();
    SafeHtml mySafeImageHtml = new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(myImageHtml);
    summaryPanel.add(new HTML(vNumaTitleTemplate.title(totalVNumaNodes, mySafeImageHtml, style.hostSummaryNumaTitle())));
    return summaryPanel;
}
Also used : OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(com.google.gwt.safehtml.shared.OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(com.google.gwt.safehtml.shared.OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml) HTML(com.google.gwt.user.client.ui.HTML)

Aggregations

SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)125 Test (org.junit.Test)34 ImageResource (com.google.gwt.resources.client.ImageResource)25 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)24 UpdateColumnAuditLogEntry (org.drools.workbench.models.guided.dtable.shared.auditlog.UpdateColumnAuditLogEntry)14 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)14 Column (com.google.gwt.user.cellview.client.Column)12 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)9 ArrayList (java.util.ArrayList)8 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)7 Cell (com.google.gwt.cell.client.Cell)6 HTML (com.google.gwt.user.client.ui.HTML)6 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)6 ConfirmDialog (org.eclipse.che.ide.api.dialogs.ConfirmDialog)6 TextColumn (com.google.gwt.user.cellview.client.TextColumn)5 LinkedHashMap (java.util.LinkedHashMap)5 Element (com.google.gwt.dom.client.Element)4 Map (java.util.Map)4 ConfirmCallback (org.eclipse.che.ide.api.dialogs.ConfirmCallback)4 ClickableTextCell (com.google.gwt.cell.client.ClickableTextCell)3