Search in sources :

Example 1 with BooleanLabel

use of org.ovirt.engine.ui.common.widget.label.BooleanLabel in project ovirt-engine by oVirt.

the class TemplateGeneralModelForm method initialize.

/**
 * Initialize the form. Call this after ID has been set on the form,
 * so that form fields can use the ID as their prefix.
 */
public void initialize() {
    driver.initialize(this);
    isHighlyAvailable = new BooleanLabel(constants.yes(), constants.no());
    // Build a form using the FormBuilder
    formBuilder.addFormItem(new FormItem(constants.nameTemplateGeneral(), name, 0, 0));
    formBuilder.addFormItem(new FormItem(constants.descriptionTemplateGeneral(), description, 1, 0));
    formBuilder.addFormItem(new FormItem(constants.hostClusterTemplateGeneral(), hostCluster, 2, 0));
    formBuilder.addFormItem(new FormItem(constants.osTemplateGeneral(), oS, 3, 0));
    formBuilder.addFormItem(new FormItem(constants.graphicsProtocol(), graphicsType, 4, 0));
    formBuilder.addFormItem(new FormItem(constants.videoType(), defaultDisplayType, 5, 0));
    formBuilder.addFormItem(new FormItem(constants.optimizedFor(), optimizedForSystemProfile, 6, 0));
    formBuilder.addFormItem(new FormItem(constants.definedMemTemplateGeneral(), definedMemory, 0, 1));
    WidgetTooltip cpuInfoWithTooltip = new WidgetTooltip(cpuInfo);
    cpuInfoWithTooltip.setHtml(SafeHtmlUtils.fromString(constants.numOfCpuCoresTooltip()));
    formBuilder.addFormItem(new FormItem(constants.numOfCpuCoresTemplateGeneral(), cpuInfoWithTooltip, 1, 1));
    formBuilder.addFormItem(new FormItem(constants.numOfMonitorsTemplateGeneral(), monitorCount, 2, 1));
    formBuilder.addFormItem(new FormItem(constants.highlyAvailTemplateGeneral(), isHighlyAvailable, 3, 1));
    formBuilder.addFormItem(new FormItem(constants.priorityTemplateGeneral(), priority, 4, 1));
    formBuilder.addFormItem(new FormItem(constants.usbPolicyTemplateGeneral(), usbPolicy, 5, 1) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getHasUsbPolicy();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.originTemplateGeneral(), origin, 0, 2));
    formBuilder.addFormItem(new FormItem(constants.isStatelessTemplateGeneral(), isStateless, 1, 2));
    formBuilder.addFormItem(new FormItem(constants.templateId(), templateId, 2, 2));
    formBuilder.addFormItem(new FormItem(constants.domainTemplateGeneral(), domain, 3, 2) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getHasDomain();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.tzTemplateGeneral(), timeZone, 4, 2) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getHasTimeZone();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.quotaTemplateGeneral(), quotaName, 5, 2) {

        @Override
        public boolean getIsAvailable() {
            return getModel().isQuotaAvailable();
        }
    }.withDefaultValue(constants.notConfigured(), () -> {
        String quotaName = getModel().getQuotaName();
        return quotaName == null || "".equals(quotaName);
    }));
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) BooleanLabel(org.ovirt.engine.ui.common.widget.label.BooleanLabel) WidgetTooltip(org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)

Example 2 with BooleanLabel

use of org.ovirt.engine.ui.common.widget.label.BooleanLabel in project ovirt-engine by oVirt.

the class VmGeneralModelForm method initialize.

/**
 * Initialize the form. Call this after ID has been set on the form,
 * so that form fields can use the ID as their prefix.
 */
