Search in sources :

Example 1 with FormItem

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

the class ImageInfoForm method initialize.

public void initialize(ImageInfoModel model) {
    setModel(model);
    driver.initialize(this);
    formBuilder.addFormItem(new FormItem(constants.imageFormat(), format, 0, 0) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getFileLoaded();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.imageActualSize(), actualSize, 1, 0) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getFileLoaded();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.imageVirtualSize(), virtualSize, 2, 0) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getFormat() == VolumeFormat.COW;
        }
    });
    formBuilder.addFormItem(new FormItem(constants.imageContent(), contentType, 0, 1) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getFileLoaded();
        }
    });
    formBuilder.addFormItem(new FormItem(constants.imageQcowCompat(), qcowCompat, 1, 1) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getFormat() == VolumeFormat.COW;
        }
    });
    formBuilder.addFormItem(new FormItem(constants.imageBackingFile(), backingFile, 2, 1) {

        @Override
        public boolean getIsAvailable() {
            return getModel().getFormat() == VolumeFormat.COW;
        }
    });
    formBuilder.setRelativeColumnWidth(0, 5);
    formBuilder.setRelativeColumnWidth(1, 5);
    getModel().getEntityChangedEvent().addListener((ev, sender, args) -> update());
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem)

Example 2 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem 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 3 with FormItem

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

the class HostGeneralSubTabView method refreshHBADeviceInfo.

private void refreshHBADeviceInfo(VDS selectedItem) {
    /* refresh all the information about Host Bus Adapter (FC, iSCSI) devices */
    hbaInventory.clear();
    if (selectedItem != null && hardWareModelProvider.getModel().getHbaDevices() != null) {
        /*
             * traverse the model and get all the HBAs
             */
        for (EnumMap<HostHardwareGeneralModel.HbaDeviceKeys, String> hbaDevice : hardWareModelProvider.getModel().getHbaDevices()) {
            GeneralFormPanel hbaFormPanel = new GeneralFormPanel() {

                {
                    getElement().getStyle().setFloat(Float.LEFT);
                    getElement().getStyle().setBorderWidth(1, Unit.PX);
                    getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
                    // $NON-NLS-1$
                    getElement().getStyle().setBorderColor("black");
                    getElement().getStyle().setMarginLeft(5, Unit.PX);
                    getElement().getStyle().setMarginBottom(5, Unit.PX);
                    // $NON-NLS-1$ //$NON-NLS-2$
                    getElement().getStyle().setProperty("width", "auto");
                }
            };
            StringValueLabel interfaceName = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.MODEL_NAME));
            StringValueLabel interfaceType = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.TYPE));
            StringValueLabel interfaceWWNN = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNN));
            StringValueLabel portWWPNs = new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNPS));
            FormBuilder hbaFormBuilder = new FormBuilder(hbaFormPanel, 1, 4);
            hbaFormBuilder.setRelativeColumnWidth(0, 12);
            hbaFormBuilder.addFormItem(new FormItem(constants.hbaModelName(), interfaceName, 0, 0));
            hbaFormBuilder.addFormItem(new FormItem(constants.hbaDeviceType(), interfaceType, 1, 0));
            hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWNN(), interfaceWWNN, 2, 0));
            hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWPNs(), portWWPNs, 3, 0));
            hbaInventory.add(hbaFormPanel);
        }
    }
}
Also used : FormBuilder(org.ovirt.engine.ui.common.widget.form.FormBuilder) FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) StringValueLabel(org.ovirt.engine.ui.common.widget.label.StringValueLabel) GeneralFormPanel(org.ovirt.engine.ui.common.widget.form.GeneralFormPanel)

Example 4 with FormItem

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

the class ErrataDetailModelForm method initialize.

public void initialize() {
    driver.initialize(this);
    formBuilder.addFormItem(new FormItem(constants.errataId(), id, 0, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataDateIssued(), issued, 1, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataType(), type, 2, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataSeverity(), severity, 3, 0) {

        @Override
        public boolean getIsAvailable() {
            EntityModel<Erratum> model = getModel();
            return model != null && model.getEntity() != null && model.getEntity().getSeverity() != null;
        }
    }, 2, 10);
    formBuilder.addFormItem(new FormItem(constants.description(), description, 4, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.solution(), solution, 5, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.summary(), summary, 6, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataPackages(), packages, 7, 0), 2, 10);
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 5 with FormItem

use of org.ovirt.engine.ui.common.widget.form.FormItem 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)

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