use of org.ovirt.engine.ui.common.widget.table.column.AbstractListModelListBoxColumn in project ovirt-engine by oVirt.
the class ImportNetworksPopupView method initEntityModelCellTables.
void initEntityModelCellTables() {
providerNetworks.addColumn(new AbstractTextColumn<ExternalNetwork>() {
@Override
public String getValue(ExternalNetwork model) {
return model.getDisplayName();
}
}, constants.nameNetworkHeader());
importedNetworks.addColumn(new AbstractEditTextColumn<ExternalNetwork>((index, model, value) -> model.setDisplayName(value)) {
@Override
public String getValue(ExternalNetwork model) {
return model.getDisplayName();
}
}, constants.nameNetworkHeader());
Column<ExternalNetwork, String> idColumn = new AbstractTextColumn<ExternalNetwork>() {
@Override
public String getValue(ExternalNetwork model) {
return model.getNetwork().getProvidedBy().getExternalId();
}
};
providerNetworks.addColumn(idColumn, constants.idNetworkHeader());
importedNetworks.addColumn(idColumn, constants.idNetworkHeader());
dcColumn = new AbstractListModelListBoxColumn<ExternalNetwork, StoragePool>(new NameRenderer<StoragePool>()) {
@Override
public ListModel<StoragePool> getValue(ExternalNetwork network) {
return network.getDataCenters();
}
};
importedNetworks.addColumn(dcColumn, constants.dcNetworkHeader());
AbstractCheckboxHeader publicAllHeader = new AbstractCheckboxHeader() {
@Override
protected void selectionChanged(Boolean value) {
for (ExternalNetwork model : getAllImportedNetworks()) {
model.setPublicUse(value);
}
refreshImportedNetworks();
}
@Override
public Boolean getValue() {
for (ExternalNetwork model : getAllImportedNetworks()) {
if (!model.isPublicUse()) {
return false;
}
}
return true;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public void render(Context context, SafeHtmlBuilder sb) {
super.render(context, sb);
sb.append(ImportNetworksPopupView.templates.tableHeaderInlineImage(SafeHtmlUtils.fromTrustedString(new InfoIcon(SafeHtmlUtils.EMPTY_SAFE_HTML).toString())));
}
@Override
public SafeHtml getTooltip() {
return ImportNetworksPopupView.templates.textForCheckBoxHeader(constants.publicNetworkTooltip());
}
@Override
public String getLabel() {
return constants.publicNetwork();
}
};
importedNetworks.addColumn(new AbstractCheckboxColumn<ExternalNetwork>((index, model, value) -> {
model.setPublicUse(value);
refreshImportedNetworks();
}) {
@Override
public Boolean getValue(ExternalNetwork model) {
return model.isPublicUse();
}
@Override
protected boolean canEdit(ExternalNetwork model) {
return true;
}
@Override
public void render(Context context, ExternalNetwork object, SafeHtmlBuilder sb) {
super.render(context, object, sb);
// $NON-NLS-1$
sb.append(templates.textForCheckBox(""));
}
}, publicAllHeader, // $NON-NLS-1$
"80px");
}
Aggregations