use of cz.metacentrum.perun.webgui.json.columnProviders.IsClickableCell in project perun by CESNET.
the class FindCompleteRichMembers method getEmptyTable.
/**
* Returns table with RichMembers
*
* @return CellTable widget
*/
public CellTable<RichMember> getEmptyTable() {
// Table data provider.
dataProvider = new ListDataProvider<RichMember>(list);
// Cell table
table = new PerunTable<RichMember>(list);
table.setHyperlinksAllowed(false);
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Sorting
ListHandler<RichMember> columnSortHandler = new ListHandler<RichMember>(dataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
// table selection
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<RichMember>createCheckboxManager());
// set empty content & loader
table.setEmptyTableWidget(loaderImage);
loaderImage.setEmptyResultMessage("No member found.");
Column<RichMember, RichMember> checkBoxColumn = new Column<RichMember, RichMember>(new PerunCheckboxCell<RichMember>(true, false, indirectCheckable)) {
@Override
public RichMember getValue(RichMember object) {
// Get the value from the selection model.
object.setChecked(selectionModel.isSelected(object));
return object;
}
};
// updates the columns size
table.setColumnWidth(checkBoxColumn, 40.0, Style.Unit.PX);
// Add the columns
// Checkbox column header
CheckboxCell cb = new CheckboxCell();
Header<Boolean> checkBoxHeader = new Header<Boolean>(cb) {
public Boolean getValue() {
//return true to see a checked checkbox.
return false;
}
};
checkBoxHeader.setUpdater(new ValueUpdater<Boolean>() {
public void update(Boolean value) {
// sets selected to all, if value = true, unselect otherwise
for (RichMember obj : list) {
if (!"INDIRECT".equalsIgnoreCase(obj.getMembershipType())) {
selectionModel.setSelected(obj, value);
}
}
}
});
if (checkable) {
table.addColumn(checkBoxColumn, checkBoxHeader);
}
MemberColumnProvider columnProvider = new MemberColumnProvider(dataProvider, null, table, tableFieldUpdater);
IsClickableCell<RichMember> authz = new IsClickableCell<RichMember>() {
@Override
public boolean isClickable(RichMember object) {
return true;
}
@Override
public String linkUrl(RichMember object) {
return null;
}
};
columnProvider.addIdColumn(authz, 110);
columnProvider.addUserIdColumn(authz, 110);
columnProvider.addStatusColumn(authz, 20);
columnProvider.addNameColumn(authz);
columnProvider.addOrganizationColumn(authz);
columnProvider.addEmailColumn(authz);
columnProvider.addLoginsColumn(authz);
return table;
}
use of cz.metacentrum.perun.webgui.json.columnProviders.IsClickableCell in project perun by CESNET.
the class GetCompleteRichMembers method getEmptyTable.
/**
* Returns empty table
*
* @return CellTable widget
*/
public CellTable<RichMember> getEmptyTable() {
// Table data provider.
dataProvider = new ListDataProvider<RichMember>(list);
// Cell table
table = new PerunTable<RichMember>(list);
// Connect the table to the data provider.
dataProvider.addDataDisplay(table);
// Sorting
ListHandler<RichMember> columnSortHandler = new ListHandler<RichMember>(dataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
// table selection
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<RichMember>createCheckboxManager());
// set empty content & loader
table.setEmptyTableWidget(loaderImage);
if (PerunEntity.VIRTUAL_ORGANIZATION.equals(entity)) {
loaderImage.setEmptyResultMessage("VO has no members.");
} else {
loaderImage.setEmptyResultMessage("Group has no members.");
}
Column<RichMember, RichMember> checkBoxColumn = new Column<RichMember, RichMember>(new PerunCheckboxCell<RichMember>(true, false, indirectCheckable)) {
@Override
public RichMember getValue(RichMember object) {
// Get the value from the selection model.
object.setChecked(selectionModel.isSelected(object));
return object;
}
};
// updates the columns size
table.setColumnWidth(checkBoxColumn, 40.0, Style.Unit.PX);
// Add the columns
// Checkbox column header
CheckboxCell cb = new CheckboxCell();
Header<Boolean> checkBoxHeader = new Header<Boolean>(cb) {
public Boolean getValue() {
//return true to see a checked checkbox.
return false;
}
};
checkBoxHeader.setUpdater(new ValueUpdater<Boolean>() {
public void update(Boolean value) {
// sets selected to all, if value = true, unselect otherwise
for (RichMember obj : list) {
if (!"INDIRECT".equalsIgnoreCase(obj.getMembershipType())) {
selectionModel.setSelected(obj, value);
}
}
}
});
if (checkable) {
table.addColumn(checkBoxColumn, checkBoxHeader);
}
MemberColumnProvider columnProvider = new MemberColumnProvider(dataProvider, backupList, table, tableFieldUpdater);
IsClickableCell<RichMember> authz = new IsClickableCell<RichMember>() {
@Override
public boolean isClickable(RichMember object) {
return true;
}
@Override
public String linkUrl(RichMember object) {
return null;
}
};
columnProvider.addIdColumn(authz, 110);
columnProvider.addUserIdColumn(authz, 110);
columnProvider.addStatusColumn(authz, 20);
columnProvider.addNameColumn(authz);
columnProvider.addOrganizationColumn(authz);
columnProvider.addEmailColumn(authz);
columnProvider.addLoginsColumn(authz);
return table;
}
Aggregations