Search in sources :

Example 6 with NameRenderer

use of org.ovirt.engine.ui.common.widget.renderer.NameRenderer in project ovirt-engine by oVirt.

the class HostPopupView method initEditors.

private void initEditors() {
    publicKeyEditor = new StringEntityModelTextAreaLabelEditor();
    // List boxes
    clusterEditor = new GroupedListModelListBoxEditor<>(new GroupedListModelListBox<Cluster>(new NameRenderer<Cluster>()) {

        @Override
        public String getModelLabel(Cluster model) {
            return model.getName();
        }

        @Override
        public String getGroupLabel(Cluster model) {
            return messages.hostDataCenter(model.getStoragePoolName());
        }

        @Override
        public Comparator<Cluster> getComparator() {
            return new DataCenterClusterComparator();
        }

        /**
         * Comparator that sorts on data center name first, and then cluster name. Ignoring case.
         */
        final class DataCenterClusterComparator implements Comparator<Cluster> {

            @Override
            public int compare(Cluster cluster1, Cluster cluster2) {
                if (cluster1.getStoragePoolName() != null && cluster2.getStoragePoolName() == null) {
                    return -1;
                } else if (cluster2.getStoragePoolName() != null && cluster1.getStoragePoolName() == null) {
                    return 1;
                } else if (cluster1.getStoragePoolName() == null && cluster2.getStoragePoolName() == null) {
                    return 0;
                }
                if (cluster1.getStoragePoolName().equals(cluster2.getStoragePoolName())) {
                    return cluster1.getName().compareToIgnoreCase(cluster2.getName());
                } else {
                    return cluster1.getStoragePoolName().compareToIgnoreCase(cluster2.getStoragePoolName());
                }
            }
        }
    });
    externalHostNameEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
    providersEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider<OpenstackNetworkProviderProperties>>());
    externalDiscoveredHostsEditor = getListModelTypeAheadListBoxEditor();
    externalHostGroupsEditor = getListModelTypeAheadListBoxEditor();
    externalComputeResourceEditor = getListModelTypeAheadListBoxEditor();
    // Check boxes
    pmEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    pmEnabledEditor.setUsePatternFly(true);
    pmKdumpDetectionEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    pmKdumpDetectionEditor.setUsePatternFly(true);
    disableAutomaticPowerManagementEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    disableAutomaticPowerManagementEditor.setUsePatternFly(true);
    externalHostProviderEnabledEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    overrideIpTablesEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    // $NON-NLS-1$
    rbPassword = new RadioButton("1");
    // $NON-NLS-1$
    rbPublicKey = new RadioButton("1");
    // $NON-NLS-1$
    rbDiscoveredHost = new EntityModelRadioButtonEditor("2");
    // $NON-NLS-1$
    rbProvisionedHost = new EntityModelRadioButtonEditor("2");
    kernelCmdlineBlacklistNouveau = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlineIommu = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlineKvmNested = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlineUnsafeInterrupts = new EntityModelCheckBoxEditor(Align.RIGHT);
    kernelCmdlinePciRealloc = new EntityModelCheckBoxEditor(Align.RIGHT);
    consoleAddressEnabled = new EntityModelCheckBoxEditor(Align.RIGHT);
    hostedEngineDeployActionsEditor = new ListModelListBoxEditor<>(new EnumRenderer<HostedEngineDeployConfiguration.Action>());
}
Also used : StringEntityModelTextAreaLabelEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RadioButton(com.google.gwt.user.client.ui.RadioButton) GroupedListModelListBox(org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBox) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration)

Example 7 with NameRenderer

use of org.ovirt.engine.ui.common.widget.renderer.NameRenderer in project ovirt-engine by oVirt.

the class VolumeProfileStatisticsPopupView method initEditors.

