use of org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault in project ovirt-engine by oVirt.
the class IconVmBaseToUnitBuilder method build.
@Override
public void build(final VmBase source, final UnitVmModel destination, final BuilderList<VmBase, UnitVmModel> rest) {
final Guid defaultIconId = AsyncDataProvider.getInstance().getOsDefaultIconId(source.getOsId(), false);
final Guid iconId = source.getLargeIconId() != null ? source.getLargeIconId() : defaultIconId;
IconCache.getInstance().getOrFetchIcons(Arrays.asList(iconId, defaultIconId), idToIconMap -> {
destination.getIcon().setEntity(new IconWithOsDefault(idToIconMap.get(iconId), idToIconMap.get(defaultIconId), source.getSmallIconId(), ValidationResult.ok()));
rest.head().build(source, destination, rest.tail());
});
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault in project ovirt-engine by oVirt.
the class IconEditorWidget method setIconAndFireChangeEvent.
protected void setIconAndFireChangeEvent(String icon, ValidationResult validationResult) {
final IconWithOsDefault oldPair = getValue();
this.validationResult = validationResult;
smallIconId = null;
setIcon(icon);
final IconWithOsDefault newPair = getValue();
ValueChangeEvent.fireIfNotEqual(this, oldPair, newPair);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault in project ovirt-engine by oVirt.
the class IconEditorWidget method validateIcon.
private void validateIcon() {
final IconWithOsDefault oldValue = getValue();
createValidationImageElement(icon, new ImageElementCallback() {
@Override
public void onElementReady(ImageElement imageElement) {
validationResult = new IconValidation(imageElement).validate(icon);
updateErrorIconLabel(validationResult);
final IconWithOsDefault newValue = getValue();
ValueChangeEvent.fireIfNotEqual(IconEditorWidget.this, oldValue, newValue);
}
});
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault in project ovirt-engine by oVirt.
the class IconEditorWidget method setValue.
@Override
public void setValue(IconWithOsDefault value) {
final IconWithOsDefault oldPair = getValue();
if (Objects.equals(value, oldPair)) {
return;
}
if (value == null) {
defaultIcon = null;
smallIconId = null;
validationResult = null;
setIcon(null);
} else {
defaultIcon = value.getOsDefaultIcon();
smallIconId = value.getSmallIconId();
validationResult = value.getValidationResult();
setIcon(value.getIcon());
}
final IconWithOsDefault newPair = getValue();
ValueChangeEvent.fireIfNotEqual(this, oldPair, newPair);
}
Aggregations