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");
}
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");
}
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;
}
Aggregations