private void initEditors() {
    nfsRefreshIcon = new RefreshActionIcon(SafeHtmlUtils.EMPTY_SAFE_HTML);
    brickRefreshIcon = new RefreshActionIcon(SafeHtmlUtils.EMPTY_SAFE_HTML);
    bricks = new ListModelListBoxEditor<>(new NameRenderer<BrickProfileDetails>());
    nfsServers = new ListModelListBoxEditor<>(new NameRenderer<GlusterVolumeProfileStats>());
    volumeProfileStats = new EntityModelCellTable<>(false, true);
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getName();
        }
    }, constants.fileOperation());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getHits() + "";
        }
    }, constants.fOpInvocationCount());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMaxLatencyFormatted().getFirst() + " " + entity.getMaxLatencyFormatted().getSecond();
        }
    }, constants.fOpMaxLatency());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMinLatencyFormatted().getFirst() + " " + entity.getMinLatencyFormatted().getSecond();
        }
    }, constants.fOpMinLatency());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getAvgLatencyFormatted().getFirst() + " " + entity.getAvgLatencyFormatted().getSecond();
        }
    }, constants.fOpAvgLatency());
    nfsServerProfileStats = new EntityModelCellTable<>(false, true);
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getName();
        }
    }, constants.fileOperation());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getHits() + "";
        }
    }, constants.fOpInvocationCount());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMaxLatencyFormatted().getFirst() + " " + entity.getMaxLatencyFormatted().getSecond();
        }
    }, constants.fOpMaxLatency());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMinLatencyFormatted().getFirst() + " " + entity.getMinLatencyFormatted().getSecond();
        }
    }, constants.fOpMinLatency());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getAvgLatencyFormatted().getFirst() + " " + entity.getAvgLatencyFormatted().getSecond();
        }
    }, constants.fOpAvgLatency());
}
Also used : RefreshActionIcon(org.ovirt.engine.ui.common.widget.dialog.RefreshActionIcon) FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer)

Example 8 with NameRenderer

use of org.ovirt.engine.ui.common.widget.renderer.NameRenderer in project ovirt-engine by oVirt.

the class ClusterPopupView method initListBoxEditors.

private void initListBoxEditors() {
    dataCenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>());
    managementNetworkEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Network>() {

        @Override
        protected String renderNullSafe(Network network) {
            return network.getName();
        }
    });
    cpuEditor = new ListModelListBoxEditor<>(new AbstractRenderer<ServerCpu>() {

        @Override
        public String render(ServerCpu object) {
            return object != null ? object.getCpuName() : constants.autoDetect();
        }
    });
    versionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Version>() {

        @Override
        public String renderNullSafe(Version object) {
            return object.toString();
        }
    });
    switchTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<SwitchType>());
    firewallTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<FirewallType>());
    defaultNetworkProviderEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Provider>() {

        @Override
        protected String renderNullSafe(Provider provider) {
            return provider.getName();
        }
    });
    architectureEditor = new ListModelListBoxEditor<>(new EnumRenderer<ArchitectureType>() {

        @Override
        public String render(ArchitectureType object) {
            if (object == null || object == ArchitectureType.undefined) {
                // only localize the 'undefined' enum value
                return super.render(object);
            } else {
                // all other (concrete) architectures should be displayed directly
                return object.toString();
            }
        }
    });
    clusterPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer<ClusterPolicy>());
    hostsWithBrokenConnectivityThresholdEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Integer>() {

        @Override
        public String renderNullSafe(Integer object) {
            if (object == null) {
                return "";
            }
            NumberFormatRenderer renderer = new NumberFormatRenderer(NumberFormat.getPercentFormat());
            // Since this is a percentage renderer, you need to divide by 100 to get the right values to show.
            return renderer.render(object.doubleValue() / 100);
        }
    });
    autoConvergeEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.autoConverge(), constants.dontAutoConverge(), constants.inheritFromGlobal()));
    migrateCompressedEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.compress(), constants.dontCompress(), constants.inheritFromGlobal()));
    migrationBandwidthLimitTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<MigrationBandwidthLimitType>());
    migrationBandwidthLimitTypeEditor.hideLabel();
    migrationPolicyEditor = new ListModelListBoxEditor<>(new NameRenderer());
    migrationPolicyEditor.hideLabel();
    macPoolListEditor = new ListModelListBoxEditor<>(new NameRenderer<MacPool>());
    macPoolListEditor.setLabel(constants.clusterPopupMacPoolLabel());
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) BooleanRendererWithNullText(org.ovirt.engine.ui.common.widget.renderer.BooleanRendererWithNullText) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) AbstractRenderer(com.google.gwt.text.shared.AbstractRenderer) Version(org.ovirt.engine.core.compat.Version) NumberFormatRenderer(com.google.gwt.text.client.NumberFormatRenderer) Network(org.ovirt.engine.core.common.businessentities.network.Network) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)

