use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.
the class NetworkItemPanel method initTooltip.
protected void initTooltip() {
tooltip = new WidgetTooltip(getContents());
tooltip.setPlacement(Placement.BOTTOM);
SafeHtml tooltipContent = infoPopup.getTooltipContent(item);
if (tooltipContent != null) {
tooltip.setHtml(tooltipContent);
}
}
use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.
the class ManagePolicyUnitPopupView method initTable.
private void initTable() {
policyUnitTable = new ListModelObjectCellTable<>();
policyUnitTable.enableColumnResizing();
policyUnitTableContainer.add(policyUnitTable);
policyUnitTable.addColumn(new AbstractImageResourceColumn<PolicyUnit>() {
@Override
public ImageResource getValue(PolicyUnit object) {
if (object.isInternal()) {
return resources.lockImage();
}
return resources.exteranlPolicyUnitImage();
}
@Override
public SafeHtml getTooltip(PolicyUnit object) {
String tooltipContent = null;
if (object.isInternal()) {
tooltipContent = constants.internalPolicyUnit();
} else {
tooltipContent = constants.externalPolicyUnit();
}
return SafeHtmlUtils.fromSafeConstant(tooltipContent);
}
}, constants.empty(), // $NON-NLS-1$
"20px");
policyUnitTable.addColumn(new AbstractTextColumn<PolicyUnit>() {
@Override
public String getValue(PolicyUnit object) {
return object.getName();
}
}, constants.policyUnitName(), // $NON-NLS-1$
"180px");
policyUnitTable.addColumn(new AbstractTextColumn<PolicyUnit>() {
@Override
public String getValue(PolicyUnit object) {
return EnumTranslator.getInstance().translate(object.getPolicyUnitType());
}
}, constants.policyUnitType(), // $NON-NLS-1$
"100px");
policyUnitTable.addColumn(new AbstractTextColumn<PolicyUnit>() {
@Override
public String getValue(PolicyUnit object) {
return object.isEnabled() ? constants.enabledPolicyUnit() : constants.disabledPolicyUnit();
}
}, constants.policyUnitEnabledStatus(), // $NON-NLS-1$
"75px");
Column<PolicyUnit, String> removeButtonColumn = new Column<PolicyUnit, String>(new NullableButtonCell()) {
@Override
public String getValue(PolicyUnit object) {
if (!object.isEnabled()) {
return constants.removePolicyUnit();
}
return null;
}
};
// $NON-NLS-1$
policyUnitTable.addColumn(removeButtonColumn, constants.removePolicyUnit(), "80px");
removeButtonColumn.setFieldUpdater((index, object, value) -> model.remove(object));
}
use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.
the class RegisterVmPopupView method createEntityTable.
@Override
protected void createEntityTable(RegisterVmModel model) {
entityTable.addColumn(new AbstractImageResourceColumn<RegisterVmData>() {
@Override
public ImageResource getValue(RegisterVmData registerVmData) {
if (registerVmData.getError() != null) {
return resources.errorImage();
}
if (registerVmData.getWarning() != null) {
return resources.alertImage();
}
return null;
}
@Override
public SafeHtml getTooltip(RegisterVmData registerVmData) {
String problem;
if (registerVmData.getError() != null) {
problem = registerVmData.getError();
} else {
problem = registerVmData.getWarning();
}
return problem == null ? null : new SafeHtmlBuilder().appendEscapedLines(problem).toSafeHtml();
}
}, constants.empty(), // $NON-NLS-1$
"20px");
AbstractTextColumn<RegisterVmData> nameColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
return registerVmData.getVm().getName();
}
};
// $NON-NLS-1$
entityTable.addColumn(nameColumn, constants.nameVm(), "150px");
AbstractTextColumn<RegisterVmData> originColumn = new AbstractEnumColumn<RegisterVmData, OriginType>() {
@Override
protected OriginType getRawValue(RegisterVmData registerVmData) {
return registerVmData.getVm().getOrigin();
}
};
// $NON-NLS-1$
entityTable.addColumn(originColumn, constants.originVm(), "100px");
AbstractTextColumn<RegisterVmData> memoryColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
int size = registerVmData.getVm().getVmMemSizeMb();
return messages.megabytes(String.valueOf(size));
}
};
// $NON-NLS-1$
entityTable.addColumn(memoryColumn, constants.memoryVm(), "100px");
AbstractTextColumn<RegisterVmData> cpuColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
int numOfCpus = registerVmData.getVm().getNumOfCpus();
return String.valueOf(numOfCpus);
}
};
// $NON-NLS-1$
entityTable.addColumn(cpuColumn, constants.cpusVm(), "50px");
AbstractTextColumn<RegisterVmData> archColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
ArchitectureType clusterArch = registerVmData.getVm().getClusterArch();
return String.valueOf(clusterArch);
}
};
// $NON-NLS-1$
entityTable.addColumn(archColumn, constants.architectureVm(), "100px");
AbstractTextColumn<RegisterVmData> diskColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
int numOfDisks = registerVmData.getVm().getDiskMap().size();
return String.valueOf(numOfDisks);
}
};
// $NON-NLS-1$
entityTable.addColumn(diskColumn, constants.disksVm(), "50px");
// $NON-NLS-1$
entityTable.addColumn(creatReassignMacsColumn(), new ReassignBadMacsHeader(), "150px");
// $NON-NLS-1$
entityTable.addColumn(createAllowPartialColumn(), constants.allowPartial(), "95px");
// $NON-NLS-1$
entityTable.addColumn(getClusterColumn(), constants.clusterVm(), "150px");
if (model.isQuotaEnabled()) {
// $NON-NLS-1$
entityTable.addColumn(getClusterQuotaColumn(), constants.quotaVm(), "150px");
}
}
use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.
the class IconEditorWidget method updateErrorIconLabel.
private void updateErrorIconLabel(List<String> reasons) {
if (reasons.isEmpty()) {
errorMessage.setText(SafeHtmlUtils.EMPTY_SAFE_HTML.asString());
errorMessage.setVisible(false);
} else {
final SafeHtml htmlReasons = toList(reasons);
errorMessage.setText(htmlReasons.asString());
errorMessage.setVisible(true);
}
}
use of com.google.gwt.safehtml.shared.SafeHtml in project ovirt-engine by oVirt.
the class VmDiskAttachPopupWidget method initLunDisksTable.
private void initLunDisksTable() {
lunDiskTable.enableColumnResizing();
AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getDiskAlias();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "60px");
AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getDiskDescription();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "85px");
AbstractTextColumn<EntityModel> lunIdColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getLun().getLUNId();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(lunIdColumn, constants.lunIdSanStorage(), "60px");
AbstractTextColumn<EntityModel> idColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getId().toString();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(idColumn, constants.idVmDiskTable(), "60px");
AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>(SizeConverter.SizeUnit.GiB) {
@Override
protected Long getRawValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return (long) disk.getLun().getDeviceSize();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(sizeColumn, constants.devSizeSanStorage(), "70px");
AbstractTextColumn<EntityModel> pathColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return String.valueOf(disk.getLun().getPathCount());
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(pathColumn, constants.pathSanStorage(), "40px");
AbstractTextColumn<EntityModel> vendorIdColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getLun().getVendorId();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(vendorIdColumn, constants.vendorIdSanStorage(), "70px");
AbstractTextColumn<EntityModel> productIdColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getLun().getProductId();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(productIdColumn, constants.productIdSanStorage(), "70px");
AbstractTextColumn<EntityModel> serialColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
return disk.getLun().getSerial();
}
};
// $NON-NLS-1$
lunDiskTable.addColumn(serialColumn, constants.serialSanStorage(), "70px");
// $NON-NLS-1$
lunDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
lunDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
"30px");
lunDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
"30px");
lunDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {
@Override
public ImageResource getValue(EntityModel object) {
Disk disk = ((DiskModel) object.getEntity()).getDisk();
return disk.isShareable() ? resources.shareableDiskIcon() : null;
}
@Override
public SafeHtml getTooltip(EntityModel object) {
Disk disk = ((DiskModel) object.getEntity()).getDisk();
if (disk.isShareable()) {
return SafeHtmlUtils.fromSafeConstant(constants.shareable());
}
return null;
}
}, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
"30px");
// $NON-NLS-1$
lunDiskTable.setWidth("100%");
lunDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Aggregations