Search in sources :

Example 1 with NetworkClusterModel

use of org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkClusterModel in project ovirt-engine by oVirt.

the class AbstractNetworkPopupView method initEntityModelCellTable.

void initEntityModelCellTable() {
    AbstractCheckboxHeader assignAllHeader = new AbstractCheckboxHeader() {

        @Override
        protected void selectionChanged(Boolean value) {
            for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
                if (networkClusterModel.getIsChangable()) {
                    networkClusterModel.setAttached(value);
                    networkClusterModel.setRequired(value && networkClusterModel.isRequired());
                }
            }
            refreshClustersTable();
        }

        @Override
        public Boolean getValue() {
            for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
                if (networkClusterModel.getIsChangable() && !networkClusterModel.isAttached()) {
                    return false;
                }
            }
            return true;
        }

        @Override
        public boolean isEnabled() {
            for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
                if (networkClusterModel.getIsChangable()) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public String getLabel() {
            return constants.attachAll();
        }
    };
    AbstractCheckboxHeader requiredAllHeader = new AbstractCheckboxHeader() {

        @Override
        protected void selectionChanged(Boolean value) {
            for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
                networkClusterModel.setRequired(value && networkClusterModel.isAttached());
            }
            refreshClustersTable();
        }

        @Override
        public Boolean getValue() {
            for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
                if (!networkClusterModel.isRequired()) {
                    return false;
                }
            }
            return true;
        }

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

        @Override
        public String getLabel() {
            return constants.requiredAll();
        }
    };
    clustersTable.addColumn(new AbstractTextColumn<NetworkClusterModel>() {

        @Override
        public String getValue(NetworkClusterModel model) {
            return model.getName();
        }
    }, constants.nameClusterHeader());
    clustersTable.addColumn(new AbstractCheckboxColumn<NetworkClusterModel>((index, model, value) -> {
        model.setAttached(value);
        model.setRequired(value && model.isRequired());
        refreshClustersTable();
    }) {

        @Override
        public Boolean getValue(NetworkClusterModel model) {
            return model.isAttached();
        }

        @Override
        protected boolean canEdit(NetworkClusterModel model) {
            return model.getIsChangable();
        }

        @Override
        public void render(Context context, NetworkClusterModel object, SafeHtmlBuilder sb) {
            super.render(context, object, sb);
            sb.append(templates.textForCheckBox(constants.attach()));
        }
    }, assignAllHeader, // $NON-NLS-1$
    "150px");
    clustersTable.addColumn(new AbstractCheckboxColumn<NetworkClusterModel>((index, model, value) -> {
        model.setRequired(value && model.isAttached());
        refreshClustersTable();
    }) {

        @Override
        public Boolean getValue(NetworkClusterModel model) {
            return model.isRequired();
        }

        @Override
        protected boolean canEdit(NetworkClusterModel model) {
            return isRequiredChangeable() && model.isAttached();
        }

        @Override
        public void render(Context context, NetworkClusterModel object, SafeHtmlBuilder sb) {
            super.render(context, object, sb);
            sb.append(templates.textForCheckBox(constants.required()));
        }
    }, requiredAllHeader, // $NON-NLS-1$
    "150px");
}
Also used : NetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkModel) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) VnicProfilesEditor(org.ovirt.engine.ui.webadmin.widget.vnicProfile.VnicProfilesEditor) Inject(com.google.inject.Inject) Container(org.gwtbootstrap3.client.ui.Container) Provider(org.ovirt.engine.core.common.businessentities.Provider) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) Unit(com.google.gwt.dom.client.Style.Unit) HTML(com.google.gwt.user.client.ui.HTML) UiBinder(com.google.gwt.uibinder.client.UiBinder) Label(com.google.gwt.user.client.ui.Label) AbstractTabbedModelBoundPopupView(org.ovirt.engine.ui.common.view.popup.AbstractTabbedModelBoundPopupView) ListModelRadioGroupEditor(org.ovirt.engine.ui.common.widget.editor.ListModelRadioGroupEditor) Context(com.google.gwt.cell.client.Cell.Context) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) IntegerEntityModelTextBoxOnlyEditor(org.ovirt.engine.ui.common.widget.editor.generic.IntegerEntityModelTextBoxOnlyEditor) SelectionMode(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable.SelectionMode) NetworkClusterModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkClusterModel) EventBus(com.google.gwt.event.shared.EventBus) DnsServersWidget(org.ovirt.engine.ui.webadmin.widget.provider.DnsServersWidget) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) WithElementId(org.ovirt.engine.ui.common.idhandler.WithElementId) ListModelSuggestBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.ListModelSuggestBoxEditor) ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) UiField(com.google.gwt.uibinder.client.UiField) DialogTabPanel(org.ovirt.engine.ui.common.widget.dialog.tab.DialogTabPanel) MtuSelector(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkModel.MtuSelector) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) StringEntityModelTextBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxEditor) StringEntityModelTextBoxOnlyEditor(org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextBoxOnlyEditor) Align(org.ovirt.engine.ui.common.widget.Align) GWT(com.google.gwt.core.client.GWT) ListModelListBoxEditor(org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor) ArrayList(java.util.ArrayList) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) UiCommandButton(org.ovirt.engine.ui.common.widget.UiCommandButton) DialogTab(org.ovirt.engine.ui.common.widget.dialog.tab.DialogTab) ListModelListBoxOnlyEditor(org.ovirt.engine.ui.common.widget.editor.ListModelListBoxOnlyEditor) AbstractNetworkPopupPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.popup.AbstractNetworkPopupPresenterWidget) Network(org.ovirt.engine.core.common.businessentities.network.Network) HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) AbstractCheckboxHeader(org.ovirt.engine.ui.common.widget.table.header.AbstractCheckboxHeader) EntityModelRadioButtonEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) ApplicationTemplates(org.ovirt.engine.ui.webadmin.ApplicationTemplates) SimpleDialogPanel(org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) ExternalSubnetWidget(org.ovirt.engine.ui.webadmin.widget.provider.ExternalSubnetWidget) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) Context(com.google.gwt.cell.client.Cell.Context) NetworkClusterModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkClusterModel) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) AbstractCheckboxHeader(org.ovirt.engine.ui.common.widget.table.header.AbstractCheckboxHeader)

Aggregations

Context (com.google.gwt.cell.client.Cell.Context)1 GWT (com.google.gwt.core.client.GWT)1 Unit (com.google.gwt.dom.client.Style.Unit)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 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HTML (com.google.gwt.user.client.ui.HTML)1 Label (com.google.gwt.user.client.ui.Label)1 Inject (com.google.inject.Inject)1 ArrayList (java.util.ArrayList)1 Container (org.gwtbootstrap3.client.ui.Container)1 Provider (org.ovirt.engine.core.common.businessentities.Provider)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)1 WithElementId (org.ovirt.engine.ui.common.idhandler.WithElementId)1 AbstractTabbedModelBoundPopupView (org.ovirt.engine.ui.common.view.popup.AbstractTabbedModelBoundPopupView)1