Example 9 with NameRenderer

use of org.ovirt.engine.ui.common.widget.renderer.NameRenderer in project ovirt-engine by oVirt.

the class ImportNetworksPopupView method initEntityModelCellTables.

void initEntityModelCellTables() {
    providerNetworks.addColumn(new AbstractTextColumn<ExternalNetwork>() {

        @Override
        public String getValue(ExternalNetwork model) {
            return model.getDisplayName();
        }
    }, constants.nameNetworkHeader());
    importedNetworks.addColumn(new AbstractEditTextColumn<ExternalNetwork>((index, model, value) -> model.setDisplayName(value)) {

        @Override
        public String getValue(ExternalNetwork model) {
            return model.getDisplayName();
        }
    }, constants.nameNetworkHeader());
    Column<ExternalNetwork, String> idColumn = new AbstractTextColumn<ExternalNetwork>() {

        @Override
        public String getValue(ExternalNetwork model) {
            return model.getNetwork().getProvidedBy().getExternalId();
        }
    };
    providerNetworks.addColumn(idColumn, constants.idNetworkHeader());
    importedNetworks.addColumn(idColumn, constants.idNetworkHeader());
    dcColumn = new AbstractListModelListBoxColumn<ExternalNetwork, StoragePool>(new NameRenderer<StoragePool>()) {

        @Override
        public ListModel<StoragePool> getValue(ExternalNetwork network) {
            return network.getDataCenters();
        }
    };
    importedNetworks.addColumn(dcColumn, constants.dcNetworkHeader());
    AbstractCheckboxHeader publicAllHeader = new AbstractCheckboxHeader() {

        @Override
        protected void selectionChanged(Boolean value) {
            for (ExternalNetwork model : getAllImportedNetworks()) {
                model.setPublicUse(value);
            }
            refreshImportedNetworks();
        }

        @Override
        public Boolean getValue() {
            for (ExternalNetwork model : getAllImportedNetworks()) {
                if (!model.isPublicUse()) {
                    return false;
                }
            }
            return true;
        }

        @Override
        public boolean isEnabled() {
            return true;
        }

        @Override
        public void render(Context context, SafeHtmlBuilder sb) {
            super.render(context, sb);
            sb.append(ImportNetworksPopupView.templates.tableHeaderInlineImage(SafeHtmlUtils.fromTrustedString(new InfoIcon(SafeHtmlUtils.EMPTY_SAFE_HTML).toString())));
        }

        @Override
        public SafeHtml getTooltip() {
            return ImportNetworksPopupView.templates.textForCheckBoxHeader(constants.publicNetworkTooltip());
        }

        @Override
        public String getLabel() {
            return constants.publicNetwork();
        }
    };
    importedNetworks.addColumn(new AbstractCheckboxColumn<ExternalNetwork>((index, model, value) -> {
        model.setPublicUse(value);
        refreshImportedNetworks();
    }) {

        @Override
        public Boolean getValue(ExternalNetwork model) {
            return model.isPublicUse();
        }

        @Override
        protected boolean canEdit(ExternalNetwork model) {
            return true;
        }

        @Override
        public void render(Context context, ExternalNetwork object, SafeHtmlBuilder sb) {
            super.render(context, object, sb);
            // $NON-NLS-1$
            sb.append(templates.textForCheckBox(""));
        }
    }, publicAllHeader, // $NON-NLS-1$
    "80px");
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Inject(com.google.inject.Inject) Provider(org.ovirt.engine.core.common.businessentities.Provider) AbstractModelBoundPopupView(org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView) GWT(com.google.gwt.core.client.GWT) ImportNetworksPopupPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.popup.provider.ImportNetworksPopupPresenterWidget) ListModelListBoxEditor(org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor) ArrayList(java.util.ArrayList) UiBinder(com.google.gwt.uibinder.client.UiBinder) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) BaseImportNetworksModel(org.ovirt.engine.ui.uicommonweb.models.networks.BaseImportNetworksModel) ExternalNetwork(org.ovirt.engine.ui.uicommonweb.models.providers.ExternalNetwork) Context(com.google.gwt.cell.client.Cell.Context) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) HorizontalSplitTable(org.ovirt.engine.ui.common.widget.HorizontalSplitTable) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) InfoIcon(org.ovirt.engine.ui.common.widget.dialog.InfoIcon) ApplicationResources(org.ovirt.engine.ui.webadmin.ApplicationResources) AbstractEditTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEditTextColumn) EventBus(com.google.gwt.event.shared.EventBus) UiCommonEditorDriver(org.ovirt.engine.ui.common.editor.UiCommonEditorDriver) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) AbstractCheckboxHeader(org.ovirt.engine.ui.common.widget.table.header.AbstractCheckboxHeader) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) AbstractListModelListBoxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractListModelListBoxColumn) WithElementId(org.ovirt.engine.ui.common.idhandler.WithElementId) ApplicationTemplates(org.ovirt.engine.ui.webadmin.ApplicationTemplates) List(java.util.List) SimpleDialogPanel(org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel) Column(com.google.gwt.user.cellview.client.Column) UiField(com.google.gwt.uibinder.client.UiField) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) Context(com.google.gwt.cell.client.Cell.Context) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) InfoIcon(org.ovirt.engine.ui.common.widget.dialog.InfoIcon) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ExternalNetwork(org.ovirt.engine.ui.uicommonweb.models.providers.ExternalNetwork) AbstractCheckboxHeader(org.ovirt.engine.ui.common.widget.table.header.AbstractCheckboxHeader)

