use of org.ovirt.engine.ui.common.widget.renderer.EnumRenderer in project ovirt-engine by oVirt.
the class ManageGlusterSwiftPopupView method initEditors.
private void initEditors() {
swiftStatusEditor = new EntityModelLabelEditor<>(new EnumRenderer<GlusterServiceStatus>());
// $NON-NLS-1$
startSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
// $NON-NLS-1$
stopSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
// $NON-NLS-1$
restartSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
manageSwiftServerLevel = new EntityModelCheckBoxEditor(Align.RIGHT);
hostServicesTable = new EntityModelCellTable<>(false, true);
hostServicesTable.addColumn(new AbstractEntityModelTextColumn<GlusterServerService>() {
@Override
public String getText(GlusterServerService entity) {
return entity.getHostName();
}
}, constants.hostGlusterSwift());
hostServicesTable.addColumn(new AbstractEnumColumn<EntityModel, ServiceType>() {
@Override
protected ServiceType getRawValue(EntityModel object) {
return ((GlusterSwiftServiceModel) object).getEntity().getServiceType();
}
}, constants.serviceNameGlusterSwift());
hostServicesTable.addColumn(new AbstractEnumColumn<EntityModel, GlusterServiceStatus>() {
@Override
protected GlusterServiceStatus getRawValue(EntityModel object) {
return ((GlusterSwiftServiceModel) object).getEntity().getStatus();
}
}, constants.serviceStatusGlusterSwift());
Column<EntityModel, Boolean> startSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getStartSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getStartSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
startSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
swiftModel.getStartSwift().setEntity(value);
if (value) {
swiftModel.getStopSwift().setEntity(false);
swiftModel.getRestartSwift().setEntity(false);
hostServicesTable.redraw();
}
});
hostServicesTable.addColumn(startSwiftColumn, constants.startGlusterSwift());
Column<EntityModel, Boolean> stopSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getStopSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getStopSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
stopSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
if (swiftModel.getStopSwift().getIsChangable()) {
swiftModel.getStopSwift().setEntity(value);
if (value) {
swiftModel.getStartSwift().setEntity(false);
swiftModel.getRestartSwift().setEntity(false);
hostServicesTable.redraw();
}
}
});
hostServicesTable.addColumn(stopSwiftColumn, constants.stopGlusterSwift());
Column<EntityModel, Boolean> restartSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getRestartSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getRestartSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
restartSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
swiftModel.getRestartSwift().setEntity(value);
if (value) {
swiftModel.getStartSwift().setEntity(false);
swiftModel.getStopSwift().setEntity(false);
hostServicesTable.redraw();
}
});
hostServicesTable.addColumn(restartSwiftColumn, constants.restartGlusterSwift());
}
use of org.ovirt.engine.ui.common.widget.renderer.EnumRenderer in project ovirt-engine by oVirt.
the class AddBrickPopupView method initEditors.
private void initEditors() {
volumeTypeEditor = new EntityModelLabelEditor<>(new EnumRenderer<GlusterVolumeType>());
forceEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
showBricksListEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
serverEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<VDS>() {
@Override
public String renderNullSafe(VDS vds) {
return vds.getHostName();
}
});
}
use of org.ovirt.engine.ui.common.widget.renderer.EnumRenderer in project ovirt-engine by oVirt.
the class StoragePopupView method initListBoxEditors.
@SuppressWarnings({ "unchecked", "rawtypes" })
void initListBoxEditors() {
datacenterListEditor = new ListModelListBoxEditor<>(new AbstractRenderer<StoragePool>() {
@Override
public String render(StoragePool storage) {
// $NON-NLS-1$
String formattedString = "";
if (storage != null) {
// Get formatted storage type and format using Enum renders
// $NON-NLS-1$
String storageType = storage.isLocal() ? constants.storageTypeLocal() : "";
String storageFormatType = // $NON-NLS-1$
storage.getStoragePoolFormatType() == null ? // $NON-NLS-1$
"" : new EnumRenderer<StorageFormatType>().render(storage.getStoragePoolFormatType());
// Add storage type and format if available
if (!storageType.isEmpty() || !storageFormatType.isEmpty()) {
// $NON-NLS-1$
formattedString = " (";
if (storage.isLocal()) {
formattedString += storageType;
} else {
formattedString += storageFormatType;
}
// $NON-NLS-1$
formattedString += ")";
}
formattedString = storage.getName() + formattedString;
}
return formattedString;
}
});
formatListEditor = new ListModelListBoxEditor<>(new EnumRenderer());
hostListEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
domainFunctionListEditor = new ListModelListBoxEditor<>(new EnumRenderer<StorageDomainType>());
storageTypeListEditor = new ListModelListBoxEditor<>(new EnumRenderer<StorageType>());
activateDomainEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
wipeAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
backup = new EntityModelCheckBoxEditor(Align.RIGHT);
discardAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
}
use of org.ovirt.engine.ui.common.widget.renderer.EnumRenderer in project ovirt-engine by oVirt.
the class VmDiskPopupWidget method initManualWidgets.
@SuppressWarnings({ "unchecked", "rawtypes" })
private void initManualWidgets() {
storageDomainEditor = new ListModelListBoxEditor<>(new StorageDomainFreeSpaceRenderer());
hostListEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
diskProfileEditor = new ListModelListBoxEditor<>(new NameRenderer<DiskProfile>());
quotaEditor = new ListModelListBoxEditor<>(new NameRenderer<Quota>());
interfaceEditor = new ListModelListBoxEditor<>(new EnumRenderer());
datacenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>());
cinderVolumeTypeEditor = new ListModelListBoxEditor<>();
volumeTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer());
storageTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer());
plugDiskToVmEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
wipeAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isBootableEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isShareableEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isReadOnlyEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
passDiscardEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isUsingScsiReservationEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isScsiPassthroughEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isSgIoUnfilteredEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
interfaceInfoIcon = new InfoIcon(templates.italicText(constants.diskInterfaceInfo()));
cinderVolumeTypeInfoIcon = new InfoIcon(templates.italicText(constants.cinderVolumeTypeInfoIcon()));
scsiReservationInfoIcon = new InfoIcon(templates.italicText(constants.scsiReservationInfoIcon()));
}
use of org.ovirt.engine.ui.common.widget.renderer.EnumRenderer 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>());
}
Aggregations