public void initialize() {
    isHighlyAvailable = new BooleanLabel(constants.yes(), constants.no());
    driver.initialize(this);
    formBuilder.addFormItem(new FormItem(constants.nameVm(), name, 0, 0));
    formBuilder.addFormItem(new FormItem(constants.descriptionVm(), description, 1, 0));
    formBuilder.addFormItem(new FormItem(constants.templateVm(), template, 2, 0));
    formBuilder.addFormItem(new FormItem(constants.osVm(), oS, 3, 0));
    formBuilder.addFormItem(new FormItem(constants.graphicsProtocol(), graphicsType, 4, 0));
    formBuilder.addFormItem(new FormItem(constants.videoType(), defaultDisplayType, 5, 0));
    formBuilder.addFormItem(new FormItem(constants.priorityVm(), priority, 6, 0));
    formBuilder.addFormItem(new FormItem(constants.optimizedFor(), optimizedForSystemProfile, 7, 0));
    formBuilder.addFormItem(new FormItem(constants.definedMemoryVm(), definedMemory, 0, 1));
    formBuilder.addFormItem(new FormItem(constants.physMemGauranteedVm(), minAllocatedMemory, 1, 1));
    formBuilder.addFormItem(new FormItem(constants.guestFreeCachedBufferedMemInfo(), guestFreeCachedBufferedMemInfo, 2, 1).withDefaultValue(constants.notConfigured(), () -> getModel().getGuestFreeCachedBufferedMemInfo() == null));
    WidgetTooltip cpuInfoWithTooltip = new WidgetTooltip(cpuInfo);
    cpuInfoWithTooltip.setHtml(SafeHtmlUtils.fromString(constants.numOfCpuCoresTooltip()));
    formBuilder.addFormItem(new FormItem(constants.numOfCpuCoresVm(), cpuInfoWithTooltip, 3, 1));
    formBuilder.addFormItem(new FormItem(constants.GuestCpuCount(), guestCpuCount, 4, 1));
    formBuilder.addFormItem(new FormItem(constants.GuestCpuType(), guestCpuType, 5, 1));
    formBuilder.addFormItem(new FormItem(constants.highlyAvailableVm(), isHighlyAvailable, 6, 1));
    formBuilder.addFormItem(new FormItem(constants.numOfMonitorsVm(), monitorCount, 7, 1));
    formBuilder.addFormItem(new FormItem(constants.usbPolicyVm(), usbPolicy, 8, 1));
    formBuilder.addFormItem(new FormItem(constants.createdByUserVm(), createdByUser, 9, 1) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getHasCreatedByUser();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.originVm(), origin, 0, 2));
    formBuilder.addFormItem(new FormItem(constants.runOnVm(), defaultHost, 1, 2));
    formBuilder.addFormItem(new FormItem(constants.customPropertiesVm(), customProperties, 2, 2));
    formBuilder.addFormItem(new FormItem(constants.clusterCompatibilityVersionVm(), compatibilityVersion, 3, 2));
    formBuilder.addFormItem(new FormItem(constants.vmId(), vmId, 4, 2));
    formBuilder.addFormItem(new FormItem(constants.quotaVm(), quotaName, 5, 2) {

        @Override
        public boolean getIsAvailable() {
            return getModel().isQuotaAvailable();
        }
    }.withDefaultValue(constants.notConfigured(), () -> {
        String quotaName = getModel().getQuotaName();
        return quotaName == null || "".equals(quotaName);
    }));
    formBuilder.addFormItem(new FormItem(constants.domainVm(), domain, 6, 2) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getHasDomain();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.fqdn(), fqdn, 7, 2) {

        @Override
        public boolean getIsAvailable() {
            String fqdn = getModel().getFqdn();
            return !(fqdn == null || fqdn.isEmpty());
        }
    });
    formBuilder.addFormItem(new FormItem(constants.timeZoneVm(), timeZone, 8, 2) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getHasTimeZone();
        }
    });
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) BooleanLabel(org.ovirt.engine.ui.common.widget.label.BooleanLabel) WidgetTooltip(org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)

Example 3 with BooleanLabel

use of org.ovirt.engine.ui.common.widget.label.BooleanLabel in project ovirt-engine by oVirt.

the class ClusterGeneralModelForm method initialize.

/**
 * Initialize the form. Call this after ID has been set on the form,
 * so that form fields can use the ID as their prefix.
 */
