Search in sources :

Example 1 with AbstractEntityModelTextColumn

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());
}
Also used : Context(com.google.gwt.cell.client.Cell.Context) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RadioboxCell(org.ovirt.engine.ui.common.widget.table.cell.RadioboxCell) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) GlusterServiceStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) Column(com.google.gwt.user.cellview.client.Column) ServiceType(org.ovirt.engine.core.common.businessentities.gluster.ServiceType) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) GlusterSwiftServiceModel(org.ovirt.engine.ui.uicommonweb.models.clusters.GlusterSwiftServiceModel) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)

Example 2 with AbstractEntityModelTextColumn

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");
}
Also used : PasswordTextInputCell(org.ovirt.engine.ui.common.widget.table.cell.PasswordTextInputCell) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell) PasswordTextInputCell(org.ovirt.engine.ui.common.widget.table.cell.PasswordTextInputCell)

Example 3 with AbstractEntityModelTextColumn

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));
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell)

Example 4 with AbstractEntityModelTextColumn

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());
}
Also used : AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) EventBus(com.google.gwt.event.shared.EventBus) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) ElementIdHandler(org.ovirt.engine.ui.common.idhandler.ElementIdHandler) Inject(com.google.inject.Inject) UiCommonEditorDriver(org.ovirt.engine.ui.common.editor.UiCommonEditorDriver) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) AbstractModelBoundPopupView(org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView) GWT(com.google.gwt.core.client.GWT) GlusterConfigAwareColumn(org.ovirt.engine.ui.common.widget.table.column.GlusterConfigAwareColumn) GlusterVolumeGeoReplicationSessionConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeGeoReplicationSessionConfigModel) WithElementId(org.ovirt.engine.ui.common.idhandler.WithElementId) GlusterGeoRepSessionConfiguration(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) UiBinder(com.google.gwt.uibinder.client.UiBinder) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) SimpleDialogPanel(org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel) GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoReplicationSessionConfigPopupPresenterWidget) UiField(com.google.gwt.uibinder.client.UiField) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) AbstractScrollableTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractScrollableTextColumn) Pair(org.ovirt.engine.core.common.utils.Pair) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterGeoRepSessionConfiguration(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration) GlusterConfigAwareColumn(org.ovirt.engine.ui.common.widget.table.column.GlusterConfigAwareColumn) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 5 with AbstractEntityModelTextColumn

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));
}
Also used : AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel)

Aggregations

AbstractEntityModelTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn)5 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 Column (com.google.gwt.user.cellview.client.Column)4 TextInputCell (com.google.gwt.cell.client.TextInputCell)3 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)3 Context (com.google.gwt.cell.client.Cell.Context)1 GWT (com.google.gwt.core.client.GWT)1 EventBus (com.google.gwt.event.shared.EventBus)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1 UiBinder (com.google.gwt.uibinder.client.UiBinder)1 UiField (com.google.gwt.uibinder.client.UiField)1 Inject (com.google.inject.Inject)1 GlusterGeoRepSessionConfiguration (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionConfiguration)1 GlusterServerService (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)1 GlusterServiceStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus)1 GlusterVolumeSnapshotConfig (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)1 ServiceType (org.ovirt.engine.core.common.businessentities.gluster.ServiceType)1 Pair (org.ovirt.engine.core.common.utils.Pair)1 UiCommonEditorDriver (org.ovirt.engine.ui.common.editor.UiCommonEditorDriver)1 ElementIdHandler (org.ovirt.engine.ui.common.idhandler.ElementIdHandler)1