Search in sources :

Example 6 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem in project ovirt-engine by oVirt.

the class VmImportGeneralModelForm method initialize.

public void initialize() {
    driver.initialize(this);
    // $NON-NLS-1$
    name.asValueBox().setWidth("130px");
    name.asValueBox().getElement().getParentElement().getStyle().setTop(0, Style.Unit.PX);
    name.asValueBox().getElement().getParentElement().getStyle().setLeft(-5, Style.Unit.PX);
    // $NON-NLS-1$
    operatingSystems.setWidth("130px");
    formBuilder.addFormItem(new FormItem(constants.nameVm(), name, 0, 0));
    formBuilder.addFormItem(new FormItem(constants.osVm(), getOperatingSystemWidget(), 1, 0));
    formBuilder.addFormItem(new FormItem(constants.descriptionVm(), description, 2, 0));
    formBuilder.addFormItem(new FormItem(constants.templateVm(), template, 3, 0));
    formBuilder.addFormItem(new FormItem(constants.videoType(), defaultDisplayType, 4, 0));
    formBuilder.addFormItem(new FormItem(constants.priorityVm(), priority, 5, 0));
    formBuilder.addFormItem(new FormItem(constants.definedMemoryVm(), definedMemory, 6, 0));
    formBuilder.addFormItem(new FormItem(constants.optimizedFor(), optimizedForSystemProfile, 7, 0));
    formBuilder.addFormItem(new FormItem(constants.physMemGauranteedVm(), minAllocatedMemory, 0, 1));
    formBuilder.addFormItem(new FormItem(constants.guestFreeCachedBufferedMemInfo(), guestFreeCachedBufferedMemInfo, 1, 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, 2, 1));
    formBuilder.addFormItem(new FormItem(constants.GuestCpuCount(), guestCpuCount, 3, 1));
    formBuilder.addFormItem(new FormItem(constants.numOfMonitorsVm(), monitorCount, 4, 1));
    formBuilder.addFormItem(new FormItem(constants.usbPolicyVm(), usbPolicy, 5, 1));
    formBuilder.addFormItem(new FormItem(constants.originVm(), origin, 6, 1));
    formBuilder.addFormItem(new FormItem(constants.runOnVm(), defaultHost, 0, 2));
    formBuilder.addFormItem(new FormItem(constants.customPropertiesVm(), customProperties, 1, 2));
    formBuilder.addFormItem(new FormItem(constants.clusterCompatibilityVersionVm(), compatibilityVersion, 2, 2));
    formBuilder.addFormItem(new FormItem(constants.vmId(), vmId, 3, 2));
    formBuilder.addFormItem(new FormItem(constants.quotaVm(), quotaName, 4, 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, 5, 2) {

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

        @Override
        public boolean getIsAvailable() {
            String fqdn = getModel().getFqdn();
            return !(fqdn == null || fqdn.isEmpty());
        }
    });
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) WidgetTooltip(org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)

Example 7 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem in project ovirt-engine by oVirt.

the class HostGeneralSubTabView method populateGeneralFormPanel.

private void populateGeneralFormPanel(boolean virtSupported) {
    // Build a form using the FormBuilder
    generalFormBuilder = new FormBuilder(generalFormPanel, 3, 6);
    generalFormBuilder.setRelativeColumnWidth(0, 3);
    generalFormBuilder.setRelativeColumnWidth(1, 4);
    generalFormBuilder.setRelativeColumnWidth(2, 5);
    generalFormBuilder.addFormItem(new FormItem(constants.spmPriority(), spmPriority, 0, 0, virtSupported).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.activeVmsHostGeneral(), activeVms, 0, virtSupported).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.logicalCores(), logicalCores, 0).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.onlineCores(), onlineCores, 0).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.bootTimeHostGeneral(), bootTime, 0).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.hostedEngineHaHostGeneral(), hostedEngineHa, 0, virtSupported).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.isciInitNameHostGeneral(), iScsiInitiatorName, 0, 1, virtSupported).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.kdumpStatus(), kdumpStatus, 1).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.physMemHostGeneral(), physicalMemoryDetails, 1).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.swapSizeHostGeneral(), swapSizeDetails, 1).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.sharedMemHostGeneral(), sharedMemory, 1).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.hostDevicePassthroughHostGeneral(), hostDevicePassthroughSupport, 1).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.maxSchedulingMemory(), maxSchedulingMemory, 0, 2, virtSupported).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.memPageSharingHostGeneral(), memoryPageSharing, 2).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.autoLargePagesHostGeneral(), automaticLargePage, 2).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.hostHugePages(), hugePages, 2).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.selinuxModeGeneral(), selinuxEnforceMode, 2).withAutoPlacement());
    generalFormBuilder.addFormItem(new FormItem(constants.clusterCompatibilityVersion(), clusterCompatibilityVersion, 2).withAutoPlacement());
}
Also used : FormBuilder(org.ovirt.engine.ui.common.widget.form.FormBuilder) FormItem(org.ovirt.engine.ui.common.widget.form.FormItem)