public void initialize() {
    cpuThreads = new BooleanLabel(constants.yes(), constants.no());
    memoryOverCommit = new PercentLabel<>();
    resiliencePolicy = new ResiliencePolicyLabel();
    clusterType = new ClusterTypeLabel();
    driver.initialize(this);
    DefaultValueCondition virtServiceNotSupported = () -> {
        boolean supportsVirtService = getModel().getEntity() != null && getModel().getEntity().supportsVirtService();
        return !supportsVirtService;
    };
    DefaultValueCondition glusterServiceNotSupported = () -> {
        boolean supportsGlusterService = getModel().getEntity() != null && getModel().getEntity().supportsGlusterService();
        return !supportsGlusterService;
    };
    boolean virtSupported = ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly);
    boolean glusterSupported = ApplicationModeHelper.isModeSupported(ApplicationMode.GlusterOnly);
    formBuilder.addFormItem(new FormItem(constants.nameCluster(), name, 0, 0));
    formBuilder.addFormItem(new FormItem(constants.descriptionCluster(), description, 1, 0));
    formBuilder.addFormItem(new FormItem(constants.dcCluster(), dataCenterName, 2, 0, virtSupported));
    formBuilder.addFormItem(new FormItem(constants.compatibilityVersionCluster(), compatibilityVersion, 3, 0));
    // Show the cluster type only if the application is running in both the modes
    formBuilder.addFormItem(new FormItem(constants.clusterType(), clusterType, 4, 0, virtSupported && glusterSupported));
    // properties for virt support
    formBuilder.addFormItem(new FormItem(constants.cpuTypeCluster(), cpuType, 0, 1, virtSupported).withDefaultValue(constants.notAvailableLabel(), virtServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.cpuThreadsCluster(), cpuThreads, 1, 1, virtSupported).withDefaultValue(constants.notAvailableLabel(), virtServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.memoryOptimizationCluster(), memoryOverCommit, 2, 1, virtSupported).withDefaultValue(constants.notAvailableLabel(), virtServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.resiliencePolicyCluster(), resiliencePolicy, 3, 1, virtSupported).withDefaultValue(constants.notAvailableLabel(), virtServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.emulatedMachine(), emulatedMachine, 4, 1, virtSupported).withDefaultValue(constants.notAvailableLabel(), virtServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.numberOfVmsCluster(), numberOfVms, 5, 1, virtSupported).withDefaultValue(constants.notAvailableLabel(), virtServiceNotSupported));
    // properties for gluster support
    formBuilder.addFormItem(new FormItem(constants.clusterVolumesTotalLabel(), noOfVolumesTotal, 0, 2, glusterSupported).withDefaultValue(constants.notAvailableLabel(), glusterServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.clusterVolumesUpLabel(), noOfVolumesUp, 1, 2, glusterSupported).withDefaultValue(constants.notAvailableLabel(), glusterServiceNotSupported));
    formBuilder.addFormItem(new FormItem(constants.clusterVolumesDownLabel(), noOfVolumesDown, 2, 2, glusterSupported).withDefaultValue(constants.notAvailableLabel(), glusterServiceNotSupported));
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) ClusterTypeLabel(org.ovirt.engine.ui.common.widget.label.ClusterTypeLabel) DefaultValueCondition(org.ovirt.engine.ui.common.widget.form.FormItem.DefaultValueCondition) BooleanLabel(org.ovirt.engine.ui.common.widget.label.BooleanLabel) ResiliencePolicyLabel(org.ovirt.engine.ui.common.widget.label.ResiliencePolicyLabel)

Aggregations

FormItem (org.ovirt.engine.ui.common.widget.form.FormItem)3 BooleanLabel (org.ovirt.engine.ui.common.widget.label.BooleanLabel)3 WidgetTooltip (org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)2 DefaultValueCondition (org.ovirt.engine.ui.common.widget.form.FormItem.DefaultValueCondition)1 ClusterTypeLabel (org.ovirt.engine.ui.common.widget.label.ClusterTypeLabel)1 ResiliencePolicyLabel (org.ovirt.engine.ui.common.widget.label.ResiliencePolicyLabel)1