Search in sources :

Example 6 with CustomSelectionCell

use of org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderPopupView method addNetworkColumn.

private void addNetworkColumn() {
    customSelectionCellNetwork = new CustomSelectionCell(new ArrayList<String>());
    customSelectionCellNetwork.setStyle(style.cellSelectBox());
    Column<VmNetworkInterface, String> networkColumn = new Column<VmNetworkInterface, String>(customSelectionCellNetwork) {

        @Override
        public String getValue(VmNetworkInterface iface) {
            ImportNetworkData importNetworkData = importModel.getNetworkImportData(iface);
            List<String> networkNames = importNetworkData.getNetworkNames();
            ((CustomSelectionCell) getCell()).setOptions(networkNames);
            if (networkNames.isEmpty()) {
                // $NON-NLS-1$
                return "";
            }
            String selectedNetworkName = importNetworkData.getSelectedNetworkName();
            return selectedNetworkName != null ? selectedNetworkName : networkNames.get(0);
        }
    };
    networkColumn.setFieldUpdater((index, iface, value) -> {
        importModel.getNetworkImportData(iface).setSelectedNetworkName(value);
        nicTable.asEditor().edit(importModel.getImportNetworkInterfaceListModel());
    });
    // $NON-NLS-1$
    nicTable.addColumn(networkColumn, constants.networkNameInterface(), "150px");
}
Also used : ImportNetworkData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportNetworkData) CustomSelectionCell(org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) Column(com.google.gwt.user.cellview.client.Column) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ArrayList(java.util.ArrayList)

Example 7 with CustomSelectionCell

use of org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderPopupView method addNetworkProfileColumn.

private void addNetworkProfileColumn() {
    customSelectionCellNetwork = new CustomSelectionCell(new ArrayList<String>());
    customSelectionCellNetwork.setStyle(style.cellSelectBox());
    Column<VmNetworkInterface, String> profileColumn = new Column<VmNetworkInterface, String>(customSelectionCellNetwork) {

        @Override
        public String getValue(VmNetworkInterface iface) {
            ImportNetworkData importNetworkData = importModel.getNetworkImportData(iface);
            List<String> networkProfileNames = new ArrayList<>();
            for (VnicProfileView networkProfile : importNetworkData.getFilteredNetworkProfiles()) {
                networkProfileNames.add(networkProfile.getName());
            }
            ((CustomSelectionCell) getCell()).setOptions(networkProfileNames);
            if (networkProfileNames.isEmpty()) {
                // $NON-NLS-1$
                return "";
            }
            VnicProfileView selectedNetworkProfile = importModel.getNetworkImportData(iface).getSelectedNetworkProfile();
            return selectedNetworkProfile != null ? selectedNetworkProfile.getName() : networkProfileNames.get(0);
        }
    };
    profileColumn.setFieldUpdater((index, iface, value) -> importModel.getNetworkImportData(iface).setSelectedNetworkProfile(value));
    // $NON-NLS-1$
    nicTable.addColumn(profileColumn, constants.profileNameInterface(), "150px");
}
Also used : ImportNetworkData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportNetworkData) CustomSelectionCell(org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) Column(com.google.gwt.user.cellview.client.Column) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ArrayList(java.util.ArrayList) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView)

Example 8 with CustomSelectionCell

use of org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell in project ovirt-engine by oVirt.

the class RegisterEntityPopupView method getClusterColumn.

protected Column<D, String> getClusterColumn() {
    CustomSelectionCell customSelectionCell = new CustomSelectionCell(new ArrayList<String>());
    // $NON-NLS-1$
    customSelectionCell.setStyle("input-group col-xs-11 gwt-ListBox");
    Column<D, String> column = new Column<D, String>(customSelectionCell) {

        @Override
        public String getValue(D object) {
            ((CustomSelectionCell) getCell()).setOptions(object.getClusterNames());
            return object.getCluster().getSelectedItem() != null ? object.getCluster().getSelectedItem().getName() : constants.empty();
        }
    };
    column.setFieldUpdater((index, object, value) -> {
        object.selectClusterByName(value);
        refreshEntityTable();
    });
    return column;
}
Also used : CustomSelectionCell(org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell) Column(com.google.gwt.user.cellview.client.Column)

Aggregations

CustomSelectionCell (org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell)8 ArrayList (java.util.ArrayList)6 Column (com.google.gwt.user.cellview.client.Column)5 Quota (org.ovirt.engine.core.common.businessentities.Quota)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)3 AbstractColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractColumn)3 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)3 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)3 AbstractImageResourceColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn)3 AbstractSafeHtmlColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn)3 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)3 ImportDiskData (org.ovirt.engine.ui.uicommonweb.models.vms.ImportDiskData)3 VmTypeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn)3 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)2 Guid (org.ovirt.engine.core.compat.Guid)2 ImportNetworkData (org.ovirt.engine.ui.uicommonweb.models.vms.ImportNetworkData)2 List (java.util.List)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 VnicProfileView (org.ovirt.engine.core.common.businessentities.network.VnicProfileView)1