use of org.ovirt.engine.ui.webadmin.widget.table.column.VolumeInfoColumn in project ovirt-engine by oVirt.
the class MainVolumeView method initTable.
void initTable(VolumeListModel model) {
getTable().enableColumnResizing();
VolumeStatusColumn statusColumn = new VolumeStatusColumn(model.getStartCommand());
statusColumn.setContextMenuTitle(constants.statusVolume());
statusColumn.makeSortable(Comparator.comparingInt(g -> GlusterVolumeUtils.getVolumeStatus(g).ordinal()));
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.empty(), "30px");
AbstractTextColumn<GlusterVolumeEntity> nameColumn = new AbstractLinkColumn<GlusterVolumeEntity>(new FieldUpdater<GlusterVolumeEntity, String>() {
@Override
public void update(int index, GlusterVolumeEntity volume, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), volume.getName());
// The link was clicked, now fire an event to switch to details.
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.volumeGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(GlusterVolumeEntity object) {
return object.getName();
}
};
nameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameVolume(), "150px");
AbstractTextColumn<GlusterVolumeEntity> clusterColumn = new AbstractTextColumn<GlusterVolumeEntity>() {
@Override
public String getValue(GlusterVolumeEntity object) {
return object.getClusterName();
}
};
clusterColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(clusterColumn, constants.clusterVolume(), "150px");
AbstractTextColumn<GlusterVolumeEntity> volumeTypeColumn = new AbstractEnumColumn<GlusterVolumeEntity, GlusterVolumeType>() {
@Override
protected GlusterVolumeType getRawValue(GlusterVolumeEntity object) {
return object.getVolumeType();
}
};
volumeTypeColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(volumeTypeColumn, constants.volumeTypeVolume(), "150px");
// $NON-NLS-1$
getTable().addColumn(new VolumeBrickStatusColumn(), constants.bricksStatusVolume(), "150px");
// $NON-NLS-1$
getTable().addColumn(new VolumeInfoColumn(), constants.volumeInfoVolume(), "100px");
MenuCell<GlusterTaskSupport> rebalanceMenuCell = getRebalanceActivityMenu();
MenuCell<GlusterTaskSupport> removeBricksMenuCell = getRemoveBrickActivityMenu();
List<HasCell<GlusterTaskSupport, ?>> list = new ArrayList<>();
list.add(new VolumeActivityStatusColumn<>());
list.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(new VolumeActivitySeperatorCell<GlusterTaskSupport>()) {
@Override
public GlusterTaskSupport getValue(GlusterTaskSupport object) {
return object;
}
});
list.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(rebalanceMenuCell) {
@Override
public GlusterTaskSupport getValue(GlusterTaskSupport object) {
return object;
}
});
list.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(removeBricksMenuCell) {
@Override
public GlusterTaskSupport getValue(GlusterTaskSupport object) {
return object;
}
});
List<HasCell<GlusterTaskSupport, ?>> compositeList = new ArrayList<>();
compositeList.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(new VolumeTaskWaitingCell<>()) {
@Override
public GlusterTaskSupport getValue(GlusterTaskSupport object) {
return object;
}
});
compositeList.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(new VolumeActivityCompositeCell<>(list)) {
@Override
public GlusterTaskSupport getValue(GlusterTaskSupport object) {
return object;
}
});
Column<GlusterVolumeEntity, GlusterVolumeEntity> capacityColumn = new Column<GlusterVolumeEntity, GlusterVolumeEntity>(new VolumeCapacityCell()) {
@Override
public GlusterVolumeEntity getValue(GlusterVolumeEntity object) {
return object;
}
};
// $NON-NLS-1$
getTable().addColumn(capacityColumn, constants.volumeCapacity(), "100px");
getTable().addColumn(new VolumeActivityColumn<GlusterVolumeEntity>(new VolumeActivityCompositeCell<GlusterTaskSupport>(compositeList)), constants.activitiesOnVolume(), // $NON-NLS-1$
"100px");
AbstractTextColumn<GlusterVolumeEntity> snapshotCountColumn = new AbstractTextColumn<GlusterVolumeEntity>() {
@Override
public String getValue(GlusterVolumeEntity object) {
return object.getSnapshotsCount().toString();
}
};
snapshotCountColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(snapshotCountColumn, constants.noOfSnapshotsLabel(), "100px");
}
Aggregations