use of com.google.gwt.view.client.NoSelectionModel in project ovirt-engine by oVirt.
the class RegisterEntityInfoPanel method initAppsTable.
protected void initAppsTable() {
appsTable = new EntityModelCellTable<>(false, true);
AbstractTextColumn<String> appNameColumn = new AbstractTextColumn<String>() {
@Override
public String getValue(String appName) {
return appName;
}
};
appsTable.addColumn(appNameColumn, constants.nameSnapshot());
appsTable.setRowData(new ArrayList<EntityModel>());
// $NON-NLS-1$
appsTable.setWidth("100%");
appsTable.setSelectionModel(new NoSelectionModel());
appsTable.setEmptyTableWidget(new NoItemsLabel());
}
use of com.google.gwt.view.client.NoSelectionModel in project ovirt-engine by oVirt.
the class EntityModelCellTable method addCheckBoxColumn.
private void addCheckBoxColumn(boolean hideCheckbox, boolean showSelectAllCheckbox) {
if (!hideCheckbox) {
// Add selection column
Column<EntityModel, Boolean> checkColumn = null;
if (getSelectionModel() instanceof SingleSelectionModel) {
checkColumn = new Column<EntityModel, Boolean>(new RadioboxCell(true, false)) {
@Override
public Boolean getValue(EntityModel object) {
return getSelectionModel().isSelected(object);
}
};
addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant(constants.htmlNonBreakingSpace()));
} else if (getSelectionModel() instanceof MultiSelectionModel) {
checkColumn = new Column<EntityModel, Boolean>(new CheckboxCell(true, false)) {
@Override
public Boolean getValue(EntityModel object) {
return getSelectionModel().isSelected(object);
}
};
if (showSelectAllCheckbox) {
AbstractSelectAllCheckBoxHeader<EntityModel> selectAllHeader = new AbstractSelectAllCheckBoxHeader<EntityModel>() {
@Override
protected void selectionChanged(Boolean value) {
if (getListModel() == null || getListModel().getItems() == null) {
return;
}
handleSelection(value, getListModel(), getSelectionModel());
}
@Override
public Boolean getValue() {
if (getListModel() == null || getListModel().getItems() == null) {
return false;
}
return getCheckValue(getListModel().getItems(), getSelectionModel());
}
};
addColumn(checkColumn, selectAllHeader);
} else {
addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant(constants.htmlNonBreakingSpace()));
}
}
if (checkColumn != null) {
setColumnWidth(checkColumn, CHECK_COLUMN_WIDTH, Unit.PX);
selectionColumnPresent = true;
}
addCellPreviewHandler(event -> {
int columnIndex = event.getColumn();
Cell<?> cell = getColumn(columnIndex).getCell();
if (cell instanceof EventHandlingCell && ((EventHandlingCell) cell).handlesEvent(event)) {
return;
}
if (BrowserEvents.CLICK.equals(event.getNativeEvent().getType()) && !(getSelectionModel() instanceof NoSelectionModel)) {
// Let the selection column deal with this
if (event.getColumn() == 0) {
return;
}
getSelectionModel().setSelected(event.getValue(), !getSelectionModel().isSelected(event.getValue()));
}
});
}
}
use of com.google.gwt.view.client.NoSelectionModel in project ovirt-engine by oVirt.
the class VmSnapshotInfoPanel method initNicsTable.
private void initNicsTable() {
nicsTable = new EntityModelCellTable<>(false, true);
nicsTable.enableColumnResizing();
AbstractTextColumn<VmNetworkInterface> nameColumn = new AbstractTextColumn<VmNetworkInterface>() {
@Override
public String getValue(VmNetworkInterface object) {
return object.getName();
}
};
// $NON-NLS-1$
nicsTable.addColumn(nameColumn, constants.nameInterface(), "80px");
AbstractTextColumn<VmNetworkInterface> networkNameColumn = new AbstractTextColumn<VmNetworkInterface>() {
@Override
public String getValue(VmNetworkInterface object) {
return object.getNetworkName();
}
};
// $NON-NLS-1$
nicsTable.addColumn(networkNameColumn, constants.networkNameInterface(), "80px");
AbstractTextColumn<VmNetworkInterface> profileNameColumn = new AbstractTextColumn<VmNetworkInterface>() {
@Override
public String getValue(VmNetworkInterface object) {
return object.getVnicProfileName();
}
};
// $NON-NLS-1$
nicsTable.addColumn(profileNameColumn, constants.profileNameInterface(), "80px");
AbstractTextColumn<VmNetworkInterface> typeColumn = new AbstractEnumColumn<VmNetworkInterface, VmInterfaceType>() {
@Override
protected VmInterfaceType getRawValue(VmNetworkInterface object) {
return VmInterfaceType.forValue(object.getType());
}
};
// $NON-NLS-1$
nicsTable.addColumn(typeColumn, constants.typeInterface(), "80px");
AbstractTextColumn<VmNetworkInterface> macColumn = new AbstractTextColumn<VmNetworkInterface>() {
@Override
public String getValue(VmNetworkInterface object) {
return object.getMacAddress();
}
};
// $NON-NLS-1$
nicsTable.addColumn(macColumn, constants.macInterface(), "80px");
AbstractTextColumn<VmNetworkInterface> speedColumn = new AbstractTextColumn<VmNetworkInterface>() {
@Override
public String getValue(VmNetworkInterface object) {
if (object.getSpeed() != null) {
return object.getSpeed().toString();
} else {
return null;
}
}
};
// $NON-NLS-1$
nicsTable.addColumn(speedColumn, templates.sub(constants.speedInterface(), constants.mbps()), "80px");
AbstractTextColumn<VmNetworkInterface> rxColumn = new AbstractRxTxRateColumn<VmNetworkInterface>() {
@Override
protected Double getRate(VmNetworkInterface object) {
return object.getStatistics().getReceiveRate();
}
@Override
protected Double getSpeed(VmNetworkInterface object) {
if (object.getSpeed() != null) {
return object.getSpeed().doubleValue();
} else {
return null;
}
}
};
// $NON-NLS-1$
nicsTable.addColumn(rxColumn, templates.sub(constants.rxRate(), constants.mbps()), "80px");
AbstractTextColumn<VmNetworkInterface> txColumn = new AbstractRxTxRateColumn<VmNetworkInterface>() {
@Override
protected Double getRate(VmNetworkInterface object) {
return object.getStatistics().getTransmitRate();
}
@Override
protected Double getSpeed(VmNetworkInterface object) {
if (object.getSpeed() != null) {
return object.getSpeed().doubleValue();
} else {
return null;
}
}
};
// $NON-NLS-1$
nicsTable.addColumn(txColumn, templates.sub(constants.txRate(), constants.mbps()), "80px");
AbstractTextColumn<VmNetworkInterface> dropsColumn = new AbstractSumUpColumn<VmNetworkInterface>() {
@Override
protected Double[] getRawValue(VmNetworkInterface object) {
Double receiveDropRate = object != null ? object.getStatistics().getReceiveDropRate() : null;
Double transmitDropRate = object != null ? object.getStatistics().getTransmitDropRate() : null;
return new Double[] { receiveDropRate, transmitDropRate };
}
};
// $NON-NLS-1$
nicsTable.addColumn(dropsColumn, templates.sub(constants.dropsInterface(), constants.pkts()), "80px");
nicsTable.setRowData(new ArrayList<EntityModel>());
// $NON-NLS-1$
nicsTable.setWidth("100%");
nicsTable.setSelectionModel(new NoSelectionModel());
}
use of com.google.gwt.view.client.NoSelectionModel in project ovirt-engine by oVirt.
the class GlusterClusterSnapshotConfigureOptionsPopupView method initEditors.
private void initEditors() {
clusterEditor = new ListModelListBoxEditor<>(new NameRenderer<Cluster>());
configsTable = new EntityModelCellTable<>(false, true);
configsTable.setSelectionModel(new NoSelectionModel());
configsTable.addColumn(new AbstractEntityModelTextColumn<GlusterVolumeSnapshotConfig>() {
@Override
public String getText(GlusterVolumeSnapshotConfig object) {
return object.getParamName();
}
}, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
"200px");
Column<EntityModel<GlusterVolumeSnapshotConfig>, String> valueColumn = new Column<EntityModel<GlusterVolumeSnapshotConfig>, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel<GlusterVolumeSnapshotConfig> object) {
return object.getEntity().getParamValue();
}
};
// $NON-NLS-1$
configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setParamValue(value));
}
use of com.google.gwt.view.client.NoSelectionModel in project ovirt-engine by oVirt.
the class GlusterVolumeGeoReplicationSessionConfigPopupView method initConfigTable.
private void initConfigTable() {
geoReplicationConfigTable = new EntityModelCellTable<>(false, true);
geoReplicationConfigTable.setSelectionModel(new NoSelectionModel());
geoReplicationConfigTable.addColumn(new AbstractEntityModelTextColumn<Pair<Boolean, GlusterGeoRepSessionConfiguration>>() {
@Override
protected String getText(Pair<Boolean, GlusterGeoRepSessionConfiguration> entity) {
return entity.getSecond().getKey();
}
}, constants.optionKeyVolumeParameter(), // $NON-NLS-1$
"150px");
geoReplicationConfigTable.addColumn(new AbstractScrollableTextColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>() {
@Override
public String getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return object.getEntity().getSecond().getDescription() == null ? constants.notAvailableLabel() : object.getEntity().getSecond().getDescription();
}
}, constants.descriptionVolumeParameter(), // $NON-NLS-1$
"300px");
geoReplicationConfigTable.addColumn(new GlusterConfigAwareColumn(), constants.optionValueVolumeParameter(), // $NON-NLS-1$
"200px");
geoReplicationConfigTable.addColumn(new AbstractCheckboxColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>(true, (index, object, value) -> object.getEntity().setFirst(value)) {
@Override
protected boolean canEdit(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return true;
}
@Override
public Boolean getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return object.getEntity().getFirst();
}
}, constants.resetGeoRepSessionConfig());
}
Aggregations