Example 10 with NameRenderer

use of org.ovirt.engine.ui.common.widget.renderer.NameRenderer in project ovirt-engine by oVirt.

the class AbstractVmPopupWidget method initListBoxEditors.

@SuppressWarnings({ "rawtypes", "unchecked" })
private void initListBoxEditors() {
    // General tab
    dataCenterWithClusterEditor = new GroupedListModelListBoxEditor<>(new GroupedListModelListBox<DataCenterWithCluster>(new NameRenderer<>()) {

        @Override
        public String getModelLabel(DataCenterWithCluster model) {
            return model.getCluster().getName();
        }

        @Override
        public String getGroupLabel(DataCenterWithCluster model) {
            return messages.hostDataCenter(model.getDataCenter().getName());
        }

        public Comparator<DataCenterWithCluster> getComparator() {
            return Comparator.comparing((DataCenterWithCluster d) -> d.getDataCenter().getName(), Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)).thenComparing(d -> d.getCluster().getName(), Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER));
        }
    });
    quotaEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<Quota>() {

        @Override
        public String getReplacementStringNullSafe(Quota data) {
            return data.getQuotaName();
        }

        @Override
        public String getDisplayStringNullSafe(Quota data) {
            return typeAheadNameDescriptionTemplateNullSafe(data.getQuotaName(), data.getDescription());
        }
    }, new ModeSwitchingVisibilityRenderer());
    baseTemplateEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<VmTemplate>() {

        @Override
        public String getReplacementStringNullSafe(VmTemplate data) {
            return data.getName();
        }

        @Override
        public String getDisplayStringNullSafe(VmTemplate data) {
            return typeAheadNameDescriptionTemplateNullSafe(data.getName(), data.getDescription());
        }
    }, new ModeSwitchingVisibilityRenderer());
    templateWithVersionEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<TemplateWithVersion>() {

        @Override
        public String getReplacementStringNullSafe(TemplateWithVersion templateWithVersion) {
            return getFirstColumn(templateWithVersion) + // $NON-NLS-1$
            " | " + getSecondColumn(templateWithVersion);
        }

        @Override
        public String getDisplayStringNullSafe(TemplateWithVersion templateWithVersion) {
            return typeAheadNameDescriptionTemplateNullSafe(getFirstColumn(templateWithVersion), getSecondColumn(templateWithVersion));
        }

        private String getFirstColumn(TemplateWithVersion templateWithVersion) {
            return templateWithVersion.getBaseTemplate().getName();
        }

        private String getSecondColumn(TemplateWithVersion templateWithVersion) {
            final VmTemplate versionTemplate = templateWithVersion.getTemplateVersion();
            final String versionName = versionTemplate.getTemplateVersionName() == null ? // $NON-NLS-1$
            "" : // $NON-NLS-1$
            versionTemplate.getTemplateVersionName() + " ";
            return templateWithVersion.isLatest() ? constants.latest() : // $NON-NLS-1$
            versionName + "(" + versionTemplate.getTemplateVersionNumber() + // $NON-NLS-1$
            ")";
        }
    }, new ModeSwitchingVisibilityRenderer(), new SuggestionMatcher.ContainsSuggestionMatcher());
    oSTypeEditor = new ListModelListBoxEditor<>(new AbstractRenderer<Integer>() {

        @Override
        public String render(Integer object) {
            return AsyncDataProvider.getInstance().getOsName(object);
        }
    }, new ModeSwitchingVisibilityRenderer());
    vmTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<VmType>(), new ModeSwitchingVisibilityRenderer());
    instanceTypesEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<InstanceType>() {

        @Override
        public String getReplacementStringNullSafe(InstanceType data) {
            return data.getName();
        }

        @Override
        public String getDisplayStringNullSafe(InstanceType data) {
            return typeAheadNameDescriptionTemplateNullSafe(data.getName(), data.getDescription());
        }
    }, new ModeSwitchingVisibilityRenderer());
    emulatedMachine = new ListModelTypeAheadChangeableListBoxEditor(new ListModelTypeAheadChangeableListBoxEditor.NullSafeSuggestBoxRenderer() {

        @Override
        public String getDisplayStringNullSafe(String data) {
            if (data == null || data.trim().isEmpty()) {
                data = getDefaultEmulatedMachineLabel();
            }
            return typeAheadNameTemplateNullSafe(data);
        }
    }, false, new ModeSwitchingVisibilityRenderer(), constants.clusterDefaultOption());
    customCpu = new ListModelTypeAheadChangeableListBoxEditor(new ListModelTypeAheadChangeableListBoxEditor.NullSafeSuggestBoxRenderer() {

        @Override
        public String getDisplayStringNullSafe(String data) {
            if (data == null || data.trim().isEmpty()) {
                data = getDefaultCpuTypeLabel();
            }
            return typeAheadNameTemplateNullSafe(data);
        }
    }, false, new ModeSwitchingVisibilityRenderer(), constants.clusterDefaultOption());
    numOfSocketsEditor = new ListModelListBoxEditor<>(new ModeSwitchingVisibilityRenderer());
    numOfSocketsEditorWithDetachable = new EntityModelDetachableWidgetWithLabel(numOfSocketsEditor);
    corePerSocketEditor = new ListModelListBoxEditor<>(new ModeSwitchingVisibilityRenderer());
    corePerSocketEditorWithDetachable = new EntityModelDetachableWidgetWithLabel(corePerSocketEditor);
    initThreadsPerCore();
    // Pools
    poolTypeEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<EntityModel<VmPoolType>>() {

        @Override
        public String renderNullSafe(EntityModel<VmPoolType> object) {
            return object.getTitle();
        }
    }, new ModeSwitchingVisibilityRenderer());
    timeZoneEditor = new ListModelListBoxOnlyEditor<>(new NullSafeRenderer<TimeZoneModel>() {

        @Override
        public String renderNullSafe(TimeZoneModel timeZone) {
            if (timeZone.isDefault()) {
                return messages.defaultTimeZoneCaption(timeZone.getDisplayValue());
            } else {
                return timeZone.getDisplayValue();
            }
        }
    }, new ModeSwitchingVisibilityRenderer());
    EnableableFormLabel label = new EnableableFormLabel();
    label.setText(constants.timeZoneVm());
    timeZoneEditorWithInfo = new EntityModelWidgetWithInfo(label, timeZoneEditor);
    timeZoneEditorWithInfo.setExplanation(templates.italicText(constants.timeZoneInfo()));
    // Console tab
    displayTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<DisplayType>(), new ModeSwitchingVisibilityRenderer());
    graphicsTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<UnitVmModel.GraphicsTypes>());
    usbSupportEditor = new ListModelListBoxEditor<>(new EnumRenderer<UsbPolicy>(), new ModeSwitchingVisibilityRenderer());
    consoleDisconnectActionEditor = new ListModelListBoxEditor<>(new EnumRenderer<ConsoleDisconnectAction>(), new ModeSwitchingVisibilityRenderer());
    numOfMonitorsEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Integer>() {

        @Override
        public String renderNullSafe(Integer object) {
            return object.toString();
        }
    }, new ModeSwitchingVisibilityRenderer());
    numOfMonitorsEditor.hideLabel();
    vncKeyboardLayoutEditor = new ListModelListBoxEditor<>(new VncKeyMapRenderer(), new ModeSwitchingVisibilityRenderer());
    // Host Tab
    // $NON-NLS-1$
    specificHost = new EntityModelRadioButtonEditor("runVmOnHostGroup", new ModeSwitchingVisibilityRenderer());
    isAutoAssignEditor = // $NON-NLS-1$
    new EntityModelRadioButtonEditor("runVmOnHostGroup", new ModeSwitchingVisibilityRenderer());
    defaultHostEditor = new ListModelMultipleSelectListBoxEditor<>(new NameRenderer<VDS>(), new ModeSwitchingVisibilityRenderer());
    defaultHostEditor.hideLabel();
    migrationModeEditor = new ListModelListBoxEditor<>(new EnumRenderer<MigrationSupport>(), new ModeSwitchingVisibilityRenderer());
    migrationModeEditor.hideLabel();
    overrideMigrationDowntimeEditor = new EntityModelCheckBoxEditor(Align.RIGHT, new ModeSwitchingVisibilityRenderer());
    migrationDowntimeEditor = new IntegerEntityModelTextBoxOnlyEditor(new ModeSwitchingVisibilityRenderer());
    overrideMigrationPolicyEditor = new EntityModelCheckBoxEditor(Align.RIGHT, new ModeSwitchingVisibilityRenderer());
    migrationPolicyEditor = new ListModelListBoxOnlyEditor<>(new NameRenderer<MigrationPolicy>(), new ModeSwitchingVisibilityRenderer());
    autoConvergeEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.autoConverge(), constants.dontAutoConverge(), constants.inheritFromCluster()), new ModeSwitchingVisibilityRenderer());
    migrateCompressedEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.compress(), constants.dontCompress(), constants.inheritFromCluster()), new ModeSwitchingVisibilityRenderer());
    // Resource Allocation
    provisioningThinEditor = // $NON-NLS-1$
    new EntityModelRadioButtonEditor("provisioningGroup", new ModeSwitchingVisibilityRenderer());
    provisioningCloneEditor = // $NON-NLS-1$
    new EntityModelRadioButtonEditor("provisioningGroup", new ModeSwitchingVisibilityRenderer());
    // Boot Options Tab
    firstBootDeviceEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<EntityModel<BootSequence>>() {

        @Override
        public String renderNullSafe(EntityModel<BootSequence> object) {
            return object.getTitle();
        }
    }, new ModeSwitchingVisibilityRenderer());
    secondBootDeviceEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<EntityModel<BootSequence>>() {

        @Override
        public String renderNullSafe(EntityModel<BootSequence> object) {
            return object.getTitle();
        }
    }, new ModeSwitchingVisibilityRenderer());
    cdImageEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<RepoImage>() {

        @Override
        public String renderNullSafe(RepoImage object) {
            // For old ISO images from an ISO domain the image name is empty
            if (StringHelper.isNullOrEmpty(object.getRepoImageName())) {
                return object.getRepoImageId();
            }
            return object.getRepoImageName();
        }
    }, new ModeSwitchingVisibilityRenderer());
    cdImageEditor.hideLabel();
    cpuProfilesEditor = new ListModelListBoxEditor<>(new NameRenderer<CpuProfile>());
    cpuSharesAmountSelectionEditor = new ListModelListBoxOnlyEditor<>(new EnumRenderer<UnitVmModel.CpuSharesAmount>(), new ModeSwitchingVisibilityRenderer());
    numaTuneMode = new ListModelListBoxEditor<>(new EnumRenderer(), new ModeSwitchingVisibilityRenderer());
    providersEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider<OpenstackNetworkProviderProperties>>());
    providersEditor.setLabel(constants.providerLabel());
}
Also used : ListModelTypeAheadChangeableListBoxEditor(org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadChangeableListBoxEditor) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) TemplateWithVersion(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateWithVersion) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) DataCenterWithCluster(org.ovirt.engine.ui.uicommonweb.models.vms.DataCenterWithCluster) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) EntityModelDetachableWidgetWithLabel(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelDetachableWidgetWithLabel) BooleanRendererWithNullText(org.ovirt.engine.ui.common.widget.renderer.BooleanRendererWithNullText) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) BootSequence(org.ovirt.engine.core.common.businessentities.BootSequence) VmPoolType(org.ovirt.engine.core.common.businessentities.VmPoolType) EnableableFormLabel(org.ovirt.engine.ui.common.widget.label.EnableableFormLabel) TimeZoneModel(org.ovirt.engine.ui.uicommonweb.models.vms.TimeZoneModel) VncKeyMapRenderer(org.ovirt.engine.ui.common.widget.editor.VncKeyMapRenderer) GroupedListModelListBox(org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBox) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) EntityModelWidgetWithInfo(org.ovirt.engine.ui.common.widget.EntityModelWidgetWithInfo) Quota(org.ovirt.engine.core.common.businessentities.Quota) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) AbstractRenderer(com.google.gwt.text.shared.AbstractRenderer) IntegerEntityModelTextBoxOnlyEditor(org.ovirt.engine.ui.common.widget.editor.generic.IntegerEntityModelTextBoxOnlyEditor) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)

Aggregations

NameRenderer (org.ovirt.engine.ui.common.widget.renderer.NameRenderer)10 EnumRenderer (org.ovirt.engine.ui.common.widget.renderer.EnumRenderer)5 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)4 AbstractRenderer (com.google.gwt.text.shared.AbstractRenderer)3 EntityModelRadioButtonEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)3 Column (com.google.gwt.user.cellview.client.Column)2 OpenstackNetworkProviderProperties (org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties)2 Provider (org.ovirt.engine.core.common.businessentities.Provider)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 GroupedListModelListBox (org.ovirt.engine.ui.common.widget.editor.GroupedListModelListBox)2 BooleanRendererWithNullText (org.ovirt.engine.ui.common.widget.renderer.BooleanRendererWithNullText)2 NullSafeRenderer (org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 AssetProvider (org.ovirt.engine.ui.webadmin.gin.AssetProvider)2 Context (com.google.gwt.cell.client.Cell.Context)1 TextInputCell (com.google.gwt.cell.client.TextInputCell)1 GWT (com.google.gwt.core.client.GWT)1 EventBus (com.google.gwt.event.shared.EventBus)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1