use of org.ovirt.engine.ui.uicommonweb.models.vms.ImportNetworkData 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");
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ImportNetworkData 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");
}
Aggregations