use of org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn 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.table.column.AbstractEntityModelTextColumn in project ovirt-engine by oVirt.
the class MultipleHostsPopupView method initTableColumns.
private void initTableColumns() {
Column<EntityModel, String> nameColumn = new Column<EntityModel, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel object) {
return ((HostDetailModel) object.getEntity()).getName();
}
};
// $NON-NLS-1$
hostsTable.addColumn(nameColumn, constants.nameHost(), "50px");
nameColumn.setFieldUpdater((index, object, value) -> ((HostDetailModel) object.getEntity()).setName(value));
hostsTable.addColumn(new AbstractEntityModelTextColumn<HostDetailModel>() {
@Override
public String getText(HostDetailModel hostModel) {
return hostModel.getAddress();
}
}, constants.ipHost(), // $NON-NLS-1$
"100px");
Column<EntityModel, String> passwordColumn = new Column<EntityModel, String>(new PasswordTextInputCell()) {
@Override
public String getValue(EntityModel object) {
return ((HostDetailModel) object.getEntity()).getPassword();
}
};
// $NON-NLS-1$
hostsTable.addColumn(passwordColumn, constants.hostPopupPasswordLabel(), "100px");
passwordColumn.setFieldUpdater((index, object, value) -> ((HostDetailModel) object.getEntity()).setPassword(value));
hostsTable.addColumn(new AbstractEntityModelTextColumn<HostDetailModel>() {
@Override
public String getText(HostDetailModel hostModel) {
return hostModel.getFingerprint();
}
}, constants.hostsPopupFingerprint(), // $NON-NLS-1$
"300px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn in project ovirt-engine by oVirt.
the class GlusterClusterSnapshotConfigureOptionsPopupView method initEditors.
private void initEditors() {
clusterEditor = new ListModelListBoxEditor<>(new NameRenderer<Cluster>());
configsTable = new EntityModelCellTable<>(false, true);
configsTable.setSelectionModel(new NoSelectionModel());
configsTable.addColumn(new AbstractEntityModelTextColumn<GlusterVolumeSnapshotConfig>() {
@Override
public String getText(GlusterVolumeSnapshotConfig object) {
return object.getParamName();
}
}, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
"200px");
Column<EntityModel<GlusterVolumeSnapshotConfig>, String> valueColumn = new Column<EntityModel<GlusterVolumeSnapshotConfig>, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel<GlusterVolumeSnapshotConfig> object) {
return object.getEntity().getParamValue();
}
};
// $NON-NLS-1$
configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setParamValue(value));
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn in project ovirt-engine by oVirt.
the class GlusterVolumeGeoReplicationSessionConfigPopupView method initConfigTable.
private void initConfigTable() {
geoReplicationConfigTable = new EntityModelCellTable<>(false, true);
geoReplicationConfigTable.setSelectionModel(new NoSelectionModel());
geoReplicationConfigTable.addColumn(new AbstractEntityModelTextColumn<Pair<Boolean, GlusterGeoRepSessionConfiguration>>() {
@Override
protected String getText(Pair<Boolean, GlusterGeoRepSessionConfiguration> entity) {
return entity.getSecond().getKey();
}
}, constants.optionKeyVolumeParameter(), // $NON-NLS-1$
"150px");
geoReplicationConfigTable.addColumn(new AbstractScrollableTextColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>() {
@Override
public String getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return object.getEntity().getSecond().getDescription() == null ? constants.notAvailableLabel() : object.getEntity().getSecond().getDescription();
}
}, constants.descriptionVolumeParameter(), // $NON-NLS-1$
"300px");
geoReplicationConfigTable.addColumn(new GlusterConfigAwareColumn(), constants.optionValueVolumeParameter(), // $NON-NLS-1$
"200px");
geoReplicationConfigTable.addColumn(new AbstractCheckboxColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>(true, (index, object, value) -> object.getEntity().setFirst(value)) {
@Override
protected boolean canEdit(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return true;
}
@Override
public Boolean getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return object.getEntity().getFirst();
}
}, constants.resetGeoRepSessionConfig());
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotConfigureOptionsPopupView method initEditors.
private void initEditors() {
configsTable = new EntityModelCellTable<>(false, true);
configsTable.setSelectionModel(new NoSelectionModel());
configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {
@Override
public String getText(VolumeSnapshotOptionModel object) {
return object.getOptionName();
}
}, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
"150px");
configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {
@Override
public String getText(VolumeSnapshotOptionModel object) {
return object.getCorrespodingClusterValue();
}
}, constants.clusterSnapshotConfigValue(), // $NON-NLS-1$
"200px");
Column<EntityModel<VolumeSnapshotOptionModel>, String> valueColumn = new Column<EntityModel<VolumeSnapshotOptionModel>, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel<VolumeSnapshotOptionModel> object) {
return ((VolumeSnapshotOptionModel) object.getEntity()).getOptionValue();
}
};
// $NON-NLS-1$
configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setOptionValue(value));
}
Aggregations