Search in sources :

Example 1 with IconWithOsDefault

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());
    });
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) IconWithOsDefault(org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault)

Example 2 with IconWithOsDefault

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);
}
Also used : IconWithOsDefault(org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault)

Example 3 with IconWithOsDefault

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);
        }
    });
}
Also used : ImageElement(com.google.gwt.dom.client.ImageElement) IconWithOsDefault(org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault) IconValidation(org.ovirt.engine.ui.uicommonweb.validation.IconValidation)

Example 4 with IconWithOsDefault

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);
}
Also used : IconWithOsDefault(org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault)

Aggregations

IconWithOsDefault (org.ovirt.engine.ui.uicommonweb.models.vms.IconWithOsDefault)4 ImageElement (com.google.gwt.dom.client.ImageElement)1 Guid (org.ovirt.engine.core.compat.Guid)1 IconValidation (org.ovirt.engine.ui.uicommonweb.validation.IconValidation)1