Example 8 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem in project ovirt-engine by oVirt.

the class HostGeneralSubTabView method generateSoftwareFormPanel.

private void generateSoftwareFormPanel() {
    boolean virtSupported = ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly);
    boolean glusterSupported = ApplicationModeHelper.isModeSupported(ApplicationMode.GlusterOnly);
    // Build a form using the FormBuilder
    softwareFormBuilder = new FormBuilder(softwareFormPanel, 1, 10);
    softwareFormBuilder.setRelativeColumnWidth(0, 12);
    softwareFormBuilder.addFormItem(new FormItem(constants.osVersionHostGeneral(), oS, 0).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.osPrettyName(), osPrettyName, 0).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.kernelVersionHostGeneral(), kernelVersion, 0).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.kvmVersionHostGeneral(), kvmVersion, 0, virtSupported).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.libvirtVersionHostGeneral(), libvirtVersion, 0, virtSupported).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.vdsmVersionHostGeneral(), vdsmVersion, 0).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.spiceVersionHostGeneral(), spiceVersion, 0, virtSupported).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.glusterVersionHostGeneral(), glusterVersion, 0, glusterSupported).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.cephVersionHostGeneral(), librbdVersion, 0, virtSupported).withAutoPlacement(), 2, 10);
    softwareFormBuilder.addFormItem(new FormItem(constants.kernelFeatures(), kernelFeatures, 0, true).withAutoPlacement(), 2, 10);
}
Also used : FormBuilder(org.ovirt.engine.ui.common.widget.form.FormBuilder) FormItem(org.ovirt.engine.ui.common.widget.form.FormItem)

Example 9 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem in project ovirt-engine by oVirt.

the class HostGeneralSubTabView method generateHardwareFormPanel.

private void generateHardwareFormPanel() {
    // Build a form using the FormBuilder
    hardwareFormBuilder = new FormBuilder(hardwareFormPanel, 3, 4);
    hardwareFormBuilder.setRelativeColumnWidth(0, 4);
    hardwareFormBuilder.setRelativeColumnWidth(1, 5);
    hardwareFormBuilder.setRelativeColumnWidth(2, 3);
    hardwareFormBuilder.addFormItem(new FormItem(constants.hardwareManufacturerGeneral(), hardwareManufacturer, 0, 0), 5, 7);
    hardwareFormBuilder.addFormItem(new FormItem(constants.hardwareVersionGeneral(), hardwareVersion, 1, 0), 5, 7);
    hardwareFormBuilder.addFormItem(new FormItem(constants.cpuModelHostGeneral(), cpuModel, 2, 0), 5, 7);
    hardwareFormBuilder.addFormItem(new FormItem(constants.numOfCoresPerSocketHostGeneral(), coresPerSocket, 3, 0), 5, 7);
    hardwareFormBuilder.addFormItem(new FormItem(constants.hardwareFamilyGeneral(), hardwareFamily, 0, 1), 4, 8);
    hardwareFormBuilder.addFormItem(new FormItem(constants.hardwareUUIDGeneral(), hardwareUUID, 1, 1), 4, 8);
    hardwareFormBuilder.addFormItem(new FormItem(constants.cpuTypeHostGeneral(), cpuType, 2, 1), 4, 8);
    hardwareFormBuilder.addFormItem(new FormItem(constants.numOfThreadsPerCoreHostGeneral(), threadsPerCore, 3, 1), 4, 8);
    hardwareFormBuilder.addFormItem(new FormItem(constants.hardwareProductNameGeneral(), hardwareProductName, 0, 2), 4, 8);
    hardwareFormBuilder.addFormItem(new FormItem(constants.hardwareSerialNumberGeneral(), hardwareSerialNumber, 1, 2), 4, 8);
    hardwareFormBuilder.addFormItem(new FormItem(constants.numOfSocketsHostGeneral(), numberOfSockets, 2, 2), 4, 8);
}
Also used : FormBuilder(org.ovirt.engine.ui.common.widget.form.FormBuilder) FormItem(org.ovirt.engine.ui.common.widget.form.FormItem)

Example 10 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem 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)10 FormBuilder (org.ovirt.engine.ui.common.widget.form.FormBuilder)4 BooleanLabel (org.ovirt.engine.ui.common.widget.label.BooleanLabel)3 WidgetTooltip (org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)3 DefaultValueCondition (org.ovirt.engine.ui.common.widget.form.FormItem.DefaultValueCondition)1 GeneralFormPanel (org.ovirt.engine.ui.common.widget.form.GeneralFormPanel)1 ClusterTypeLabel (org.ovirt.engine.ui.common.widget.label.ClusterTypeLabel)1 ResiliencePolicyLabel (org.ovirt.engine.ui.common.widget.label.ResiliencePolicyLabel)1 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1